Hi all,
I have some troubles to get started. I would like to write an opengl viewer for cad data and hope that step is a good bet.
When parsing a stp file as described in the getting started example, I can not get the values from the attributes.
I tried the following:
...
cout << "\nParse STEP File";
int N = instance_list.InstanceCount();
string* value = new string();
for( int i = 0; i < N; i++ ) {
SDAI_Application_instance* inst = instance_list.GetSTEPentity(i);
string name = inst->EntityName();
cout << "\n" << i << ": " << name << flush;
for (int j=0; j<inst->AttributeCount(); j++) {
STEPattribute attr = inst->attributes[j];
attr.asStr(*value);
cout << "\n ATT: " << attr.Name() << " " << *value << flush;
}
}
...
value results in a segfault or rubbish.
When parsing the file I use a schema named 'AUTOMOTIVE_DESIGN'
The schema name of the file is AUTOMOTIVE_DESIGN_CC2 { 1 2 10303 214 -1 1 5 4 } (a cube exported from FreeCAD).
The parser says:
HEADER read:
ERROR: instance #8 'MECHANICAL_CONTEXT': Unknown ENTITY type.
Data lost: ('',#2,'mechanical')
ERROR: instance #350 'PRODUCT_TYPE': Unknown ENTITY type.
Data lost: ('part',$,(#7))
FIRST PASS complete: 359 instances created.
2 ERRORS 0 WARNINGS
...
This could be the reason for the corrupted attributes.
I do not understand why it seams to me so difficult to parse stp files.. why are there different schemas?? how do all the CAD authoring tools handle this? If I want to import stp files, do I have to support all schemas? why isn't there one schema to support every possibility for stp files? .. I have quite some trouble to wrap my head around all this because there a many holes I try to fill at once, I am very gratefull for any hints.
Best regards,
Victor