From 706b3ccbe0ed572c6e960be3495c2cb40751f333 Mon Sep 17 00:00:00 2001 From: Nicolas RECHATIN Date: Mon, 23 Jan 2023 16:33:02 +0100 Subject: [PATCH] WIP : Subsequent addNode v1.0, no AN + Volume --- src/OperaPlugin/OperaPlugin_AddNode.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) 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 -- 2.39.2