dump=model.moduleDocument().addFeature("Dump")
dump.string("file_path").setValue(fileName)
dump.string("file_format").setValue("py")
+ dump.string("selection_type").setValue("topological_naming")
model.do()
model.end()
pass
dump=model.moduleDocument().addFeature("Dump")
dump.string("file_path").setValue(fileName)
dump.string("file_format").setValue("py")
+ dump.string("selection_type").setValue("topological_naming")
model.do()
model.end()
pass
else if (theType == "Solids" || theType == "solid" || theType == "SOLID")
return "solid";
else if (theType == "Part" || theType == "part" || theType == "PART")
- return "part";
+ return "whole";
return std::string();
}
TestBooleanFuse_SolidCompound_SolidCompound.py
TestBooleanFuse_CompSolid_CompSolid.py
TestBooleanFuse_CompSolidCompound_CompSolidCompound.py
+ Test1816.py
+ Test2631.py
)
#include <GeomAPI_ShapeExplorer.h>
#include <GeomAPI_ShapeIterator.h>
+//==================================================================================================
+const int ModifyVTag = 1;
+const int ModifyETag = 2;
+const int ModifyFTag = 3;
+const int DeletedTag = 4;
+/// sub solids will be placed at labels 5, 6, etc. if result is compound of solids
+const int SubsolidsTag = 5;
+
+
//==================================================================================================
FeaturesPlugin_BooleanCut::FeaturesPlugin_BooleanCut()
: FeaturesPlugin_Boolean(FeaturesPlugin_Boolean::BOOL_CUT)
return;
}
+ std::vector<ResultBaseAlgo> aResultBaseAlgoList;
+ ListOfShape aResultShapesList;
+
// For solids cut each object with all tools.
for(ListOfShape::iterator anObjectsIt = anObjects.begin();
anObjectsIt != anObjects.end();
++anObjectsIt) {
std::shared_ptr<GeomAPI_Shape> anObject = *anObjectsIt;
- GeomAlgoAPI_MakeShapeList aMakeShapeList;
+ std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeShapeList(new GeomAlgoAPI_MakeShapeList());
std::shared_ptr<GeomAlgoAPI_Boolean> aCutAlgo(
new GeomAlgoAPI_Boolean(anObject,
aTools,
return;
}
- aMakeShapeList.appendAlgo(aCutAlgo);
+ aMakeShapeList->appendAlgo(aCutAlgo);
GeomAPI_ShapeIterator aShapeIt(aResShape);
if (aShapeIt.more() || aResShape->shapeType() == GeomAPI_Shape::VERTEX)
document()->createBody(data(), aResultIndex);
loadNamingDS(aResultBody, anObject, aTools, aResShape,
- aMakeShapeList, *(aCutAlgo->mapOfSubShapes()),
+ *aMakeShapeList, *(aCutAlgo->mapOfSubShapes()),
false);
setResult(aResultBody, aResultIndex);
aResultIndex++;
+
+ ResultBaseAlgo aRBA;
+ aRBA.resultBody = aResultBody;
+ aRBA.baseShape = anObject;
+ aRBA.makeShape = aMakeShapeList;
+ aResultBaseAlgoList.push_back(aRBA);
+ aResultShapesList.push_back(aResShape);
}
}
}
}
- GeomAlgoAPI_MakeShapeList aMakeShapeList;
+ std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeShapeList(new GeomAlgoAPI_MakeShapeList());
std::shared_ptr<GeomAlgoAPI_Boolean> aCutAlgo(
new GeomAlgoAPI_Boolean(aUsedInOperationSolids,
aTools,
return;
}
- aMakeShapeList.appendAlgo(aCutAlgo);
+ aMakeShapeList->appendAlgo(aCutAlgo);
GeomAPI_DataMapOfShapeShape aMapOfShapes;
aMapOfShapes.merge(aCutAlgo->mapOfSubShapes());
GeomShapePtr aResultShape = aCutAlgo->shape();
return;
}
- aMakeShapeList.appendAlgo(aFillerAlgo);
+ aMakeShapeList->appendAlgo(aFillerAlgo);
aMapOfShapes.merge(aFillerAlgo->mapOfSubShapes());
aResultShape = aFillerAlgo->shape();
}
aCompSolid,
aTools,
aResultShape,
- aMakeShapeList,
+ *aMakeShapeList,
aMapOfShapes,
false);
setResult(aResultBody, aResultIndex);
aResultIndex++;
+
+ ResultBaseAlgo aRBA;
+ aRBA.resultBody = aResultBody;
+ aRBA.baseShape = aCompSolid;
+ aRBA.makeShape = aMakeShapeList;
+ aResultBaseAlgoList.push_back(aRBA);
+ aResultShapesList.push_back(aResultShape);
}
}
}
}
- GeomAlgoAPI_MakeShapeList aMakeShapeList;
+ std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeShapeList(new GeomAlgoAPI_MakeShapeList());
std::shared_ptr<GeomAlgoAPI_Boolean> aCutAlgo(
new GeomAlgoAPI_Boolean(aUsedInOperationShapes,
aTools,
return;
}
- aMakeShapeList.appendAlgo(aCutAlgo);
+ aMakeShapeList->appendAlgo(aCutAlgo);
GeomAPI_DataMapOfShapeShape aMapOfShapes;
aMapOfShapes.merge(aCutAlgo->mapOfSubShapes());
GeomShapePtr aResultShape = aCutAlgo->shape();
aCompound,
aTools,
aResultShape,
- aMakeShapeList,
+ *aMakeShapeList,
aMapOfShapes,
false);
setResult(aResultBody, aResultIndex);
aResultIndex++;
+
+ ResultBaseAlgo aRBA;
+ aRBA.resultBody = aResultBody;
+ aRBA.baseShape = aCompound;
+ aRBA.makeShape = aMakeShapeList;
+ aResultBaseAlgoList.push_back(aRBA);
+ aResultShapesList.push_back(aResultShape);
}
}
+ // Store deleted shapes after all results has been proceeded. This is to avoid issue when in one
+ // result shape has been deleted, but in another it was modified or stayed.
+ GeomShapePtr aResultShapesCompound = GeomAlgoAPI_CompoundBuilder::compound(aResultShapesList);
+ storeDeletedShapes(aResultBaseAlgoList, aTools, aResultShapesCompound);
+
// remove the rest results if there were produced in the previous pass
removeResults(aResultIndex);
}
if(theBaseShape->isEqual(theResultShape)) {
theResultBody->store(theResultShape, false);
} else {
- const int aModifyVTag = 1;
- const int aModifyETag = 2;
- const int aModifyFTag = 3;
- const int aDeletedTag = 4;
- /// sub solids will be placed at labels 5, 6, etc. if result is compound of solids
- const int aSubsolidsTag = 5;
-
- theResultBody->storeModified(theBaseShape, theResultShape, aSubsolidsTag);
+ theResultBody->storeModified(theBaseShape, theResultShape, SubsolidsTag);
const std::string aModVName = "Modified_Vertex";
const std::string aModEName = "Modified_Edge";
const std::string aModFName = "Modified_Face";
theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::VERTEX,
- aModifyVTag, aModVName, theMapOfShapes, false,
+ ModifyVTag, aModVName, theMapOfShapes, false,
theIsStoreAsGenerated, true);
theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::EDGE,
- aModifyETag, aModEName, theMapOfShapes, false,
+ ModifyETag, aModEName, theMapOfShapes, false,
theIsStoreAsGenerated, true);
theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::FACE,
- aModifyFTag, aModFName, theMapOfShapes, false,
+ ModifyFTag, aModFName, theMapOfShapes, false,
theIsStoreAsGenerated, true);
- theResultBody->loadDeletedShapes(&theMakeShape, theBaseShape,
- GeomAPI_Shape::VERTEX, aDeletedTag);
- theResultBody->loadDeletedShapes(&theMakeShape, theBaseShape,
- GeomAPI_Shape::EDGE, aDeletedTag);
- theResultBody->loadDeletedShapes(&theMakeShape, theBaseShape,
- GeomAPI_Shape::FACE, aDeletedTag);
-
for (ListOfShape::const_iterator anIter = theTools.begin(); anIter != theTools.end(); anIter++)
{
theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter, GeomAPI_Shape::VERTEX,
- aModifyVTag, aModVName, theMapOfShapes, false,
+ ModifyVTag, aModVName, theMapOfShapes, false,
theIsStoreAsGenerated, true);
theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter, GeomAPI_Shape::EDGE,
- aModifyETag, aModEName, theMapOfShapes, false,
+ ModifyETag, aModEName, theMapOfShapes, false,
theIsStoreAsGenerated, true);
theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter, GeomAPI_Shape::FACE,
- aModifyFTag, aModFName, theMapOfShapes, false,
+ ModifyFTag, aModFName, theMapOfShapes, false,
theIsStoreAsGenerated, true);
+ }
+ }
+}
+
+//==================================================================================================
+void FeaturesPlugin_BooleanCut::storeDeletedShapes(
+ std::vector<ResultBaseAlgo>& theResultBaseAlgoList,
+ const ListOfShape& theTools,
+ const GeomShapePtr theResultShapesCompound)
+{
+ for (std::vector<ResultBaseAlgo>::iterator anIt = theResultBaseAlgoList.begin();
+ anIt != theResultBaseAlgoList.end();
+ ++anIt)
+ {
+ ResultBaseAlgo& aRCA = *anIt;
+ aRCA.resultBody->loadDeletedShapes(aRCA.makeShape.get(),
+ aRCA.baseShape,
+ GeomAPI_Shape::VERTEX,
+ DeletedTag,
+ theResultShapesCompound);
+ aRCA.resultBody->loadDeletedShapes(aRCA.makeShape.get(),
+ aRCA.baseShape,
+ GeomAPI_Shape::EDGE,
+ DeletedTag,
+ theResultShapesCompound);
+ aRCA.resultBody->loadDeletedShapes(aRCA.makeShape.get(),
+ aRCA.baseShape,
+ GeomAPI_Shape::FACE,
+ DeletedTag,
+ theResultShapesCompound);
- theResultBody->loadDeletedShapes(&theMakeShape, *anIter, GeomAPI_Shape::VERTEX, aDeletedTag);
- theResultBody->loadDeletedShapes(&theMakeShape, *anIter, GeomAPI_Shape::EDGE, aDeletedTag);
- theResultBody->loadDeletedShapes(&theMakeShape, *anIter, GeomAPI_Shape::FACE, aDeletedTag);
+ for (ListOfShape::const_iterator anIter = theTools.begin(); anIter != theTools.end(); anIter++)
+ {
+ aRCA.resultBody->loadDeletedShapes(aRCA.makeShape.get(),
+ *anIter,
+ GeomAPI_Shape::VERTEX,
+ DeletedTag,
+ theResultShapesCompound);
+ aRCA.resultBody->loadDeletedShapes(aRCA.makeShape.get(),
+ *anIter,
+ GeomAPI_Shape::EDGE,
+ DeletedTag,
+ theResultShapesCompound);
+ aRCA.resultBody->loadDeletedShapes(aRCA.makeShape.get(),
+ *anIter,
+ GeomAPI_Shape::FACE,
+ DeletedTag,
+ theResultShapesCompound);
}
}
}
/// Use plugin manager for features creation.
FeaturesPlugin_BooleanCut();
+private:
+
+ struct ResultBaseAlgo {
+ ResultBodyPtr resultBody;
+ GeomShapePtr baseShape;
+ std::shared_ptr<GeomAlgoAPI_MakeShape> makeShape;
+ };
+
private:
/// Load Naming data structure of the feature to the document
GeomAPI_DataMapOfShapeShape& theMapOfShapes,
const bool theIsStoreAsGenerated = false);
+ /// Stores deleted shapes.
+ void storeDeletedShapes(std::vector<ResultBaseAlgo>& theResultBaseAlgoList,
+ const ListOfShape& theTools,
+ const GeomShapePtr theResultShapesCompound);
+
};
#endif
if (aCSIt->first->shapeType() != GeomAPI_Shape::COMPSOLID)
continue;
+ // check the compsolid is selected
+ if (aCSIt->second.size() == 1 && aCSIt->first->isEqual(aCSIt->second.front()))
+ continue;
+
+ // process all sub-solids of compsolid
ListOfShape aNotUsedSolids;
for (GeomAPI_ShapeExplorer anExp(aCSIt->first, GeomAPI_Shape::SOLID);
anExp.more(); anExp.next()) {
--- /dev/null
+## Copyright (C) 2014-2017 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<mailto:webmaster.salome@opencascade.com>
+##
+
+# The test for correct selection of a whole feautre as argument of other feature: select all extrusions
+# produced from the scetch, then change the number of sketch contours, so, anytway all extrusions must
+# still be selected in the Cut Boolean oepration
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+model.addParameter(Part_1_doc, "Ray", "12.5")
+model.addParameter(Part_1_doc, "Lgx", "50")
+model.addParameter(Part_1_doc, "Lgy", "60")
+model.addParameter(Part_1_doc, "Lgz", "75")
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
+SketchLine_1 = Sketch_1.addLine(0, 0, 0, 75)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchPoint_1.result())
+SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False)
+SketchLine_2 = SketchProjection_2.createdFeature()
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.result())
+SketchLine_3 = Sketch_1.addLine(0, 75, 37.5, 75)
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint())
+SketchArc_1 = Sketch_1.addArc(37.5, 62.5, 37.5, 75, 50, 62.5, True)
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_1.startPoint())
+SketchLine_4 = Sketch_1.addLine(50, 62.5, 50, 0)
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_4.startPoint())
+SketchProjection_3 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False)
+SketchLine_5 = SketchProjection_3.createdFeature()
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.result())
+SketchLine_6 = Sketch_1.addLine(50, 0, 0, 0)
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_6.startPoint())
+SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_6.endPoint())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_3.result(), SketchArc_1.results()[1])
+SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_4.result(), SketchArc_1.results()[1])
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), "Lgz")
+SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_6.result(), "Lgx")
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "Ray")
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_3r-SketchArc_1_2f-SketchLine_4r-SketchLine_6r")], model.selection(), 0, "Lgy")
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_1"))
+SketchLine_7 = Sketch_2.addLine(0, -75, 0, 0)
+SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_3s-SketchLine_1e"), False)
+SketchPoint_2 = SketchProjection_4.createdFeature()
+SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_7.startPoint(), SketchPoint_2.result())
+SketchProjection_5 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"), False)
+SketchPoint_3 = SketchProjection_5.createdFeature()
+SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchPoint_3.result())
+SketchLine_8 = Sketch_2.addLine(0, 0, 60, 0)
+SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
+SketchProjection_6 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1"), False)
+SketchPoint_4 = SketchProjection_6.createdFeature()
+SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchPoint_4.result())
+SketchLine_9 = Sketch_2.addLine(60, 0, 59.99999999999999, -62.5)
+SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
+SketchProjection_7 = Sketch_2.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1"), False)
+SketchLine_10 = SketchProjection_7.createdFeature()
+SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_10.result())
+SketchLine_11 = Sketch_2.addLine(0, -75, 47.49999999999999, -75)
+SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_7.startPoint(), SketchLine_11.startPoint())
+SketchProjection_8 = Sketch_2.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1"), False)
+SketchLine_12 = SketchProjection_8.createdFeature()
+SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.result())
+SketchArc_2 = Sketch_2.addArc(47.49999999999999, -62.5, 59.99999999999999, -62.5, 47.49999999999999, -75, True)
+SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchArc_2.startPoint())
+SketchConstraintRadius_2 = Sketch_2.setRadius(SketchArc_2.results()[1], "Ray")
+SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchArc_2.endPoint(), SketchLine_11.endPoint())
+SketchConstraintTangent_3 = Sketch_2.setTangent(SketchArc_2.results()[1], SketchLine_11.result())
+SketchConstraintTangent_4 = Sketch_2.setTangent(SketchLine_9.result(), SketchArc_2.results()[1])
+model.do()
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_7r-SketchLine_8r-SketchLine_9r-SketchLine_11f-SketchArc_2_2f")], model.selection(), 0, "Lgx")
+Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1")])
+model.end()
+
+assert(len(Common_1.results()) == 1)
+model.testResultsVolumes(Common_1, [221498.777690970688126981258392334])
+
+assert(model.checkPythonDump())
--- /dev/null
+## Copyright (C) 2014-2017 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<mailto:webmaster.salome@opencascade.com>
+##
+
+from SketchAPI import *
+
+from salome.shaper import model
+
+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(-53.93497380447579, 58.11303515552675, 60.01215395145899, 58.11303515552675)
+SketchLine_2 = Sketch_1.addLine(60.01215395145899, 58.11303515552675, 60.01215395145899, 11.01488901640705)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+model.do()
+Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_3 = Sketch_2.addLine(31.90519577166173, 58.11303515552675, 60.012153951459, 58.11303515552675)
+SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), False)
+SketchLine_4 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_3.startPoint(), SketchLine_4.result())
+SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_4).endPoint(), SketchLine_3.endPoint())
+SketchLine_5 = Sketch_2.addLine(60.012153951459, 58.11303515552675, 60.012153951459, 33.0446670492211)
+SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_5.startPoint())
+SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), False)
+SketchLine_6 = SketchProjection_2.createdFeature()
+SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.result())
+model.do()
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
+Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_5")])
+Cut_1 = model.addCut(Part_1_doc, [model.selection("EDGE", "Edge_1_1"), model.selection("EDGE", "Edge_1_2")], [model.selection("EDGE", "Edge_2_1"), model.selection("EDGE", "Edge_2_2")])
+model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
+model.do()
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Cut_1, 2)
+model.testNbSubResults(Cut_1, [0, 0])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.SOLID, [0, 0])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.FACE, [0, 0])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [1, 1])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [2, 2])
+
+assert(model.checkPythonDump())
The following property panel appears.
-.. image:: images/AngularCopy.png
+.. image:: images/angularcopy.png
:align: center
.. centered::
""""""
Result of cylinder rotation is compound.
-.. image:: images/angularcopy.png
+.. image:: images/angularcopycyl.png
:align: center
.. centered::
""""""
Result of operation is compound.
-.. image:: images/linearcopy.png
+.. image:: images/linearcopyres.png
:align: center
.. centered::
:align: center
.. centered::
- Pipe by object and path
+ Pipe by object, path and Bi-normal
**See Also** a sample TUI Script of a :ref:`tui_binormal_pipe` operation.
Result
""""""
-Result of operation is transformed initial shape.
+Result of operation is transformed initial shape shown in wireframe mode together with initial shape in shading mode.
.. image:: images/Scale_common_factor.png
:align: center
Result of operation is transformed initial shape.
-.. image:: images/Scale_common_factor.png
+.. image:: images/Scale_XYZ.png
:align: center
.. centered::
Translation by axis and distance
--------------------------------
-.. image:: images/Translation1.png
+.. image:: images/Translation2.png
:align: center
.. centered::
Result of operation is shifted initial shape.
-.. image:: images/translation_vector.png
+.. image:: images/translation_XYZ.png
:align: center
.. centered::
Translation by vector
---------------------
-.. image:: images/Translation2.png
+.. image:: images/Translation1.png
:align: center
.. centered::
Result of operation is shifted initial shape.
-.. image:: images/translation_vector.png
+.. image:: images/translation_2points.png
:align: center
.. centered::
// prepare a context
PyObject* aContext = PyDict_New();
- PyObject* aBuiltinModule = PyImport_AddModule("__builtin__");
- PyDict_SetItemString(aContext, "__builtins__", aBuiltinModule);
+ PyDict_SetItemString(aContext, "__builtins__", PyEval_GetBuiltins());
std::string anExpression = adjustExpression(theExpression);
// extend aContext with variables
void Model_BodyBuilder::loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS,
std::shared_ptr<GeomAPI_Shape> theShapeIn,
const int theKindOfShape,
- const int theTag)
+ const int theTag,
+ const GeomShapePtr theShapes)
{
TopoDS_Shape aShapeIn = theShapeIn->impl<TopoDS_Shape>();
TopTools_MapOfShape aView;
if (!aView.Add(aRoot)) continue;
std::shared_ptr<GeomAPI_Shape> aRShape(new GeomAPI_Shape());
aRShape->setImpl((new TopoDS_Shape(aRoot)));
- if (theMS->isDeleted (aRShape)) {
- if (!aResultShape->isSubShape(aRShape, false)) {
- ListOfShape aHist;
- if (BRepTools_History::IsSupportedType(aRoot)) // to avoid crash in #2572
- theMS->modified(aRShape, aHist);
- if (aHist.size() == 0 || (aHist.size() == 1 && aHist.front()->isSame(aRShape)))
- builder(theTag)->Delete(aRoot);
- }
+ if (!theMS->isDeleted(aRShape)
+ || aResultShape->isSubShape(aRShape, false)
+ || (theShapes.get() && theShapes->isSubShape(aRShape, false))) {
+ continue;
}
+
+ ListOfShape aHist;
+ if (BRepTools_History::IsSupportedType(aRoot)) // to avoid crash in #2572
+ theMS->modified(aRShape, aHist);
+ if (aHist.size() == 0 || (aHist.size() == 1 && aHist.front()->isSame(aRShape)))
+ builder(theTag)->Delete(aRoot);
}
}
MODEL_EXPORT virtual void loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS,
std::shared_ptr<GeomAPI_Shape> theShapeIn,
const int theKindOfShape,
- const int theTag);
+ const int theTag,
+ const GeomShapePtr theShapes = GeomShapePtr());
/// load and orient modified shapes
MODEL_EXPORT virtual void loadAndOrientModifiedShapes (
GeomAlgoAPI_MakeShape* theMS,
virtual void loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS,
std::shared_ptr<GeomAPI_Shape> theShapeIn,
const int theKindOfShape,
- const int theTag) = 0;
+ const int theTag,
+ const GeomShapePtr theShapes = GeomShapePtr()) = 0;
/// load and orient modified shapes
virtual void loadAndOrientModifiedShapes (
GeomAlgoAPI_MakeShape* theMS,
void ModelAPI_ResultBody::loadDeletedShapes(GeomAlgoAPI_MakeShape* theMS,
std::shared_ptr<GeomAPI_Shape> theShapeIn,
const int theKindOfShape,
- const int theTag)
+ const int theTag,
+ const GeomShapePtr theShapes)
{
- myBuilder->loadDeletedShapes(theMS, theShapeIn, theKindOfShape, theTag);
+ myBuilder->loadDeletedShapes(theMS, theShapeIn, theKindOfShape, theTag, theShapes);
}
void ModelAPI_ResultBody::loadAndOrientModifiedShapes(GeomAlgoAPI_MakeShape* theMS,
MODELAPI_EXPORT virtual void loadDeletedShapes(GeomAlgoAPI_MakeShape* theMS,
std::shared_ptr<GeomAPI_Shape> theShapeIn,
const int theKindOfShape,
- const int theTag);
+ const int theTag,
+ const GeomShapePtr theShapes = GeomShapePtr());
/// load and orient modified shapes
MODELAPI_EXPORT virtual void loadAndOrientModifiedShapes(GeomAlgoAPI_MakeShape* theMS,