Dear all,
I am struggling to write a lisp routine which does the followings:
• Select *Every polyline with a width larger than 0 (zero)
• Change their color to a specific one, predefined (i.e. 252)
*Every polyline including blocks.(And nested)
The attached routine “Code 1” changes the color of all polyline with width larger that 0 (zero), but not that inside blocks
(DEFUN C:P252 ()
(setq S2 (ssget "_X" (list (cons 0 "*POLYLINE")
(cons -4 ">")
(cons 40 0.0))) )
(command "Change" S2 "" "p" "c" 252 "")
(princ)
)
Furthermore, the attached routine “Code 2” changes the color (globally) of every polyline, no matter the width. (polyline with width 0)
(defun c:PL-ALL-252 ( / doc )
(vlax-for block (vla-get-blocks (setq doc (vla-get-activedocument (vlax-get-acad-object))))
(if (eq :vlax-false (vla-get-isxref block))
(vlax-for obj block
(if (eq "AcDbPolyline" (vla-get-objectname obj))
(vl-catch-all-apply 'vla-put-color (list obj 252))
)
)
)
)
(vla-regen doc acallviewports)
(princ)
)
(vl-load-com) (princ)
I would be grateful if someone can fix my code, or suggest a new one.
Thank you in advance.
Attaching example drawing: