Teigha PRC: Using OdPrcMarkupLinkedItem

Alex Rumjantsev
January 11, 2018

Tags: prc Example getting started

What is OdPrcMarkupLinkedItem used for?

OdPrcMarkupLinkedItem is similar to OdPrcReference. As an OdPrcReference, it can be used to override an entity’s location, appearance and linestyle. But unlike OdPrcReference, OdPrcMarkupLinkedItem applies those changes only upon switching views. So every OdPrcView has its own set of OdPrcMarkupLinkedItem items that can change the rendering of entities in the current view.

Structure of OdPrcMarkupLinkedItem

OdPrcMarkupLinkedItem is stored in OdPrcProductOcurrence:

OdPrcMarkups & OdPrcProductOccurrence::markups();
const OdPrcMarkups & OdPrcProductOccurrence::markups() const;
OdPrcObjectIdArray & OdPrcMarkups::linkedItem();
const OdPrcObjectIdArray & OdPrcMarkups::linkedItem() const;

OdPrcView stores links to those OdPrcMarkupLinkedItems:

OdPrcObjectIdArray & OdPrcView::linkedItems();
const OdPrcObjectIdArray & OdPrcView::linkedItems() const;

OdPrcMarkupLinkedItem has two links.

The first link is to the entity for which graphic parameters are overridden:

OdPrcReferenceData & OdPrcMarkupLinkedItem::referenceData();
const OdPrcReferenceData & OdPrcMarkupLinkedItem::referenceData() const;

The second link is to the tree subpart that contains this entity: (*)<>/p

OdPrcReferenceData & OdPrcMarkupLinkedItem::referencedProductOccurrence();
const OdPrcReferenceData & OdPrcMarkupLinkedItem::referencedProductOccurrence() const;

A new coordinate system for an entity is taken from:

OdPrcObjectId & OdPrcMarkupLinkedItem::localCoordinateSystem();
const OdPrcObjectId & OdPrcMarkupLinkedItem::localCoordinateSystem() const;

New graphics parameters for an entity are taken from: (**)

OdPrcGraphics & OdPrcMarkupLinkedItem::graphics();
const OdPrcGraphics & OdPrcMarkupLinkedItem::graphics() const;

(*) Currently the second link does not influence entity rendering; the implementation is more similar to Tech Soft 3D HOOPS® than Adobe®.

(**) For OdPrcMarkupLinkedItem, Adobe ignores all behavior bits of OdPrcGraphics except PRC_GRAPHICS_Show, so it doesn’t take into account Son/Father inheritance or PRC_GRAPHICS_Removed. This is why we implemented it similar to HOOPS: OdPrcMarkupLinkedItem works similar to OdPrcGraphics.

Example of OdPrcMarkupLinkedItem influence

This is the default view of a file:

image1

The next picture shows the structure of the OdPrcView to which we are switching. You can see a list of OdPrcMakrupLinkedItem items in OdPrcView (283). Also you can see OdPrcMakrupLinkedItem (24A) which overrides entity OdPrcProductOccurrence (50), so for this view entity we will have:

  • OdPrcCategory1LineStyle (298) as its linestyle.
  • OdPrcCoordinateSystem (24B) as its location.
  • (11 == PRC_GRAPHICS_Show | PRC_GRAPHICS_SonHeritShow | PRC_GRAPHICS_SonHeritColor) as its behavior_bit_fields.
image2

This is the same file but switched to another view:

image3

 

All posts