LISP TO INSERET DYNAMIC BLOCK

LISP TO INSERET DYNAMIC BLOCK

smallƑish
Advocate Advocate
328 Views
2 Replies
Message 1 of 3

LISP TO INSERET DYNAMIC BLOCK

smallƑish
Advocate
Advocate

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 

0 Likes
Accepted solutions (1)
329 Views
2 Replies
Replies (2)
Message 2 of 3

komondormrex
Mentor
Mentor
Accepted solution

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
Advocate
Advocate

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

 

 

0 Likes