• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

change color objects with input data

PSP11

Guest
Bye to all,
I tried to search for a lisp that allows me to change the color of some selected objects with a value to insert as input. I also looked at the manuals to write lisp but not being practical programming I did not understand how to do, not having found similar lisp that modify a property of objects.
I know that the change is simple to make via the property menu, but when using many colors I would like to avoid having a curtain with all the color styles used by the autocad opening., then a key or a command to insert the color input from the keyboard would make everything much easier and faster.

I hope you can help me. Thank you.
 
proof questo:
Code:
(defun c:chcol ( / obj col n)
(vla-startundomark (vla-get-activedocument))
(if (and
(princ "\nselezionare oggetti")
(setq obj (ssget))
(setq col (geting "nuovo colore:"))
(<= 1 col 256)
)
(sslength obj)
(setpropertyvalue (ssname obj (setq n (1-n)))) "color" col)
)
)
(vla-endundomark (vla-get-activedocument))
(princ)
)
if you prefer input from the "color" dialog box, replace
(setq col (getint "new color: ")
con(setq col (acad_colordlg 256)
 
About color, gp
in a truecolor color entity (we say as an example 88,88,88) if you go to find group 62 returns you (62 .251), as if it were a gray col.251. but manages it quietly in truecolor.
where does it go to store the true color data?
and if (acad_colordlg 256) launches the standard color dialog, how to return the full color dialog of truecolor?
 
strange thing:
setpropertyvalue on 2010 crashes (no function definition) yet is a vlisp function reported by mom adesk
 
About color, gp
in a truecolor color entity (we say as an example 88,88,88) if you go to find group 62 returns you (62 .251), as if it were a gray col.251. but manages it quietly in truecolor.
where does it go to store the true color data?
and if (acad_colordlg 256) launches the standard color dialog, how to return the full color dialog of truecolor?
the command for truecolor is acad_truecolordlg, ad es.
(setq col (acad_truecolordlg 256)returns pair bets with dxf code relative to color, type:((62 . 40) (420 . 16490500))the scheme is this:(62. colorindex) in the case of index color(62. Colorindex) (420. Truechole) in case of truecolor color((62 . colorindex) (420 . truecolor) (430 . "colorbook$colorname")) in the case of "color catalog"

I find it very convenient and simple to manage the color change of objects with autolisp, rather than with the vla-vlax functions, in the case of this discussion:
Code:
(defun c:chcol ( / obj col n)
(vla-startundomark (vla-get-activedocument))
(if (and
(princ "\nselezionare oggetti")
(setq obj (ssget))
(setq col (acad_truecolordlg 256))
)
(sslength obj)
(entmod (append (entget (ssname obj (setq n (1-n)))))))
)
)
(vla-endundomark (vla-get-activedocument))
(princ)
)


p.s.: The Property Area (e getprofityvalue) are added functions to facilitate lisp with mac versions, not equipped with vla-vlax, if I don't remember badly from 2012.
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top