Close

Relief for ODA Team in Ukraine

Learn more
ODA PRC SDK
Management of Graphical Entity Behavior

Graphical Entity Behavior Concepts

A set of ODA PRC SDK entities with graphical content are derived from the OdPrcBaseWithGraphics class. This class encapsulates an instance of the OdPrcGraphics class to enhance the OdPrcReferencedBase class.

The OdPrcGraphics class has a set of bits that controls visibility, color, material and some other aspects of graphical entity behavior. This bit field contains 16 bits, therefore it can be represented with an OdUInt16 value. To operate on the current state of behavior bit field, OdPrcGraphics class provides two methods:

  • behaviourBitField() — Retrieves the current value of the behavior bit field (as an OdUInt16).
  • setBehaviourBitField() — Sets a new behavior bit field value. It accepts an OdUInt16 value as an input parameter.

Behavior parameter values are represented in the following table. Definitions of appropriate constants can be found in the /Prc/Include/PrcDefines.h file.

Flag Type Identifier Value Description
Entity Show Flag PRC_GRAPHICS_Show 0x0001 Determines whether the entity is shown.
PRC_GRAPHICS_SonHeritShow 0x0002 Son inheritance flag.
PRC_GRAPHICS_FatherHeritShow 0x0004 Parent inheritance flag.
Color/material Flag PRC_GRAPHICS_SonHeritColor 0x0008 Determines son inheritance for color or material.
PRC_GRAPHICS_FatherHeritColor 0x0010 Determines parent inheritance for color or material.
Layer Flag PRC_GRAPHICS_SonHeritLayer 0x0020 Determines son inheritance for layers.
PRC_GRAPHICS_FatherHeritLayer 0x0040 Determines parent inheritance for layers.
Transparency Flag PRC_GRAPHICS_SonHeritTransparency 0x0080 Determines son inheritance for transparency.
PRC_GRAPHICS_FatherHeritTransparency 0x0100 Determines parent inheritance for transparency.
Line Pattern Flag PRC_GRAPHICS_SonHeritLinePattern 0x0200 Determines son inheritance for line patterns.
PRC_GRAPHICS_FatherHeritLinePattern 0x0400 Determines parent inheritance for line patterns.
Line Width Flag PRC_GRAPHICS_SonHeritLineWidth 0x0800 Determines son inheritance for line width.
PRC_GRAPHICS_FatherHeritLineWidth 0x1000 Determines parent inheritance for line width.
Is Entity Removed Flag PRC_GRAPHICS_Removed 0x2000 Determines whether the entity has been removed and does not appear in the tree.

Common Behavior Algorithm

All graphical entity behaviors are managed using a common algorithm. Any entity can accept its own behavior setting value or inherit it from a parent entity in the occurrence tree.

Assume that in the first case the entity behavior type is named kUseSon, and in the second case is named kUseParent. The third variant is kUseCurrent, which is the same as kUseParent.

Behavior settings are represented as a set of bits either for the entity (sonBits) or for its parent (fatherBits), therefore in general the algorithm of determining an entity behavior type consists of the following steps:

  • If sonInheritBit is switched ON in sonBits
    • kUseSon type is applied.
  • Else
    • If sonInheritBit is switched ON in fatherBits
      • kUseParent is applied.
    • Else
      • If fatherInheritBit is switched OFF in fatherBits
        • kUseSon is applied.
      • Else
        • kUseCurrent is applied.

Examples of Handling Graphical Entity Visibility

Suppose that there is a .prc entity tree:
  • Product Occurrence
    • Part Definition
      • PolyBrepModel_1
      • PolyBrepModel_2
      • PolyBrepModel_3

The first three bits of the behavior bit field are responsible for resolving the visibility of each entity. Examples below show how visibility of each entity is resolved when these bits have different values.

Example 1

Entity Parent Inherit Son Inherit Show Bit Value Show Flags Is Entity Shown
Product Occurrence 0 0 1 0x01
Part Definition 0 0 1 0x01
PolyBrepModel_1 0 0 1 0x01 Yes
PolyBrepModel_2 0 0 1 0x01 Yes
PolyBrepModel_3 0 0 1 0x01 Yes

All entities have the PRC_GRAPHICS_Show bit set, therefore they all will be shown.

Example 2

Entity Parent Inherit Son Inherit Show Bit Value Show Flags Is Entity Shown
Product Occurrence 0 0 1 0x01
Part Definition 0 0 0 0x00 Yes
PolyBrepModel_1 0 0 1 0x01 Yes
PolyBrepModel_2 0 0 0 0x00 No
PolyBrepModel_3 0 0 1 0x01 Yes

All entities are shown, except PolyBrepModel_2. Notice that despite PRC_GRAPHICS_Show not being set for Part Definition, child entities are shown anyway.

Example 3

Entity Parent Inherit Son Inherit Show Bit Value Show Flags Is Entity Shown
Product Occurrence 0 or 1 1 or 0 0 0x02 (or 0x04)
Part Definition 0 0 0 0x00
PolyBrepModel_1 0 0 1 0x01 No
PolyBrepModel_2 0 0 0 0x00 No
PolyBrepModel_3 0 0 1 0x01 No

No entity is visible. Product Occurrence has the PRC_GRAPHICS_Show bit not set, and this value is inherited by other child entities.

Example 4

Entity Parent Inherit Son Inherit Show Bit Value Show Flags Is Entity Shown
Product Occurrence 0 or 1 1 or 0 1 0x03 (or 0x05)
Part Definition 0 0 0 0x00
PolyBrepModel_1 0 0 1 0x01 Yes
PolyBrepModel_2 0 0 0 0x00 No for Adobe 9.1, Yes for Adobe 11
PolyBrepModel_3 0 0 1 0x01 Yes

All entities will be shown, except PolyBrepModel_2. The PRC_GRAPHICS_Show bit value is inherited by all child entities, but the local show bit value also will be applied by the && operation.

Example 5

Entity Parent Inherit Son Inherit Show Bit Value Show Flags Is Entity Shown
Product Occurrence 0 or 1 1 or 0 1 0x03 (or 0x05)
Part Definition 1 0 0 0x04
PolyBrepModel_1 0 0 1 0x01 Yes
PolyBrepModel_2 0 0 0 0x00 No for Adobe 9.1, Yes for Adobe 11
PolyBrepModel_3 0 0 1 0x01 Yes

All entities are shown, except PolyBrepModel_2. PRC_GRAPHICS_FatherHeritShow can not override anything, even itself.

Example 6

Entity Parent Inherit Son Inherit Show Bit Value Show Flags Is Entity Shown
Product Occurrence 0 or 1 1 or 0 1 0x03 (or 0x05)
Part Definition 0 1 0 0x02
PolyBrepModel_1 0 0 1 0x01 No
PolyBrepModel_2 0 0 0 0x00 No
PolyBrepModel_3 0 0 1 0x01 No

No entity is visible because PRC_GRAPHICS_SonHeritShow overrides other settings.

Example 7

If a parent entity has the removed flag set (PRC_GRAPHICS_Removed bit is equal to 1), then no child entity is shown.

Example 8: Using OdPrcReference

If one of the child entities is linked by an OdPrcReference object somewhere higher in the hierarchy (for example in ProductOccurrence entity), the linked entity's bit will be replaced with OdPrcReference object bits.

For example, if an OdPrcReference object points to a PolyBrepModel_3 entity and has (PRC_GRAPHICS_SonHeritShow | PRC_GRAPHICS_Show == 3) bits, then PolyBrepModel_3 is shown:

Entity Parent Inherit Son Inherit Show Bit Value Show Flags Is Entity Shown
Product Occurrence 0 or 1 1 or 0 1 0x03 (or 0x05)
Part Definition 0 1 0 0x02
PolyBrepModel_1 0 0 1 0x01 No
PolyBrepModel_2 0 0 0 0x00 No
PolyBrepModel_3 Any Any Any Any value Yes

Handling of OdPrcTessFace Entity Behavior

An OdPrc3dTess entity contains an array of OdPrcTessFace objects. Each OdPrcTessFace object has its own behavior field. This behavior field denotes graphics behavior for the entity in the tree that owns the face tessellation, except the situation when the face tessellation has no graphic attributes (method lineAttributes() returns an empty array).

For example, if OdPrcTessFace::behavior is set to PRC_GRAPHICS_SonHeritColor for all OdPrcTessFace objects in a file, all entities will be drawn in the color that OdPrcTessFace line attributes contain. But if OdPrcTessFace::behavior is set to the PRC_GRAPHICS_SonHeritShow bit without the PRC_GRAPHICS_Show bit, it does not disable entity visibility because the Show property bit is not filtered on this level.

See Also

Work with Markup Entities
Work with PRC Entities
Copyright © 2002 – 2022. Open Design Alliance. All rights reserved.