How to get the Referenced attribute Tag value

Can anyone say how to get the Reference value's tag.
In ocaf in the document viewer it is showing

TDF_Reference = 1:1:0 how to get the 1:1:0 by the code.

i have tried like this,

for (TDF_ChildIterator it1(L,Standard_False); it1.More(); it1.Next())
TDF_Label L1 = it1.Value();
//What code i have write here to get that 1:1:0

Thanks in Advance,


Svetlozar Kostadinov's picture

1.Do you mean referenced label instead of "referenced attribute"? TDF_Reference can refers to a TDF_Label only.
2.You don't need to iterate if you want to find a label's tag. Just call TDF_Label::Tag().
3.The entry "1:1:0" is not valid. All entries begin with "0:".
4.I think TDF_Tool class will solve your problems.


Vidhyan's picture

I am having a box and cylinder in ocaf and i have fused box with cylinder.

0.1.1 is cylinder and 0.1.2 is box
so 0.1.3 will be cylider with the referenced label stating contains TDF_Reference = 0.1.1 and contains TDF_Reference = 0.1.2

Now how to get that 0.1.1 as a value that present in the TDF_Reference


Dirk B's picture

Hello Vidhyan!
Try using TDF_Tool::Label. Here is an example, where entry is the string 1:1:0 and _Doc->Main().Data() is the root of your document:
TDF_Label GetLabelFromEntry(std::string entry){
TCollection_AsciiString anEntry = entry.c_str();
TDF_Label aLabel;
TDF_Tool::Label(_Doc->Main().Data(), anEntry, aLabel, Standard_False);
return aLabel;