Jump to content

Object colour of blocks


Dayananda

Recommended Posts

1 hour ago, Dayananda said:

I need a code to select the all objects which same colour but inside difference blocks. After change the colour at once.

 

What colour to what colour? Or did you mean all bylayer/byblock?

  • Like 1
Link to comment
Share on other sites

17 minutes ago, dlanorh said:

 

True colour 255,0,0 IS "RED" just using a index type

They are not the same.

 

If the object has truecolor and you're using a CTB file to plot, it will plot in color even if red ( 1 ) is set to another color. The object will also have DXF code 420 where as index color will only have code 62.

Link to comment
Share on other sites

3 hours ago, ronjonp said:

They are not the same.

 

If the object has truecolor and you're using a CTB file to plot, it will plot in color even if red ( 1 ) is set to another color. The object will also have DXF code 420 where as index color will only have code 62.

 

I stand by my original statement. :P

 

As colours they equate to the same RGB. If you pass ACI 1, ACI 10 or acRed into LeeMac's ACI->RGB converter function (below) the same RGB is returned, or is this function wrong?

 

(defun LM:ACI->RGB ( c / o r )
    (if (setq o (vla-getinterfaceobject (LM:acapp) (strcat "autocad.accmcolor." (substr (getvar 'acadver) 1 2))))
        (progn
            (setq r
                (vl-catch-all-apply
                   '(lambda ( )
                        (vla-put-colorindex o c)
                        (list (vla-get-red o) (vla-get-green o) (vla-get-blue o))
                    )
                )
            )
            (vlax-release-object o)
            (if (vl-catch-all-error-p r)
                (prompt (strcat "\nError: " (vl-catch-all-error-message r)))
                r
            )
        )
    )
)

;; Application Object  -  Lee Mac
;; Returns the VLA Application Object

(defun LM:acapp nil
    (eval (list 'defun 'LM:acapp 'nil (vlax-get-acad-object)))
    (LM:acapp)
)

 

See also Here.

 

The fact that certain AutoCAD commands handle the "TrueColor" property differently from the "Color" property and AutoCAD stores it with a different DXF code value doesn't detract from the fact that they equate to the same RGB colour.

 

 

Link to comment
Share on other sites

10 hours ago, ronjonp said:

f the object has truecolor and you're using a CTB file to plot, it will plot in color even if red ( 1 ) is set to another color. The object will also have DXF code 420 where as index color will only have code 62.

That is why we need to change the color of the objects to red. True color printing in color and when change to red it can print in black.

Link to comment
Share on other sites

18 hours ago, dlanorh said:

I stand by my original statement. :P

That's fine, but the OP's response validates that there is a difference even if the numbers are the same .. try it when plotting. 😋

Link to comment
Share on other sites

13 hours ago, Dayananda said:

That is why we need to change the color of the objects to red. True color printing in color and when change to red it can print in black.

Give this a try:

(defun c:foo (/ a d tc)
  (vl-load-com)
  (vlax-for l (vla-get-layers (setq d (vla-get-activedocument (vlax-get-acad-object))))
    (cond ((= -1 (vlax-get l 'lock)) (vlax-put l 'lock 0) (setq a (cons l a))))
  )
  (vlax-for b (vla-get-blocks d)
    (vlax-for o	b
      (and (setq tc (vla-get-truecolor o))
	   (equal '(255 0 0) (mapcar '(lambda (x) (vlax-get tc x)) '(red green blue)))
	   (progn (vla-put-colorindex tc 1) (vl-catch-all-apply 'vla-put-truecolor (list o tc)))
      )
    )
  )
  (foreach l a (vlax-put l 'lock -1))
  (princ)
)

 

Edited by ronjonp
  • Like 1
Link to comment
Share on other sites

1 hour ago, ronjonp said:

That's fine, but the OP's response validates that there is a difference even if the numbers are the same .. try it when plotting. 😋

 

I  appreciate that, I was coming at it from a colour perspective, printing/plotting wasn't mentioned in the initial post.

Link to comment
Share on other sites

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