Dynamic block lisp

Dynamic block lisp

Anonymous
Not applicable
1,077 Views
4 Replies
Message 1 of 5

Dynamic block lisp

Anonymous
Not applicable

I have applied stretch action for block VD ,I want to insert this block on duct in different size with two points one is insertion point and other stretch end pont (for chande the size of VD) How it is work by LISP 

 

Anyone ,Can u help me

 i have attched block VD

0 Likes
1,078 Views
4 Replies
Replies (4)
Message 2 of 5

Ajilal.Vijayan
Advisor
Advisor

There are some Dynamic Block functions created by Lee Mac.

http://www.lee-mac.com/dynamicblockfunctions.html

 

So to change the Distance1 value to 500, you can do like this

(defun c:test ()
	(setq lst '(("Distance1" . "500")))
	(setq blk (vlax-ename->vla-object (ssname (ssget) 0)))
	(LM:setdynprops blk lst)
)

 

0 Likes
Message 3 of 5

Anonymous
Not applicable

i can't work with this programe

 

 

0 Likes
Message 4 of 5

Ajilal.Vijayan
Advisor
Advisor

You have to add or appload the function also.

 

Full code.

(vl-load-com)
(defun c:test ()
	(setq lst '(("Distance1" . "500")))
	(setq blk (vlax-ename->vla-object (ssname (ssget) 0)))
	(LM:setdynprops blk lst)
)
;; Set Dynamic Block Properties  -  Lee Mac
;; Modifies values of Dynamic Block properties using a supplied association list.
;; blk - [vla] VLA Dynamic Block Reference object
;; lst - [lst] Association list of ((<Property> . <Value>) ... )
;; Returns: nil

(defun LM:setdynprops ( blk lst / itm )
    (setq lst (mapcar '(lambda ( x ) (cons (strcase (car x)) (cdr x))) lst))
    (foreach x (vlax-invoke blk 'getdynamicblockproperties)
        (if (setq itm (assoc (strcase (vla-get-propertyname x)) lst))
            (vla-put-value x (vlax-make-variant (cdr itm) (vlax-variant-type (vla-get-value x))))
        )
    )
)

 

0 Likes
Message 5 of 5

Anonymous
Not applicable

nothing happen

 

can u give example with strech property

0 Likes