Lisp for control dynamic block

Lisp for control dynamic block

Bin2009
Advocate Advocate
1,437 Views
4 Replies
Message 1 of 5

Lisp for control dynamic block

Bin2009
Advocate
Advocate

Hello,

I use dynamic blocks show the soil layers, but when the layers too small , all the blocks stuck together, is any way I can control the distance of the line in dynamic block, let them show nicely and readable?

This image “now” show what I got now.

This image “hope” show what I hope can get.

This drawing “block” is the dynamic block.

 

Thanks

0 Likes
Accepted solutions (1)
1,438 Views
4 Replies
Replies (4)
Message 2 of 5

kajanthangavel
Advocate
Advocate
Accepted solution

I am not LISP expert.

but I hope this help you.

Select  blocksSelect blocks

 

Code here...............

 

(defun LM:setdynpropvalue ( blk prp val )
    (vl-some
       '(lambda ( x )
            (if (= (strcase prp) (strcase (vla-get-propertyname x)))
                (progn
                    (vla-put-value x (vlax-make-variant val (vlax-variant-type (vla-get-value x))))
                    (cond (val) (t))
                );end_progn
            );end_if
        )
        (vlax-invoke blk 'getdynamicblockproperties)
    )
);end_defun

(defun c:DBA ( / D4 D5 D6 hnd ss b_obj)
(setq D4 10.5
	D5 2
	D6 1)

 (if (setq ss (ssget ":L" '((0 . "INSERT"))))
        (progn
            (repeat (setq i (sslength ss))
                (setq hnd (ssname ss (setq i (1- i))))
				
				(setq b_obj (vlax-ename->vla-object hnd))   
				(LM:setdynpropvalue b_obj "Distance4" D4)
				(LM:setdynpropvalue b_obj "Distance5" D5)
				(LM:setdynpropvalue b_obj "Distance6" D6)
				
				(setq D4 (- D4 2))
				(setq D5 (+ D5 3))
            )
		)
  (prompt "Missed Try again   ")
  )
);end_defun  

 

Commadnd - DBA

Message 3 of 5

Sea-Haven
Mentor
Mentor

Are you aware of the Geotech extension from Autodesk may be useful.

0 Likes
Message 4 of 5

Bin2009
Advocate
Advocate

Hello @Kajanthanqavel,

Thank so much, it works great!

I will study your code.

Thanks 

Bin

0 Likes
Message 5 of 5

Bin2009
Advocate
Advocate

Hello @Sea-Haven :

Thank for your information, I will look at Geotech extension.

Bin

0 Likes