X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXAOPlugin%2FXAOPlugin_IOperations.cxx;h=865ead17a22f433a435d01b3a00585349c59b33d;hb=c1d63ef1f803d255b61ee99fb618bf471add07f4;hp=101686759b6d15b9b3b0be22f2158e7bf0158ca7;hpb=df260abc619ded3d424fed72772226ca63e3c90b;p=modules%2Fgeom.git diff --git a/src/XAOPlugin/XAOPlugin_IOperations.cxx b/src/XAOPlugin/XAOPlugin_IOperations.cxx index 101686759..865ead17a 100644 --- a/src/XAOPlugin/XAOPlugin_IOperations.cxx +++ b/src/XAOPlugin/XAOPlugin_IOperations.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2020 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2014-2023 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -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: @@ -179,7 +182,7 @@ bool XAOPlugin_IOperations::exportGroups( std::list groupLi void XAOPlugin_IOperations::exportFields( std::list fieldList, XAO::Xao* xaoObject, - XAO::BrepGeometry* geometry ) + XAO::BrepGeometry* /*geometry*/ ) { std::list::iterator fieldIterator = fieldList.begin(); while (fieldIterator != fieldList.end()) @@ -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