From: jfa Date: Wed, 19 Aug 2020 12:28:28 +0000 (+0300) Subject: Bos #19916: EDF 21881 - CAD with field can't be exported X-Git-Tag: V9_6_0a1~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bbdad62780da4f0eff7a3bc1a7d4c4894721c9c7;p=modules%2Fgeom.git Bos #19916: EDF 21881 - CAD with field can't be exported --- diff --git a/src/XAOPlugin/XAOPlugin_IOperations.cxx b/src/XAOPlugin/XAOPlugin_IOperations.cxx index 101686759..7e02ed4d1 100644 --- a/src/XAOPlugin/XAOPlugin_IOperations.cxx +++ b/src/XAOPlugin/XAOPlugin_IOperations.cxx @@ -136,6 +136,9 @@ bool XAOPlugin_IOperations::exportGroups( std::list groupLi XAO::Dimension dim = shapeEnumToDimension(shapeGroup); XAO::Group* group = xaoObject->addGroup(dim, currGroup->GetName().ToCString()); + // Group can be empty + if (groupIds.IsNull()) continue; + switch (shapeGroup) { case TopAbs_VERTEX: @@ -531,13 +534,19 @@ bool XAOPlugin_IOperations::ImportXAO( const char* fileName, // build an array with the indexes of the sub shapes int nbElt = xaoGroup->count(); - Handle(TColStd_HArray1OfInteger) array = new TColStd_HArray1OfInteger(1, nbElt); - int j = 0; - for (std::set::iterator it = xaoGroup->begin(); it != xaoGroup->end(); ++it) - { - int index = (*it); - std::string ref = xaoGeometry->getElementReference(xaoGroup->getDimension(), index); - array->SetValue(++j, XAO::XaoUtils::stringToInt(ref)); + Handle(TColStd_HArray1OfInteger) array; + if (nbElt > 0) { + array = new TColStd_HArray1OfInteger(1, nbElt); + int j = 0; + for (std::set::iterator it = xaoGroup->begin(); it != xaoGroup->end(); ++it) { + int index = (*it); + 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