how can i gain TDF_Label by TDataStd_Name of it's Attribute?

if i know a object TDF_Label,i can gain it's TDataStd_Name. But,now ,I know a object TDataStd_Name,how can gain it's TDF_Label ?

Thank you very much!

sunny

Jérome Dufaure's picture

You can use the method Label() from TDF_Attribute to retrieve the TDF_Label corresponding to the TDataStd_Name attribute.
I hope This will help you.

Jerome

SOS:How can I retrieve the TDF_Label's picture

Thank you very much!

I make a box by these codes as follows:

TDF_Label TOcaf_Commands::CreateBox(Standard_Real x, Standard_Real y, Standard_Real z, Standard_Real w, Standard_Real l, Standard_Real h, const TCollection_ExtendedString& Name)
{
TDF_Label L = TDF_TagSource::NewChild(MainLab);
TDataStd_Real::Set(L.FindChild(1), w);
TDataStd_Real::Set(L.FindChild(2), l);
TDataStd_Real::Set(L.FindChild(3), h);
TDataStd_Real::Set(L.FindChild(4), x);
TDataStd_Real::Set(L.FindChild(5), y);
TDataStd_Real::Set(L.FindChild(6), z);
TDataStd_Name::Set(L, Name);
Handle(TFunction_Function) myFunction = TFunction_Function::Set(L, TOcafFunction_BoxDriver::GetID());
TFunction_Logbook log;
Handle(TOcafFunction_BoxDriver) myBoxDriver;
if(!TFunction_DriverTable::Get()->FindDriver(TOcafFunction_BoxDriver::GetID(), myBoxDriver)) return L;

myBoxDriver->Init(L);

if (myBoxDriver->Execute(log)) MessageBox(0,"DFunction_Execute : failed","Box",MB_ICONERROR);
return L;
}

now,I know the box's Name,How can I retrieve the TDF_Label L?

Can you tell me the C++ code?

Thanks you again!

yours,
Sunny5688
05.8.31

SOS:How can I retrieve the TDF_Label's picture

Thank you very much!

I make a box by these codes as follows:

TDF_Label TOcaf_Commands::CreateBox(Standard_Real x, Standard_Real y, Standard_Real z, Standard_Real w, Standard_Real l, Standard_Real h, const TCollection_ExtendedString& Name)
{
TDF_Label L = TDF_TagSource::NewChild(MainLab);
TDataStd_Real::Set(L.FindChild(1), w);
TDataStd_Real::Set(L.FindChild(2), l);
TDataStd_Real::Set(L.FindChild(3), h);
TDataStd_Real::Set(L.FindChild(4), x);
TDataStd_Real::Set(L.FindChild(5), y);
TDataStd_Real::Set(L.FindChild(6), z);
TDataStd_Name::Set(L, Name);
Handle(TFunction_Function) myFunction = TFunction_Function::Set(L, TOcafFunction_BoxDriver::GetID());
TFunction_Logbook log;
Handle(TOcafFunction_BoxDriver) myBoxDriver;
if(!TFunction_DriverTable::Get()->FindDriver(TOcafFunction_BoxDriver::GetID(), myBoxDriver)) return L;

myBoxDriver->Init(L);

if (myBoxDriver->Execute(log)) MessageBox(0,"DFunction_Execute : failed","Box",MB_ICONERROR);
return L;
}

now,I know the box's Name,How can I retrieve the TDF_Label L?

Can you tell me the C++ code?

Thanks you again!

yours,
Sunny5688
05.8.31