Add useful helper function for getting label name

This commit is contained in:
Marek Roszko 2021-10-10 20:07:44 -04:00
parent 7a71ebf9ac
commit e77cdad6fa
1 changed files with 19 additions and 0 deletions

View File

@ -74,6 +74,7 @@
#include <TDF_LabelSequence.hxx>
#include <TDF_ChildIterator.hxx>
#include <TDataStd_Name.hxx>
#include "plugins/3dapi/ifsg_all.h"
@ -308,6 +309,24 @@ FormatType fileType( const char* aFileName )
}
static wxString getLabelName( const TDF_Label& label )
{
wxString txt;
Handle( TDataStd_Name ) name;
if( !label.IsNull() && label.FindAttribute( TDataStd_Name::GetID(), name ) )
{
TCollection_ExtendedString extstr = name->Get();
char* str = new char[extstr.LengthOfCString() + 1];
extstr.ToUTF8CString( str );
txt = wxString::FromUTF8( str );
delete[] str;
txt = txt.Trim();
}
return txt;
}
void getTag( TDF_Label& label, std::string& aTag )
{
if( label.IsNull() )