Colors in ODA Facet Modeler

Taras Khalimanenko

November 21, 2019

ODA Facet Modeler can store various object properties such as: visibility, orientation, color, and a pointer to additional data. This article focusses on colors.

A color does not play any role and does not affect the topology of the result of Boolean operations inside Facet Modeler. The color is stored as a 32-bit variable, and it is assumed that the color value is stored in RGB format (8 bits per channel), but developers can interpret it as needed.

The color property has the classes Face and Edge. To access the color, these classes have methods:

OdUInt32 color() const;
void setColor(const OdUInt32 color);

And there is a method of the Body class that sets the color of all faces and edges of an object:

void setColor(OdUInt32 iColor);

During a Boolean operation, the colors of objects are defined by the following rules:

  • The faces and edges that do not take part in the operation keep their original color.
  • The faces and edges that are cut off keep their original color.
  • New edges that are a product of a Boolean operation use the default color.
  • When combining faces lying in the same plane, the complexion from the first body is used.

The next illustration shows examples of the first three rules above:

  • Red — New edge color.
  • Green — First body color.
  • Cyan — Second body color.

 

ODA Facet Modeler example

 

You can see an example of the result of a UNION operation in the next illustration.

  • On the left side — Result when the first body has a blue color.
  • On the right side — Result when the first body has a green color.
  • In the center — Shows the colors of edges that do not change depending on the operand order.

 

ODA Facet Modeler Union operation