TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Fabricio28 on March 24, 2020, 08:40:27 AM
-
Hi friends,
How are you?
In my project have about 300,000 pieces of hatches, there are 2 colors; red and green...
I'd like to change all red hatches to color 31 and green to 141 color.
I'm trying to using quick select, and isn't working. Maybe a lisp could help me.
Anybody could help me out, please?
File attached
Thank in advance
Fabrício
-
Hi friends,
How are you?
In my project have about 300,000 pieces of hatches, there are 2 colors; red and green...
I'd like to change all red hatches to color 31 and green to 141 color.
I'm trying to using quick select, and isn't working. Maybe a lisp could help me.
Anybody could help me out, please?
File attached
Thank in advance
Fabrício
Have you ever tried 'Filter' command ? it's one of Autocad Command.
-
(defun c:ch (/ dc ss k n) (vl-load-com)
(if (setq dc (vla-get-ActiveDocument
(vlax-get-acad-object))
ss (ssget "X" '((0 . "hatch") (-4 . "<or")
(62 . 1) (62 . 3) (-4 . "or>"))))
(progn (vla-StartUndomark dc)
(repeat (setq k (sslength ss))
(setq k (1- k) n (vlax-ename->vla-object
(ssname ss k)))
(vla-put-Color n (if (= (vla-get-Color n) 1) 31 141)))
(vla-EndUndomark dc)
)
) (prin1)
)
-
Answered a few times here too: https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/autocad-changing-hatch-color/m-p/9396759#M397570
-
Answered a few times here too: https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/autocad-changing-hatch-color/m-p/9396759#M397570
You're right Ron!
By the way you helped me a lot.
Thank you
Fabício
-
(defun c:ch (/ dc ss k n) (vl-load-com)
(if (setq dc (vla-get-ActiveDocument
(vlax-get-acad-object))
ss (ssget "X" '((0 . "hatch") (-4 . "<or")
(62 . 1) (62 . 3) (-4 . "or>"))))
(progn (vla-StartUndomark dc)
(repeat (setq k (sslength ss))
(setq k (1- k) n (vlax-ename->vla-object
(ssname ss k)))
(vla-put-Color n (if (= (vla-get-Color n) 1) 31 141)))
(vla-EndUndomark dc)
)
) (prin1)
)
Thank you for the help.
Fabricio