Author Topic: What color of entity name  (Read 4626 times)

0 Members and 1 Guest are viewing this topic.

Adesu

  • Guest
What color of entity name
« on: July 30, 2007, 11:30:20 PM »
Hi Alls,
To check my entity name, I use with vlax function, but I still confused how to translate the color of that object, I got the entity name is "blue" color but in attach file it look like "EntityColor = -1073741824".
Any one would you guide to me to know equivalent that number to color number.
Code: [Select]
; IAcadAcCmColor: AutoCAD AcCmColor Interface
; Property values:
;   Blue (RO) = 0
;   BookName (RO) = ""
;   ColorIndex = 256
;   ColorMethod = 192
;   ColorName (RO) = ""
;   EntityColor = -1073741824
;   Green (RO) = 0
;   Red (RO) = 0

T
_$

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: What color of entity name
« Reply #1 on: July 31, 2007, 12:50:29 AM »
;   ColorMethod = 192
Is means Color By Layer

as does
;   ColorIndex = 256
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Adesu

  • Guest
Re: What color of entity name
« Reply #2 on: July 31, 2007, 01:20:58 AM »
I mean and how to know if that object is red color, what data at "EntityColor".
blue same as EntityColor = -1073741824
red same as  EntityColor = bla..bla..bla
2 same as  EntityColor = bla..bla..bla
3 same as  EntityColor = bla..bla..bla
etc same as  EntityColor = bla..bla..bla




It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8580
  • AKA Daniel
Re: What color of entity name
« Reply #3 on: July 31, 2007, 01:33:50 AM »
how about

Code: [Select]
(vla-get-color (vlax-ename->vla-object (car (entsel))))

Adesu

  • Guest
Re: What color of entity name
« Reply #4 on: July 31, 2007, 01:51:07 AM »
if that drawing set to bylayer, it would display as 256.

how about

Code: [Select]
(vla-get-color (vlax-ename->vla-object (car (entsel))))

VVA

  • Newt
  • Posts: 166
Re: What color of entity name
« Reply #5 on: July 31, 2007, 01:52:40 AM »
ACI or RGB
Code: [Select]
(and
  (or (vl-load-com) t)
  (setq en (car(entsel "\nSelect entity:")))
  (setq en (vlax-ename->vla-object en))
  (if (= (vla-get-ColorMethod(setq TrueColor(vla-get-TrueColor en))) acColorMethodByRGB)
    (setq col (list  "Red" (vla-get-red TrueColor) "Green" (vla-get-Green TrueColor) "Blue" (vla-get-Blue TrueColor)))
    (setq col (list "ACI" (vla-get-color en)))
    )
  (princ "\nEntity color=")(princ col)
  )

Adesu

  • Guest
Re: What color of entity name
« Reply #6 on: July 31, 2007, 01:58:21 AM »
Hi VVA,
Yes, it's as I looking for, thanks for your help.


ACI or RGB
Code: [Select]
(and
  (or (vl-load-com) t)
  (setq en (car(entsel "\nSelect entity:")))
  (setq en (vlax-ename->vla-object en))
  (if (= (vla-get-ColorMethod(setq TrueColor(vla-get-TrueColor en))) acColorMethodByRGB)
    (setq col (list  "Red" (vla-get-red TrueColor) "Green" (vla-get-Green TrueColor) "Blue" (vla-get-Blue TrueColor)))
    (setq col (list "ACI" (vla-get-color en)))
    )
  (princ "\nEntity color=")(princ col)
  )

VVA

  • Newt
  • Posts: 166
Re: What color of entity name
« Reply #7 on: July 31, 2007, 02:00:07 AM »
Code: [Select]
(and
  (or (vl-load-com) t)
  (setq en (car(entsel "\nSelect entity:")))
  (setq en (vlax-ename->vla-object en))
  (setq ColorMethod (vla-get-ColorMethod(setq TrueColor(vla-get-TrueColor en))))
  (cond
    ((= ColorMethod acColorMethodByRGB)
     (alert (strcat "Method RGB\n"
                    "Red=" (itoa(vla-get-red TrueColor))
                    " Green=" (itoa(vla-get-Green TrueColor))
                    " Blue=" (itoa(vla-get-Blue TrueColor))))
     )
    ((= ColorMethod acColorMethodByACI)
     (alert (strcat "Method ACI Color=" (itoa(vla-get-color en))))
     )
    ((= ColorMethod acColorMethodByLayer)
     (alert (strcat "Method ACI Color=byLayer(" (itoa(vla-get-color en)) ")"))
     )
    ((= ColorMethod acColorMethodByBlock )
     (alert (strcat "Method ACI Color=byBlock(" (itoa(vla-get-color en)) ")"))
     )
    (t (alert  "Method acColorMethodForeground"))
    )
  )

Adesu

  • Guest
Re: What color of entity name
« Reply #8 on: July 31, 2007, 02:34:45 AM »
it's great too.
and I still confuse why in data "(vlax-dump-object vevo)" there is not "color", but it can find by "(setq col (vla-get-color vevo))"
(if
    (setq ss (car (entsel "\nSelect entity:")))
    (progn
      (setq vevo (vlax-ename->vla-object ss))
      (vlax-dump-object vevo)
      (setq col (vla-get-color vevo))
Code: [Select]
#<VLA-OBJECT IAcadCircle 064b32c4>
; IAcadCircle: AutoCAD Circle Interface
; Property values:
;   Application (RO) = #<VLA-OBJECT IAcadApplication 00b9b5e4>
;   Area = 22.7413
;   Center = (10.4022 14.6984 0.0)
;   Circumference = 16.9049
;   Diameter = 5.381
;   Document (RO) = #<VLA-OBJECT IAcadDocument 010f1bb0>
;   Handle (RO) = "95"
;   HasExtensionDictionary (RO) = 0
;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 064b5614>
;   Layer = "0"
;   Linetype = "ByLayer"
;   LinetypeScale = 1.0
;   Lineweight = -1
;   Normal = (0.0 0.0 1.0)
;   ObjectID (RO) = 2130054888
;   ObjectName (RO) = "AcDbCircle"
;   OwnerID (RO) = 2130054392
;   PlotStyleName = "Color_3"
;   Radius = 2.6905
;   Thickness = 0.0
;   TrueColor = #<VLA-OBJECT IAcadAcCmColor 064b6010>
;   Visible = -1

T
_$

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: What color of entity name
« Reply #9 on: July 31, 2007, 05:09:17 AM »
Have a look at the Color Property in the Developer Documentation ..

ie select vla-get-color in the VLIDE and then  Ctrl-F1
at the bottom ...
Quote
Remarks

This property is obsolete and will be removed in a future version. When using this property, colors can be set and read as numeric index values ranging from 0 to 256. Constants are provided for the standard seven colors, as well as for the BYBLOCK and BYLAYER designations.

If you use acByBlock, AutoCAD draws new objects in the default color (white or black, depending on your configuration) until they are grouped into the block. When the block is inserted in the drawing, the objects in the block inherit the current setting of the color property.

If you use acByLayer, new objects assume the color of the layer upon which they are drawn. The value acByLayer is not valid for a Layer object.

 
Have a look at vla-get-TrueColor instead ..

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8580
  • AKA Daniel
Re: What color of entity name
« Reply #10 on: July 31, 2007, 05:24:43 AM »

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: What color of entity name
« Reply #11 on: July 31, 2007, 06:21:29 AM »
From Memory ...

There was a reasonable example in the Sample Folder in ACAD.
Jurg Menzi probably has an example on his web Page. (see his Member record)
This place has heaps of samples ..

but it's an old memory, so ... :D
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.