Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LISP TO INSERET DYNAMIC BLOCK

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
smallƑish
240 Views, 2 Replies

LISP TO INSERET DYNAMIC BLOCK

Is there any chance to insert a Strechable Dynamic block to a drawing by the user clicking 2 points?

1. Insertion point  ( Base point of the block)

2. End of stretch point (Strech the dynamic part with reference user click 2, the rotation should align with the stretch direction.)

DWG is attached with reference to Block and its application 

Thank you 

2 REPLIES 2
Message 2 of 3
komondormrex
in reply to: smallƑish

it seems you've got mirrored blocks in a dwg sample. check the lisp below that inserts dyn block and stretches it to the  distance between two points selected.

(defun C:insert_d_block (/ insertion_point dyn_width_point insert_name insert_layer vcd_block target_property)
	(setq insertion_point (trans (getpoint "\nPick block's insertion point: ") 1 0)
		  dyn_width_point (trans (getpoint insertion_point "\nPick block's dyn width point: ") 1 0)
		  insert_name "-ep-vcd"
		  insert_layer "m-vcds"
		  vcd_block (vla-insertblock (vla-get-block (vla-get-activelayout (vla-get-activedocument (vlax-get-acad-object))))
			  		 				 (vlax-3d-point dyn_width_point)
		     	              	 	 insert_name
		      	 	      	 		 1 1 1 (angle insertion_point dyn_width_point)   
		     		)
	      vcd_block_dynamic_properties (vlax-invoke vcd_block 'getdynamicblockproperties)
	)
	(vla-put-layer vcd_block insert_layer) 
	(if (vl-some '(lambda (property) (= "Distance1" (vla-get-propertyname (setq target_property property)))) vcd_block_dynamic_properties) 
		(vla-put-value target_property (distance insertion_point dyn_width_point))
	)
	(princ)
)
Message 3 of 3
smallƑish
in reply to: smallƑish

I had a problem with the block. when I fixed it. it's showing this way.

any chance to insert default as the correct method?

It will save a TON of time.

Thank you Very much.

 

smallish_1-1692212513129.png

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report