From: Nicolas RECHATIN Date: Mon, 23 Jan 2023 15:33:02 +0000 (+0100) Subject: WIP : Subsequent addNode v1.0, no AN + Volume X-Git-Tag: OPERA_v0.6-s990~3^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=706b3ccbe0ed572c6e960be3495c2cb40751f333;p=modules%2Fshaper.git WIP : Subsequent addNode v1.0, no AN + Volume --- diff --git a/src/OperaPlugin/OperaPlugin_AddNode.cpp b/src/OperaPlugin/OperaPlugin_AddNode.cpp index 7054d83a2..a78b5a013 100644 --- a/src/OperaPlugin/OperaPlugin_AddNode.cpp +++ b/src/OperaPlugin/OperaPlugin_AddNode.cpp @@ -110,13 +110,25 @@ void OperaPlugin_AddNode::execute() // Get older tools and main shape if (aMainObjectShape->shapeType() == GeomAPI_Shape::COMPOUND){ - ListOfShape aMainObjectSubShapes = aMainObjectShape->subShapes(GeomAPI_Shape::SOLID); - for (auto it = aMainObjectSubShapes.begin(); it != aMainObjectSubShapes.end(); it++) { - if (it == aMainObjectSubShapes.begin()) - aMainObjectShape = *it; - else + //Get COMPOUND and SOLID Shape list + ListOfShape aSubSolidShapeList = aMainObjectShape->subShapes(GeomAPI_Shape::SOLID); + ListOfShape aSubCompoundShapeList = aMainObjectShape->subShapes(GeomAPI_Shape::COMPOUND); + //Get main solid + aMainObjectShape = *(aSubSolidShapeList.begin()); + //Only add node in compound + if (aSubCompoundShapeList.size() > 1) { + aSubCompoundShapeList.pop_back(); + for (auto it = aSubCompoundShapeList.begin(); it != aSubCompoundShapeList.end(); it++) aToolList.push_back(*it); } + // Only solid in compound + else + { + aSubSolidShapeList.pop_front(); + for (auto it = aSubCompoundShapeList.begin(); it != aSubCompoundShapeList.end(); it++) + aToolList.push_back(*it); + } + //TODO Merge to allow both in AddNode } // Get Case