Read names from iges file by OCAF

Hi All,

I have an iges file exported from CATIA. It contains only four curves. In CATIA, they are named as "DB_71", "DB_72", "DB_73" and "DB_74". When I read this file using OCAF, I get four names as "DB_71 (0)", "DB_72 (0)", "DB_73 (0)", "DB_74 (0)", I just want to know what's the "(0)" meaning, can we omit this sub string?
PS: In fact, I also find some names such as "0(0)" from my testing iges files. These names are meaningless.
My name reading code lists as follows:
TCollection_AsciiString entry;
TDF_Tool::Entry( label, entry );
Handle_TDataStd_Name N;
if ( label.FindAttribute( TDataStd_Name::GetID(), N ) )
{
char* name;
name = new char[N->Get().LengthOfCString()+1];
N->Get().ToUTF8CString( name );
.......
}

Any suggestion is welcome. Thanks in advance.

Ding

Attachments: 
sergey zaritchny's picture

Hi,
OCAF itself can't add any additional symbols to names keeping in Data Framework.
Probably you use IGESCAFControl_Reader (DE component) to read Iges file and put content in OCAF document.
But reader also adds nothing to read names.
So, you may check (debug) intermediate level before keeping name in the document. For example, you may start from check of entity names kept in your model (Interface_InterfaceModel) after translation.

sergey

Cauchy Ding's picture

Hi sergey,

Thanks for your reply. Yes, I use the IGESCAFControl_Reader to read iges file.
I also attached the raw iges file. Please kindly help me to check this problem. Thanks in advance.

Ding

Roman Lygin's picture

Hi Ding,
Could you also attach the IGES file that causes this behavior ?
Thanks,
Roman
---
opencascade.blogspot.com - the Open CASCADE blog
www.cadexchanger.com - CAD Exchanger, your 3D data translator

Cauchy Ding's picture

Hi Romain,

The iges file is attached. Thanks in advance.

Ding

Attachments: 
Roman Lygin's picture

Hi Ding,

This combination (DB_71(0)) is returned by IGESData_IGESEntity::NameValue().

Handle(TCollection_HAsciiString) IGESData_IGESEntity::NameValue () const
{
Handle(TCollection_HAsciiString) nom; // au depart vide
// Question : concatene-t-on le SubScript ? Oui, forme label(subscript)
Standard_Integer nbname = NbTypedProperties(STANDARD_TYPE(IGESData_NameEntity));
if (nbname == 0) {
if (!HasShortLabel()) return nom;
if (theSubScriptN < 0) return theShortLabel;
char lenom[50];
sprintf (lenom,"%s(%d)",theShortLabel->ToCString(),theSubScriptN);
nom = new TCollection_HAsciiString (lenom);
}
else if (nbname > 0) {
DeclareAndCast(IGESData_NameEntity,name,
TypedProperty(STANDARD_TYPE(IGESData_NameEntity), 1));
nom = name->Value();
}

return nom;
}

And it looks like an appropriate way. Here is what the IGES standard says:

2.2.4.4.18 Entity Label. This is the application-specified alphanumeric identifier or name for this entity. It is used in conjunction with the entity subscript number (Field 19) to provide the application-specified alphanumeric identifier for the entity. The entity label is right-justified within the field with leading space fill.

Up to eight alphanumeric characters (right justified), or NULL (default).

2.2.4.4.19 Entity Subscript Number. This is a numeric qualifier for the entity label (Field 18).
1 to 8 digit unsigned number associated with the entity label.

So it looks like IGES does not assume usage of the label without a subscript number. To achieve that however there is the Name entity which is used if it’s present. However, as Catia stores names using entity labels, OCC reads them in concatenating with subscript number.

Hope this helps.
Roman
---
opencascade.blogspot.com - the Open CASCADE blog
www.cadexchanger.com - CAD Exchanger, your 3D data translator

Cauchy Ding's picture

Hi Roman,

Thank you so much for your so detailed explanation. It really helps me. Thank you.

Ding