Jump to content

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


Recommended Posts

Posted

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

Posted

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

Posted

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!

Posted

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?

Posted

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...?

Posted

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!

Posted

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.

Posted

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

Posted

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.

Posted

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

Posted

right...well thank you for your help anyway

Posted

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

Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...