From: rraphael Date: Thu, 17 Dec 2020 09:53:12 +0000 (+0100) Subject: group shape: remove COMPOUND on single shape result, activate python plugin X-Git-Tag: V9_7_0a1~13^2~14 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=82894c21d3367e5055f6d302e9162382ca3ea95c;p=modules%2Fshaper.git group shape: remove COMPOUND on single shape result, activate python plugin --- diff --git a/src/CollectionPlugin/CollectionPlugin_GroupShape.cpp b/src/CollectionPlugin/CollectionPlugin_GroupShape.cpp index a44ecdba7..0a0f90d25 100644 --- a/src/CollectionPlugin/CollectionPlugin_GroupShape.cpp +++ b/src/CollectionPlugin/CollectionPlugin_GroupShape.cpp @@ -19,12 +19,30 @@ #include "CollectionPlugin_GroupShape.h" #include "ModelAPI_ResultBody.h" +#include +#include void CollectionPlugin_GroupShape::execute() { ResultGroupPtr aGroup; CollectionPlugin_GroupMerge::execute(aGroup); GeomShapePtr aCompound = aGroup->shape(); + + const TopoDS_Shape & aShape = aCompound->impl(); + + if(aShape.NbChildren() == 1) + { + /// unique shape, remove compound on type + + TopoDS_Iterator anIt(aShape); + TopoDS_Shape aShape = anIt.Value(); + std::shared_ptr aRes(new GeomAPI_Shape); + aRes->setImpl(new TopoDS_Shape(aShape)); + aGroup->store(GeomShapePtr()); + aGroup->store(aRes); + aCompound = aGroup->shape(); + } + std::shared_ptr theResultBody = document()->createBody(data()); theResultBody->store(GeomShapePtr()); if(!aCompound->empty()) diff --git a/src/PythonAPI/model/collection/__init__.py b/src/PythonAPI/model/collection/__init__.py index 9b71ec825..b6f4ed153 100644 --- a/src/PythonAPI/model/collection/__init__.py +++ b/src/PythonAPI/model/collection/__init__.py @@ -20,4 +20,4 @@ """ from CollectionAPI import addGroup, addField -from CollectionAPI import addGroupAddition, addGroupIntersection, addGroupSubstraction +from CollectionAPI import addGroupAddition, addGroupIntersection, addGroupSubstraction, addGroupShape