Hi,
I' having trouble to traverse the data structure based on the follwing step snipped:
#248 = ( BOUNDED_SURFACE() B_SPLINE_SURFACE(1,3,(
(#249,#250,#251,#252)
,(#253,#254,#255,#256
)),.UNSPECIFIED.,.F.,.F.,.F.) B_SPLINE_SURFACE_WITH_KNOTS((2,2),(4,4),(
9.9800399E-004,3.00099800399),(0.E+000,30.),
.PIECEWISE_BEZIER_KNOTS.) GEOMETRIC_REPRESENTATION_ITEM()
RATIONAL_B_SPLINE_SURFACE((
(1.,0.33333333333,0.33333333333,1.)
,(1.,0.33333333333,0.33333333333,1.
))) REPRESENTATION_ITEM('') SURFACE() );
The difficult part is doubble aggregate in the B_SPLINE_SURFACE:
B_SPLINE_SURFACE(1,3,
((#249,#250,#251,#252) , (#253,#254,#255,#256)) <------- ??
,.UNSPECIFIED.,.F.,.F.,.F.)
I go throug as follows:
void traverseEntity(STEPentity* se, bool complexPass = 0) {
if (se->IsComplex() && !complexPass) {
for (auto e : unfoldComplex(se)) traverseEntity(e, 1);
return;
}
STEPattribute* attr = 0;
se->ResetAttributes();
while ( (attr = se->NextAttribute()) != NULL ) {
if ( attr->Entity() && !attr->IsDerived()) { traverseEntity( attr->Entity()); }
else if ( auto a = attr->Aggregate() ) { traverseAggregate(a, attr); }
else if ( auto s = attr->Select() ) { traverseSelect(s, attr); }
if (attr->BaseType() != ENTITY_TYPE && attr->BaseType() != SELECT_TYPE) { // numeric value
;
}
}
}
void traverseAggregate(STEPaggregate *sa, STEPattribute* attr) {
auto type = attr->Type();
auto btype = attr->BaseType(); // ENTITY_TYPE
auto nrtype = attr->NonRefType();
const AttrDescriptor* adesc = attr->getADesc();
auto atype = adesc->AggrElemType(); // LIST_TYPE
SDAI_Select* sdsel;
for( EntityNode* sn = (EntityNode*)sa->GetHead(); sn != NULL; sn = (EntityNode*)sn->NextNode()) { switch (atype) {
case ENTITY_TYPE:
sse = (STEPentity*)sn->node;
break;
case SELECT_TYPE:
sen = (SelectNode*)sn;
sdsel = sen->node;
break;
case SET_TYPE:
case LIST_TYPE:
// what here??
break;
case INTEGER_TYPE
default: cout << "aggregate Type not handled:" << atype << endl;
}
}
}
To get the entity types works by casting
sse = (STEPentity*)sn->node;
To get the select type works by casting:
sen = (SelectNode*)sn;
sdsel = sen->node;
How do I proceed for LIST_TYPE ?
To what should I cast sn / sn->node ?
Best regards and many thanks!
Victor