Jump to content
GMaracchioni

RGB to ACI colour, can I automatically convert RGB objects to autocad colours?

Recommended Posts

GMaracchioni

Hello there,

 

 

I have a file (probably exported from rhino, not sure about that though) where all objects have rgb colour properties to them. White lines are RGB 255, 255, 255, which makes them look fine in model space, though they look white on white in paper space. I would like to convert those objects to WHITE, so that I can set a print profile that would make them print black if that makes sense? At the moment I can only select the objects one by one, which is nearly impossible as the drawing is quite big. I tried to use quickselct, which kind of worked, though it did not allow me to select objects belonging to blocks (of which there are plenty, unfortunately!).

 

 

Thanks a lot for any help!

 

 

G

Share this post


Link to post
Share on other sites
BIGAL

Ignoring the other part for the moment this is a possible way of getting at the colour values, you could do a selection and pick what you want as a using "X" could produce some odd results. As in the example you would need some form of list like 255,255,255 is color index now 7 White/black and Colormethod = 195

 

maybe this will work
; get the colour values
(setq obj (vlax-ename->vla-object (car (entsel)))) ; pick an object
(setq col (vla-get-TrueColor obj))
(vlax-Dump-Object col)

this is a RGB
IAcadAcCmColor: AutoCAD AcCmColor Interface
; Property values:
;   Blue (RO) = 38
;   BookName (RO) = ""
;   ColorIndex = 52
;   ColorMethod = 194
;   ColorName (RO) = ""
;   EntityColor = -1025917402
;   Green (RO) = 190
;   Red (RO) = 217

this is colour 152
; IAcadAcCmColor: AutoCAD AcCmColor Interface
; Property values:
;   Blue (RO) = 204
;   BookName (RO) = ""
;   ColorIndex = 152
;   ColorMethod = 195
;   ColorName (RO) = ""
;   EntityColor = -1023410024
;   Green (RO) = 102
;   Red (RO) = 0

(vla-put-ColorMethod col 195)
(vla-put-ColorIndex col x) ;x is 1-255

Share this post


Link to post
Share on other sites
GMaracchioni

Hello Bigal, thanks for your reply!

 

 

unfortunately I could not understand much of it! :-)

 

 

I might not be an advanced enough cad user (I have not used any code before). I did however try to paste the code you posted into the command line, but that led to no results. Sorry I think it's me making some mistake here!

 

 

Could you please be more precise as to how to use the code? Should I paste everything into the command line? should I omit some lines? Should I aste the code in different batches? etc...

 

 

Many thanks!

Share this post


Link to post
Share on other sites
BIGAL

I need to do some more homework as well.

Share this post


Link to post
Share on other sites
Cad64

Can't you just open your layer manager and change the layers that are 255,255,255 to white? Or is there a color override on the objects so that color is not set bylayer?

Share this post


Link to post
Share on other sites
GMaracchioni

Hi Cad64,

 

 

thank you for your comment!

 

 

and yes, unfortunately I cannot change objects colour through changing layers properties as objects are indeed individually overwritten. I could select them one by one but it would take ages (and I would also have to explode or enter all blocks!).

 

 

I have done more researching into the origin of the file, which I now know, was definitely made with rhino. There, all objects were just rgb white, regardless of their layer.

 

 

Any idea, now...?

Share this post


Link to post
Share on other sites
SLW210

QSelect by color should select all 255,255,255 objects, then change to white or ByLayer.

 

For blocks see if this thread for setting All Objects in Blocks to Layer 0 helps.

Share this post


Link to post
Share on other sites
GMaracchioni

Hi SLW210!

 

 

yeah qselect works, had successfully tried that. Unfortunately I could not work with the thread you recommended as I have never worked with codes and I do not seem to be able to make sense of that :-(

 

 

Sadly, I do not know what a lisp is.

 

 

If you could guide me through how to make us of that thread I will be grateful. Am I supposed to copy the des in the boxes in the command line at all? Should the all thing be pasted in there at once? I have tried that but autocad does not seem to respond by moving all objects in blocks to layer 0, which is what those commands are supposed to do, right?

 

 

thanks a lot!

Share this post


Link to post
Share on other sites
SLW210

How to use LISP.

 

If it is LISP in a Code Tags (like the ones on the link I posted), just copy all of the contents in the code box to Notepad and save as a .lsp , if you see a defun c:norm2 in the code, then the norm2 is the command to call the LISP.

Share this post


Link to post
Share on other sites
GMaracchioni

ok I will try that, thanks a lot.

 

 

just a quick question: the first code does not read defun c:norm2. Instead, it says: defun c:fixblocks

 

 

how do I call the LISP in this case?

 

 

many thanks

Share this post


Link to post
Share on other sites
Cad64

just a quick question: the first code does not read defun c:norm2. Instead, it says: defun c:fixblocks

 

 

how do I call the LISP in this case?

 

There are several lisp routines in that thread. The ones from chulse and fuccaro are the "fixblocks" routines, but if you scroll down further, there is one from kpblc which is the "norm" routine. And on page 3 there is the "norm2" routine. So it depends on which one you decide to use.

Share this post


Link to post
Share on other sites
GMaracchioni

and whichever I use is the same procedure, except I need to call them up by typing in the routine name in the command line? so norm2, or fixblocks, orn norm, etc in the command line? can I name the 'lsp file anything I want, and can I save it anywhere?

sorry for bombarding you guys with questions, and thanks for your help!smilie.png

Share this post


Link to post
Share on other sites
GMaracchioni

right...well thank you for your help anyway

Share this post


Link to post
Share on other sites
GMaracchioni

Hello there,

 

 

I have a file (probably exported from rhino, not sure about that though) where all objects have rgb colour properties to them. White lines are RGB 255, 255, 255, which makes them look fine in model space, though they look white on white in paper space. I would like to convert those objects to WHITE, so that I can set a print profile that would make them print black if that makes sense? At the moment I can only select the objects one by one, which is nearly impossible as the drawing is quite big. I tried to use quickselct, which kind of worked, though it did not allow me to select objects belonging to blocks (of which there are plenty, unfortunately!).

 

 

Thanks a lot for any help!

 

 

G

Share this post


Link to post
Share on other sites
SLW210

I combined your threads, sorry I totally missed you were using LT.

 

Unfortunately, using LT you are stuck with doing the blocks manually, or exploding the blocks.

 

You might try getting a forum member with full AutoCAD to fix the blocks.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×