#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_ResultBody.h>
+#include <ModelAPI_ResultConstruction.h>
#include <GeomAPI_Edge.h>
#include <GeomAPI_PlanarEdges.h>
if(!aShape.get()) {
aShape = aContext;
}
- // keep selected faces "as is"
if (aShape->shapeType() == GeomAPI_Shape::FACE) {
+ // keep selected faces "as is"
anOriginalFaces.push_back(aShape);
continue;
}
+ else if (!aSelection->value() && aShape->shapeType() == GeomAPI_Shape::COMPOUND) {
+ // collect faces from the sketch
+ ResultConstructionPtr aSketch =
+ std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aSelection->context());
+ if (aSketch && aSketch->facesNum() > 0) {
+ for (int i = 0; i < aSketch->facesNum(); ++i)
+ anOriginalFaces.push_back(aSketch->face(i));
+ continue;
+ }
+ }
for(GeomAPI_ShapeExplorer anExp(aShape, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) {
GeomShapePtr anEdge = anExp.current();
ListOfShape aShapes, aContexts;
getOriginalShapesAndContexts(BASE_OBJECTS_ID(), aShapes, aContexts);
+ // Collect sketch faces.
+ for (int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) {
+ AttributeSelectionPtr aSelection = aSelectionList->value(anIndex);
+ GeomShapePtr aShape = aSelection->value();
+ ResultConstructionPtr aContext =
+ std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aSelection->context());
+ if (!aShape && aContext) {
+ for (int i = 0; i < aContext->facesNum(); ++i)
+ aShapes.push_back(aContext->face(i));
+ }
+ }
+
// Sew faces.
GeomMakeShapePtr aSewingAlgo(new GeomAlgoAPI_Sewing(aShapes));
theError = "Infinite objects not acceptable.";
return false;
}
-
- std::shared_ptr<GeomAPI_PlanarEdges> anEdges =
- std::dynamic_pointer_cast<GeomAPI_PlanarEdges>(aContextShape);
- if(anEdges.get()) {
- if(aShape->isEqual(aContextShape)) {
- // It is whole sketch.
- return false;
- }
-
- continue;
- }
}
}
}
aShape = aSelection->context()->shape();
}
- if (aShape->shapeType() == GeomAPI_Shape::FACE) {
+ ResultConstructionPtr aSketchRes =
+ std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aSelection->context());
+
+ if (aShape->shapeType() == GeomAPI_Shape::FACE ||
+ (!aSelection->value() && aSketchRes && aSketchRes->facesNum() > 0)) {
// skip faces exploding
hasFaces = true;
continue;
TestInterpolation.py
TestFace.py
TestFace_ErrorMsg.py
+ TestFace_WholeSketch_1.py
+ TestFace_WholeSketch_2.py
TestShell.py
+ TestShell_WholeSketch_1.py
+ TestShell_WholeSketch_2.py
TestSolid.py
TestSolid_ErrorMsg.py
TestCompSolid.py
--- /dev/null
+# Copyright (C) 2019 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(0, -20, 45, -15)
+SketchLine_2 = Sketch_1.addLine(45, -15, 10, 15)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchLine_3 = Sketch_1.addLine(10, 15, 25, -40)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+model.do()
+Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_2.addCircle(-5, 10, 20)
+SketchLine_4 = Sketch_2.addLine(-25, 10, 15, 10)
+SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_4.startPoint(), SketchCircle_1.results()[1])
+SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchCircle_1.results()[1])
+model.do()
+Face_1 = model.addFace(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")])
+model.end()
+
+model.testNbResults(Face_1, 1)
+model.testNbSubShapes(Face_1, GeomAPI_Shape.FACE, [1])
+model.testNbSubShapes(Face_1, GeomAPI_Shape.EDGE, [3])
+model.testNbSubShapes(Face_1, GeomAPI_Shape.VERTEX, [6])
+model.testResultsVolumes(Face_1, [441.0539215686274])
+
+assert(model.checkPythonDump())
--- /dev/null
+# Copyright (C) 2019 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(0, -20, 45, -15)
+SketchLine_2 = Sketch_1.addLine(45, -15, 10, 15)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchLine_3 = Sketch_1.addLine(10, 15, 25, -40)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+model.do()
+Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_2.addCircle(-5, 10, 20)
+SketchLine_4 = Sketch_2.addLine(-25, 10, 15, 10)
+SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_4.startPoint(), SketchCircle_1.results()[1])
+SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchCircle_1.results()[1])
+model.do()
+Face_1 = model.addFace(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1"), model.selection("COMPOUND", "Sketch_2")])
+model.end()
+
+model.testNbResults(Face_1, 3)
+model.testNbSubShapes(Face_1, GeomAPI_Shape.FACE, [1, 1, 1])
+model.testNbSubShapes(Face_1, GeomAPI_Shape.EDGE, [3, 2, 2])
+model.testNbSubShapes(Face_1, GeomAPI_Shape.VERTEX, [6, 4, 4])
+model.testResultsVolumes(Face_1, [441.0539215686274, 628.318530717958, 628.318530717958])
+
+assert(model.checkPythonDump())
--- /dev/null
+# Copyright (C) 2019 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(0, -20, 45, -15)
+SketchLine_2 = Sketch_1.addLine(45, -15, 10, 15)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchLine_3 = Sketch_1.addLine(10, 15, 25, -40)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+model.do()
+Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_2.addCircle(-5, 10, 20)
+SketchLine_4 = Sketch_2.addLine(-25, 10, 15, 10)
+SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_4.startPoint(), SketchCircle_1.results()[1])
+SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchCircle_1.results()[1])
+model.do()
+Shell_1 = model.addShell(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")])
+model.end()
+
+model.testNbResults(Shell_1, 1)
+model.testNbSubShapes(Shell_1, GeomAPI_Shape.FACE, [1])
+model.testNbSubShapes(Shell_1, GeomAPI_Shape.EDGE, [3])
+model.testNbSubShapes(Shell_1, GeomAPI_Shape.VERTEX, [6])
+model.testResultsVolumes(Shell_1, [441.0539215686274])
+
+assert(model.checkPythonDump())
--- /dev/null
+# Copyright (C) 2019 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(0, -20, 45, -15)
+SketchLine_2 = Sketch_1.addLine(45, -15, 10, 15)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchLine_3 = Sketch_1.addLine(10, 15, 25, -40)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+model.do()
+Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_2.addCircle(-5, 10, 20)
+SketchLine_4 = Sketch_2.addLine(-25, 10, 15, 10)
+SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_4.startPoint(), SketchCircle_1.results()[1])
+SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchCircle_1.results()[1])
+model.do()
+Shell_1 = model.addShell(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1"), model.selection("COMPOUND", "Sketch_2")])
+model.end()
+
+model.testNbResults(Shell_1, 2)
+model.testNbSubShapes(Shell_1, GeomAPI_Shape.FACE, [1, 2])
+model.testNbSubShapes(Shell_1, GeomAPI_Shape.EDGE, [3, 4])
+model.testNbSubShapes(Shell_1, GeomAPI_Shape.VERTEX, [6, 8])
+model.testResultsVolumes(Shell_1, [441.0539215686274, 1256.637061435917])
+
+assert(model.checkPythonDump())
tooltip="Select edges, wires or faces."
shape_types="edges wires faces"
concealment="true">
- <validator id="BuildPlugin_ValidatorBaseForBuild" parameters="edge,wire,face"/>
+ <validator id="BuildPlugin_ValidatorBaseForBuild" parameters="edge,wire,face,compound"/>
</multi_selector>
<validator id="BuildPlugin_ValidatorBaseForFace" parameters="base_objects"/>
</source>
tooltip="Select faces or shells objects."
shape_types="faces shells"
concealment="true">
- <validator id="BuildPlugin_ValidatorBaseForBuild" parameters="face,shell"/>
+ <validator id="BuildPlugin_ValidatorBaseForBuild" parameters="face,shell,compound"/>
</multi_selector>
</source>