Message 1 of 9
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi community
For official, city approved, dwgs, I need to separate all of my hatches in back- and foreground colors and patterns. I am new to LISP coding but this is as far as I have gotten:
(defun c:test (/ c a d)
(vl-load-com)
(vlax-for l (vla-get-layers (setq d (vla-get-activedocument (vlax-get-acad-object))))
(cond ((= -1 (vlax-get l 'lock)) (vlax-put l 'lock 0) (setq a (cons l a))))
)
(vlax-for b (vla-get-blocks d)
(if (= 0 (vlax-get b 'isxref))
(vlax-for o b
(cond
((and (vlax-write-enabled-p o) (= (vla-get-objectname o) "AcDbHatch"))
(or c (progn (setq c (vla-get-backgroundcolor o)) (vla-put-entitycolor c -939524096)))
(vla-put-backgroundcolor o c)
)
)
)
)
)
(foreach l a (vlax-put l 'lock -1))
(vla-regen d acallviewports)
(princ)
)
;; Run the command automatically when the file is loaded
(c:test)
Additionally I was thinking to check for the background color and create a copy of the hatch before setting the background color to none. The background pattern is always going to be solid.
Any help is appreciated.
se.ha
Dieser Beitrag war hilfreich? Dann könnt ihr diesen Beitrag gerne liken.
Hat dieser Beitrag die Frage erfolgreich beantwortet? Dann klickt bitte auf den Button 'Lösung akzeptieren'.
Solved! Go to Solution.