Jump to content

set distance by lisp in a dynamic block


Romero

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)     ) ) 
(vl-load-com) (princ)

Link to comment
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)
          )
) (vl-load-com)

 

Usage of above function:

 

(set:distance <BlockEntityName> <DistanceValue>)

  • Like 1
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...