Part_1 = model.addPart(partSet)
Part_1_doc = Part_1.document()
model.addParameter(Part_1_doc, "L", "10")
-model.addParameter(Part_1_doc, "Shift", "5")
+model.addParameter(Part_1_doc, "Shift", "12")
Box_1 = model.addBox(Part_1_doc, "L", "L", "L")
-Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Bottom"), "Shift", True)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Bottom"), "L/2", True)
Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
SketchPoint_1 = SketchProjection_1.createdFeature()
SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_1.endPoint())
SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_1.result())
SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "L+Shift/2")
-SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_2.startPoint(), -5)
+SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_2.startPoint(), "-Shift/3")
SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_3.startPoint(), "Shift", True)
model.do()
-Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), "Shift", True)
+Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), "Shift/3", True)
Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchLine_2f-SketchLine_3f")])
Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
Boolean_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("COMPOUND", "Boolean_1_1")])
model.do()
-model.checkBooleansResult(Boolean_2, model, 1, [0], [1], [9], [46], [92])
+model.checkBooleansResult(Boolean_2, model, 1, [2], [2], [14], [60], [120])
model.testHaveNamingSubshapes(Boolean_2, model, Part_1_doc)
model.end()
Part_1 = model.addPart(partSet)
Part_1_doc = Part_1.document()
model.addParameter(Part_1_doc, "L", "10")
-model.addParameter(Part_1_doc, "Shift", "5")
+model.addParameter(Part_1_doc, "Shift", "12")
Box_1 = model.addBox(Part_1_doc, "L", "L", "L")
-Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Bottom"), "Shift", True)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Bottom"), "L/2", True)
Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
SketchPoint_1 = SketchProjection_1.createdFeature()
SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_1.endPoint())
SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_1.result())
SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "L+Shift/2")
-SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_2.startPoint(), -5)
+SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_2.startPoint(), "-Shift/3")
SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_3.startPoint(), "Shift", True)
model.do()
-Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), "Shift", True)
+Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), "Shift/3", True)
Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchLine_2f-SketchLine_3f")])
Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Boolean_1_1_2"), model.selection("FACE", "Boolean_1_1_1")])
MultiTranslation_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], model.selection("EDGE", "PartSet/OZ"), 1, 3)
-Boolean_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("COMPOUND", "MultiTranslation_1_1")])
+Boolean_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("COMPOUND", "LinearCopy_1_1")])
model.do()
-model.checkBooleansResult(Boolean_2, model, 1, [0], [1], [15], [90], [180])
+model.checkBooleansResult(Boolean_2, model, 1, [4], [4], [30], [132], [264])
model.testHaveNamingSubshapes(Boolean_2, model, Part_1_doc)
model.end()
Part_1 = model.addPart(partSet)
Part_1_doc = Part_1.document()
model.addParameter(Part_1_doc, "L", "10")
-model.addParameter(Part_1_doc, "Shift", "5")
+model.addParameter(Part_1_doc, "Shift", "12")
Box_1 = model.addBox(Part_1_doc, "L", "L", "L")
-Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Bottom"), "Shift", True)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Bottom"), "L/2", True)
Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
SketchPoint_1 = SketchProjection_1.createdFeature()
SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_1.endPoint())
SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_1.result())
SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "L+Shift/2")
-SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_2.startPoint(), -5)
+SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_2.startPoint(), "-Shift/3")
SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_3.startPoint(), "Shift", True)
model.do()
-Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), "Shift", True)
+Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), "Shift/3", True)
Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchLine_2f-SketchLine_3f")])
Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Boolean_1_1_2"), model.selection("FACE", "Boolean_1_1_1")])
Boolean_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("SHELL", "Shell_1_1")])
model.do()
-model.checkBooleansResult(Boolean_2, model, 1, [0], [1], [9], [46], [92])
+model.checkBooleansResult(Boolean_2, model, 1, [2], [2], [14], [60], [120])
model.testHaveNamingSubshapes(Boolean_2, model, Part_1_doc)
model.end()
}
}
+// Keep only the shapes with minimal shape type
+static void keepTopLevelShapes(ListOfShape& theShapes)
+{
+ GeomAPI_Shape::ShapeType aKeepShapeType = GeomAPI_Shape::SHAPE;
+ ListOfShape::iterator anIt = theShapes.begin();
+ while (anIt != theShapes.end()) {
+ GeomAPI_Shape::ShapeType aType = (*anIt)->shapeType();
+ if (aType < aKeepShapeType) {
+ // found a shape with lesser shape type => remove all previous shapes
+ aKeepShapeType = aType;
+ theShapes.erase(theShapes.begin(), anIt);
+ ++anIt;
+ } else if (aType > aKeepShapeType) {
+ // shapes with greater shape type should be removed from the list
+ ListOfShape::iterator aRemoveIt = anIt++;
+ theShapes.erase(aRemoveIt);
+ } else
+ ++anIt;
+ }
+}
+
void Model_BodyBuilder::loadAndOrientModifiedShapes (
GeomAlgoAPI_MakeShape* theMS,
std::shared_ptr<GeomAPI_Shape> theShapeIn,
std::shared_ptr<GeomAPI_Shape> aRShape(new GeomAPI_Shape());
aRShape->setImpl((new TopoDS_Shape(aRoot)));
theMS->modified(aRShape, aList);
+ keepTopLevelShapes(aList);
// sort the list of images before naming
GeomAlgoAPI_SortListOfShapes::sort(aList);
}
}
-// Keep only the shapes with minimal shape type
-static void keepTopLevelShapes(ListOfShape& theShapes)
-{
- GeomAPI_Shape::ShapeType aKeepShapeType = GeomAPI_Shape::SHAPE;
- ListOfShape::iterator anIt = theShapes.begin();
- while (anIt != theShapes.end()) {
- GeomAPI_Shape::ShapeType aType = (*anIt)->shapeType();
- if (aType < aKeepShapeType) {
- // found a shape with lesser shape type => remove all previous shapes
- aKeepShapeType = aType;
- theShapes.erase(theShapes.begin(), anIt);
- ++anIt;
- } else if (aType > aKeepShapeType) {
- // shapes with greater shape type should be removed from the list
- ListOfShape::iterator aRemoveIt = anIt++;
- theShapes.erase(aRemoveIt);
- } else
- ++anIt;
- }
-}
-
void Model_BodyBuilder::loadAndOrientGeneratedShapes (
GeomAlgoAPI_MakeShape* theMS,
std::shared_ptr<GeomAPI_Shape> theShapeIn,