TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: ROBBO on July 15, 2014, 06:28:14 AM

Title: True Colour help
Post by: ROBBO on July 15, 2014, 06:28:14 AM
Code - Auto/Visual Lisp: [Select]
  1. (vla-put-TextColor (vlax-ename->vla-object e) acMagenta)

Although I can achieve the magenta colour for text as shown in the line above, but I would like to achieve the true colour 255,0,255.

I have tried, but failed. Any help or suggestions to achieve this goal would be much appreciated.

Kind regards, Robbo.
Title: Re: True Colour help
Post by: ChrisCarlson on July 15, 2014, 07:41:08 AM
Do you want true color or RGB? The property you listed is RGB format

//doh! had mixed up different programs, disregard above

I'd peruse Lee's site

http://lee-mac.com/colourconversion.html
Title: Re: True Colour help
Post by: tombu on July 15, 2014, 08:39:35 AM
Google acad_truecolordlg, for an object to be true color the DXF code 420 needs to be set.  I've attached a lisp for modifying attributes including color as an example. 
Title: Re: True Colour help
Post by: Kerry on July 15, 2014, 09:51:34 AM

Have a play

Code - Auto/Visual Lisp: [Select]
  1. (defun c:doit (/ add stuff here)
  2.                  (vlax-get-acad-object)
  3.                  (strcat "AutoCAD.AcCmColor." (substr (getvar "acadver") 1 2))
  4.                )
  5.   )
  6.   (vla-setrgb colObj 255 0 255)
  7.   (setq thingy (car (entsel)))
  8.   (vla-put-truecolor (vlax-ename->vla-object thingy) colObj)
  9. )
Title: Re: True Colour help
Post by: ROBBO on July 15, 2014, 10:33:28 AM
Thanks all for the info. Will read up and have a play.

Kind regards, Robbo.
Title: Re: True Colour help
Post by: ROBBO on July 16, 2014, 02:56:29 AM
Had a go. Although I had some success. Was unable to change a text colour value within a dimension. Nevertheless have learned something and appreciated the help and advice above.

Kind regards, Robbo
Title: Re: True Colour help
Post by: Kerry on July 16, 2014, 03:33:40 AM

Ahhhh ..
http://help.autodesk.com/view/ACD/2015/ENU/?guid=GUID-36320A64-4513-4249-9FF0-ECF19C0B6EC1
Quote
TextColor Property (ActiveX)
Specifies the color of the text for dimension and tolerance objects.

>>> Colors can be set and read as numeric index values ranging from 0 to 256. Constants have been provided for the standard seven colors, as well as the BYBLOCK and BYLAYER designations. <<<