Hi
I am working on a lisp routine that automaticaly inserts a parameter in a block and then ads a stretch command to it. But the problem is that for the stretch command u need to select the drawn parameter. So my plan was to get the name of this parameter (car (entsel)) and feet it to my lisp program. But when i do that it doesn't work because autocad demands a parameter.
Hope somebody can help me whit this problem
Regards
Thomas
Solved! Go to Solution.
Solved by pbejse. Go to Solution.
@Thomas.l wrote:Hi
I am working on a lisp routine that automaticaly inserts a parameter in a block and then ads a stretch command to it. But the problem is that for the stretch command u need to select the drawn parameter. So my plan was to get the name of this parameter (car (entsel)) and feet it to my lisp program. But when i do that it doesn't work because autocad demands a parameter.
Hope somebody can help me whit this problem
Regards
Thomas
Look into GetDynamicBlockProperties method
Try something like this
(setq propname "Wall Height distance") ;<-- property name (setq propval 1200.0);<-- propert value of double (if (setq ss (ssget "_:S" '((0 . "INSERT")(2 . "`*U*,*")))) ;<-- to change dynamic blocks (progn ;get vla-object selected (setq blkobj (vlax-ename->vla-object (ssname ss 0))) ;retrieve desired property list (setq proplst (vl-remove-if-not '(lambda (x) (eq (vla-get-PropertyName x) propname )) (vlax-invoke blkobj 'getdynamicblockproperties))) ;get dynamic property we need (setq prop (car proplst)) ;set desired property value to this property (vla-put-value prop (vlax-make-variant propval 5)) ;<-- 5 is for double value, see Help file (vla-update blkobj);<-- update selected block ) )
~'J'~
wel that is a piece of interesting code.
But it isn't exactly what i am looking for.
I simply want to be able to ad a stretch action to a stretch parameter whitout having to quite my lisp routine.
Regards
Thomas
@Thomas.l wrote:wel that is a piece of interesting code.
But it isn't exactly what i am looking for.
I simply want to be able to ad a stretch action to a stretch parameter whitout having to quite my lisp routine.
Regards
Thomas
Share your code then we'll incorporate the same method on your routine
This should give you the idea
(setq ang 0) (defun c:az () (setq pt1 (getpoint "define insertion point:") pt2 (polar pt1 (/ (* ang 2 pi) 360) 100)) (command "bparameter" "linear" pt2 pt1 "500,0" "1") (command "baction") ) (defun c:aq () (setq ang (+ ang 1)) (command "bvstate" "set" ang))
these functions work for block in attachemend when opend in block editor.
And thank you both for helping!
Regards
Thomas
@Thomas.l wrote:This should give you the idea
these functions work for block in attachemend when opend in block editor.
And thank you both for helping!
Regards
Thomas
Try this way to select the parameter
(defun c:az ()
(setq pt1 (getpoint "define insertion point:")
pt2 (polar pt1 (/ (* ang 2 pi) 360) 100)
)
(command "bparameter" "linear" pt2 pt1 "500,0" "1")
(command "baction" (nentselp pt1)) ;<--- you do the rest
)
Thank you very much that was exactly what i was looking foor.
I realy don't know how i could mis that.
Regards Thomas