Message 1 of 16
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey everyone, I'm seeking a LISP that selects blocks according to its name (effective name), its rotation as degrees. Then I want to change their custom dynamic properties (angle, position1x, position1y..) which I want to predefine all.
For example, I want to create a LISP that selects all
BLOCKNAME1 with
50· Rotation, then change
Angle 310 degrees
position1x 10
position1y 15 etc.
Thanks to @ronjonp, he/she created a LISP that selects blocks according to its effective block name, angle, att_tag and att_value which are predefined.
I'm going to attach a dwg and attach the LISP of @ronjonp below. I hope you may help. Thank you.
;; Thanks to @ronjonp
(defun c:foo (/ a o s)
;; RJP » 2021-07-20
(cond ((setq s (ssget "_X" '((0 . "INSERT") (2 . "`*U*,BLOCKNAME1"))))
(foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
(or (and ;; Blockname check
(= "BLOCKNAME1" (vla-get-effectivename (setq o (vlax-ename->vla-object e))))
;; Get the 'angle1' dyn prop
(setq a (vl-some '(lambda (x)
(if (= (vla-get-propertyname x) "Angle1")
x
)
)
(vlax-invoke o 'getdynamicblockproperties)
)
)
;; See of the angle is 'equal' to 50 degrees
(equal (angtof "50") (vlax-get a 'value) 1e-8)
;; Check that the attribute with 'tag1' is equal to 'value123'
(= "VALUE1111111" (strcase (getpropertyvalue e "TAG1")))
)
(ssdel e s)
)
)
(sssetfirst nil s)
)
)
(princ)
)
Solved! Go to Solution.