DATAKIT has introduced the Dtk_NodeConnector, a new way to connect entities in the MainDoc context.
Dtk_NodeConnector can be retrieved by the Dtk_Node::GetAssociatedEntities method.
The Dtk_NodeConnector aims to link a Dtk_Node to a Dtk_Node or a Dtk_Component and even some subentities into Nodes.
For that, the Dtk_NodeConnector provides this information - ordered by granularity-:
Here are some Dtk_NodeConnector sample values and the corresponding link nature:
Component PathID | NodeID | SubEntity array - ID/type form - | Corresponding Link |
---|---|---|---|
- | - | - | The whole Local Component |
- | 3 | - | In the Local Component, points to the whole Node 3 |
- | 3 | 50/DTK_TYPE_LINE | In the Local Component, points to SubEntity 50 - of type DTK_TYPE_LINE - in the Node 3 |
1 - 4 - 3 - 10 - 9 | - | - | The whole Instance 10 ( with the Prototype 9 ) from the path 1 - 4 - 3 ( where 1 is the root ) |
8 | 10 | 99/DTK_TYPE_BODY | In the Prototype 8, points to the SubEntity 99 - of type DTK_TYPE_BODY - in the Node 10 |
The component PathID points to the corresponding Dtk_Component context.
For this, the path starts from Owning Component and goes through each component to the according context. It's a relative Component Path ID.
In some cases, it can start from the root Component - usually 1 -. The path ID is then an absolute Component path ID.
When you have an Instance ComponentID, it will be followed by the corresponding Prototype ComponentID.
To retrieve the Component Path ID, please use the Dtk_NodeConnector::GetAssociatedPathComponentID (Dtk_tab< Dtk_ID > &outAssociatedPathComponentID) const method.
You will obtain different results depending on the link nature:
The NodeId points to an entity in a given Component context.
To retrieve the NodeId value, please call the Dtk_NodeConnector::GetNodeId() method.
All Nodes can be pointed.
The NodeID can be zero-valued if the connector points to the whole component.
If it's zero-valued, the Dtk_NodeConnector::GetSubEntitiesNb() method should return zero also because we can't provide SubEntities without a containing Dtk_Node .
When a Dtk_NodeConnector points to a piece of Dtk_Node - typically a face in a Dtk_Body -, the SubEntity array is filled.
To retrieve the SubEntity array please use the Dtk_NodeConnector::GetSubEntities(Dtk_tab< SubEntity > &outSubEntities) const or
Dtk_NodeConnector::GetSubEntities(Dtk_tab< Dtk_ID > &outEntitiesIDs, Dtk_tab< type_detk > &outEntitiesTypes) methods.
Each SubEntity provides an ID and a type corresponding to the pointed entity ID/Type. The SubEntity array can exist only if a NodeID is provided - no zero-valued -.
You are now able to handle the Dtk_NodeConnector concept.
Go now to the page How to access to Entity from a NodeConnector to see a use case.