I need a lisp to change the entities color. Three choice for changing the color: 1. change color to red. 2. change color to yellow. 3. change color to green.
need to force the user to press 1 or 2 or 3.
The lisp also need to prompt the user for 2 corners of a window and print a message displaying the number of entities that were changed. Ex: if the user chose number 3, the message should be "527 Entities were changed to the color GREEN". If there are no entities in the window, the message should be like " No entities selected."
Thanks for your help.
Solved! Go to Solution.
Solved by hmsilva. Go to Solution.
@Ranjit_Singh2 wrote:
@owitzki wrote:
syntax for true color please!
.... I would avaoid messing with (acad_truecolordlg)
That raises the question: @owitzki, are you looking for something like what's in Post 1 [a limited set of fixed color choices], or more like the TrueColor version of Post 8 and subsequent replies [the User gets to choose a TrueColor]? If the latter, I expect it will be necessary to mess with (acad_truecolordlg).
@Kent1Cooper wrote:
@Ranjit_Singh2 wrote:
@owitzki wrote:
syntax for true color please!
.... I would avaoid messing with (acad_truecolordlg)
That raises the question: @owitzki, are you looking for something like what's in Post 1 [a limited set of fixed color choices], or more like the TrueColor version of Post 8 and subsequent replies [the User gets to choose a TrueColor]? If the latter, I expect it will be necessary to mess with (acad_truecolordlg).
You are right. If the user intends to select it from the dialog box he needs to call (acad_truecolordlg). I was assuming the RGB value is known and so the OP was looking for a function to convert to true color.
Tnx Ranjit, I actually want true color for 254 but ... ac254 seems doesn't work!
Maybe I should give you the lisp I found here in the forum and tried to modify it:
(defun c:d254t ( / d )
(vlax-for b (vla-get-blocks (setq d (vla-get-activedocument (vlax-get-acad-object))))
(if (= :vlax-false (vla-get-isxref b))
(vlax-for o b
(if (and (= "AcDbHatch" (vla-get-objectname o))
(= "SOLID" (strcase (vla-get-patternname o)))
(vlax-write-enabled-p o)
)
(vla-put-color o rgb:190,190,190)
)
)
)
)
(vla-regen d acallviewports)
(princ)
)
(vl-load-com) (princ)
The original topic for this was delete all solid hatch and it's a powerful tool. But other designers want solid hatch to be light color (which I made it 254) but it is not safe if some discipline uses 254 as black. If we use true color of 254 (rgb:190,190,190) then my dwg is safe.
Also, using setbylayer command (set color bylayer), it does make all color bylayer but dimension, leader & mtext with forced color, their color don't change. Is there a routine that changes globally all colors bylayer (including mtext, leaders & dimensions)?
@owitzki wrote:
Also, using setbylayer command (set color bylayer), it does make all color bylayer but dimension, leader & mtext with forced color, their color don't change. Is there a routine that changes globally all colors bylayer (including mtext, leaders & dimensions)?
Do some Searching. There are routines on these Forums and elsewhere to do that kind of thing.
Can't find what you're looking for? Ask the community or share your knowledge.