Bos #19916: EDF 21881 - CAD with field can't be exported

This commit is contained in:
jfa 2020-08-19 15:28:28 +03:00
parent 665d9f4816
commit bbdad62780

View File

@ -136,6 +136,9 @@ bool XAOPlugin_IOperations::exportGroups( std::list<Handle(GEOM_Object)> groupLi
XAO::Dimension dim = shapeEnumToDimension(shapeGroup); XAO::Dimension dim = shapeEnumToDimension(shapeGroup);
XAO::Group* group = xaoObject->addGroup(dim, currGroup->GetName().ToCString()); XAO::Group* group = xaoObject->addGroup(dim, currGroup->GetName().ToCString());
// Group can be empty
if (groupIds.IsNull()) continue;
switch (shapeGroup) switch (shapeGroup)
{ {
case TopAbs_VERTEX: case TopAbs_VERTEX:
@ -531,13 +534,19 @@ bool XAOPlugin_IOperations::ImportXAO( const char* fileName,
// build an array with the indexes of the sub shapes // build an array with the indexes of the sub shapes
int nbElt = xaoGroup->count(); int nbElt = xaoGroup->count();
Handle(TColStd_HArray1OfInteger) array = new TColStd_HArray1OfInteger(1, nbElt); Handle(TColStd_HArray1OfInteger) array;
int j = 0; if (nbElt > 0) {
for (std::set<int>::iterator it = xaoGroup->begin(); it != xaoGroup->end(); ++it) array = new TColStd_HArray1OfInteger(1, nbElt);
{ int j = 0;
int index = (*it); for (std::set<int>::iterator it = xaoGroup->begin(); it != xaoGroup->end(); ++it) {
std::string ref = xaoGeometry->getElementReference(xaoGroup->getDimension(), index); int index = (*it);
array->SetValue(++j, XAO::XaoUtils::stringToInt(ref)); std::string ref = xaoGeometry->getElementReference(xaoGroup->getDimension(), index);
array->SetValue(++j, XAO::XaoUtils::stringToInt(ref));
}
}
else { // empty group
array = new TColStd_HArray1OfInteger(1, 1);
array->SetValue(1, -1);
} }
// create the group with the array of sub shapes indexes // create the group with the array of sub shapes indexes