# set distance by lisp in a dynamic block

## Recommended Posts

Hi.

Maybe someone here in this forum can help me.

I'm trying to set the distance for a dynamic block of a single parameter; which is linear and is called Distance1.

I do not know what I'm doing wrong, but I can not do it and change the desired distance.

He helped me with the functions of Lee Mac, but something is wrong. Any help very similar, I will be completely grateful.

(defun c: ddd (/ obj dd)

(if (y (setq obj (car (entsel "\ ndynamic block:")
(setq dd (getdist "\ Length:"))))
(= "AcDbBlockReference" (vla- get-objectname (setq obj (vlax-esame-> vla-object obj))))
(=: vlax-true (vla-get-isdynamicblock obj))
)

(LM: setdynpropvalue obj "Distance1" dd)
)

(princ)

)

(defun LM: setdynpropvalue (blk prp val)
(setq prp (strcase prp))

(vl-some        '(lambda (x)
(if (= 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))
)
)
)
(vlax-invoke blk 'getdynamicblockproperties)     ) )

##### Share on other sites

Hi,

Try this function.

(defun set:distance (blk dis)
(vl-some '(lambda (x)
(and (eq "Distance1" (vla-get-propertyname x)) (vlax-put x 'Value dis))
)
(vlax-invoke (vlax-ename->vla-object blk) 'getdynamicBlockproperties)
)

Usage of above function:

(set:distance <BlockEntityName> <DistanceValue>)

Cross post HERE.

##### Share on other sites
Cross post HERE.

And also [/url]HERE

##### Share on other sites
And also [/url]HERE

##### Share on other sites

Don't forget THIS

##### Share on other sites

Wow, the OP raises cross posting to a whole new level.:(

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.