TestExtrusionCut.py
TestExtrusionCut_BySize.py
TestExtrusionCut_ByPlanesAndOffsets.py
+ TestExtrusionCut_ByFaces.py
TestExtrusionFuse.py
TestExtrusionFuse_BySize.py
TestExtrusionFuse_ByPlanesAndOffsets.py
--- /dev/null
+# Copyright (C) 2014-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
+
+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(25, 0, 0, 0)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchPoint_1.result())
+SketchLine_2 = Sketch_1.addLine(0, 0, 0, 200)
+SketchLine_3 = Sketch_1.addLine(0, 200, 25, 200)
+SketchLine_3.setAuxiliary(True)
+SketchLine_4 = Sketch_1.addLine(25, 200, 25, 0)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 200)
+SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_1.result(), 25)
+SketchLine_5 = Sketch_1.addLine(125, 243.301270189222, -25, 243.3012701892219)
+SketchLine_5.setAuxiliary(True)
+SketchLine_6 = Sketch_1.addLine(-25, 243.3012701892219, 0, 200)
+SketchLine_6.setAuxiliary(True)
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_6.endPoint())
+SketchLine_7 = Sketch_1.addLine(0, 200, 0, 350)
+SketchLine_7.setAuxiliary(True)
+SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_7.startPoint())
+SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_5.result())
+SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_5.result(), SketchLine_7.result())
+SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_7.result(), SketchLine_6.result(), 30)
+SketchLine_8 = Sketch_1.addLine(-25, 243.3012701892219, 29.37846722219903, 268.6583658936639)
+SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_8.startPoint())
+SketchLine_9 = Sketch_1.addLine(29.37846722219903, 268.6583658936639, 14.58682806127452, 300.3791384399466)
+SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
+SketchConstraintPerpendicular_2 = Sketch_1.setPerpendicular(SketchLine_8.result(), SketchLine_9.result())
+SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_6.result(), 50)
+SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_8.result(), 60)
+SketchConstraintAngle_2 = Sketch_1.setAngle(SketchLine_5.result(), SketchLine_8.result(), 25)
+SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_9.result(), 35)
+SketchLine_10 = Sketch_1.addLine(23.03919329608853, 282.2529826992136, 36.18065620811996, 288.3809474944538)
+SketchLine_10.setAuxiliary(True)
+SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_10.startPoint(), SketchLine_9.result())
+SketchLine_11 = Sketch_1.addLine(36.18065620811996, 288.3809474944538, 48.85920406034094, 261.1917138833543)
+SketchLine_11.setAuxiliary(True)
+SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint())
+SketchConstraintPerpendicular_3 = Sketch_1.setPerpendicular(SketchLine_10.result(), SketchLine_11.result())
+SketchConstraintPerpendicular_4 = Sketch_1.setPerpendicular(SketchLine_9.result(), SketchLine_10.result())
+SketchConstraintLength_6 = Sketch_1.setLength(SketchLine_11.result(), 30)
+SketchConstraintLength_7 = Sketch_1.setLength(SketchLine_10.result(), 14.5)
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_9.endPoint(), SketchLine_10.startPoint(), 20, True)
+SketchArc_1 = Sketch_1.addArc(4.697206021778518, 257.149304782984, 14.58682806127452, 300.3791384399466, 48.85920406034094, 261.1917138833543, True)
+SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchArc_1.startPoint())
+SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchArc_1.endPoint())
+SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchArc_1.results()[1])
+SketchArc_2 = Sketch_1.addArc(0.1512256873309691, 256.7331845326764, 48.85920406034094, 261.1917138833543, 34.14802119649147, 221.5683791690064, True)
+SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchArc_2.startPoint())
+SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchArc_1.results()[1])
+SketchArc_3 = Sketch_1.addArc(-71.98457930083825, 187.3071972226404, 0, 200, -25, 243.3012701892219, False)
+SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchArc_3.startPoint())
+SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchArc_3.endPoint())
+SketchLine_12 = Sketch_1.addLine(-25, 243.301270189222, 0, 222.3237794097899)
+SketchLine_12.setAuxiliary(True)
+SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_12.startPoint())
+SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_7.result())
+SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_12.result())
+SketchConstraintAngle_3 = Sketch_1.setAngle(SketchLine_6.result(), SketchLine_12.result(), 20)
+SketchArc_4 = Sketch_1.addArc(55, 200, 34.14802119649147, 221.5683791690064, 25, 200, False)
+SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchArc_4.startPoint())
+SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchArc_4.results()[1])
+SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_4.startPoint())
+SketchConstraintTangent_4 = Sketch_1.setTangent(SketchLine_4.result(), SketchArc_4.results()[1])
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_4.results()[1], 30)
+SketchLine_13 = Sketch_1.addLine(-7.179200577043265, 240.5774662449659, 15.47849409887298, 251.1429227884834)
+SketchLine_14 = Sketch_1.addLine(15.47849409887298, 251.1429227884834, 26.04395064239047, 228.4852281125672)
+SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint())
+SketchLine_15 = Sketch_1.addLine(26.04395064239047, 228.4852281125672, 3.386255966474217, 217.9197715690497)
+SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint())
+SketchLine_16 = Sketch_1.addLine(3.386255966474217, 217.9197715690497, -7.179200577043265, 240.5774662449659)
+SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint())
+SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchLine_13.startPoint(), SketchLine_16.endPoint())
+SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_13.result(), SketchLine_15.result())
+SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_16.result(), SketchLine_14.result())
+SketchConstraintPerpendicular_5 = Sketch_1.setPerpendicular(SketchLine_13.result(), SketchLine_14.result())
+SketchConstraintParallel_3 = Sketch_1.setParallel(SketchLine_13.result(), SketchLine_8.result())
+SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_15.result(), SketchLine_14.result())
+SketchConstraintLength_8 = Sketch_1.setLength(SketchLine_13.result(), 25)
+SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_8.result(), SketchLine_16.endPoint(), 10, True)
+SketchConstraintDistance_3 = Sketch_1.setDistance(SketchArc_3.endPoint(), SketchLine_16.result(), 15, True)
+SketchConstraintLength_9 = Sketch_1.setLength(SketchLine_5.result(), 150)
+SketchConstraintLength_10 = Sketch_1.setLength(SketchLine_7.result(), 150)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchArc_4_2r-SketchArc_2_2f-SketchArc_1_2f-SketchLine_9r-SketchLine_8r-SketchArc_3_2r-SketchLine_2r-SketchLine_1r-SketchLine_13f-SketchLine_14f-SketchLine_15f-SketchLine_16f")], model.selection(), 10, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_14"))
+SketchLine_17 = Sketch_2.addLine(-221.0712923119171, 10, -196.0712923119172, 0)
+SketchLine_17.setAuxiliary(True)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_13][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_14][Extrusion_1_1/To_Face]"), False)
+SketchPoint_2 = SketchProjection_2.createdFeature()
+SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchLine_17.startPoint(), SketchPoint_2.result())
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_14][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_15][Extrusion_1_1/From_Face]"), False)
+SketchPoint_3 = SketchProjection_3.createdFeature()
+SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchLine_17.endPoint(), SketchPoint_3.result())
+SketchCircle_1 = Sketch_2.addCircle(-208.5712923119172, 5, 4)
+SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchLine_17.result(), SketchCircle_1.center())
+SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint(SketchCircle_1.center(), SketchLine_17.result())
+SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_1.results()[1], 4)
+model.do()
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2f_wire")], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_3_2"), 0, model.selection(), 5, [model.selection("SOLID", "Extrusion_1_1")])
+model.do()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(ExtrusionCut_1, 1)
+model.testNbSubResults(ExtrusionCut_1, [0])
+model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.FACE, [18])
+model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.EDGE, [90])
+model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.VERTEX, [180])
+model.testResultsVolumes(ExtrusionCut_1, [78707.15553129233])
+
+model.testHaveNamingSubshapes(ExtrusionCut_1, model, Part_1_doc)
+
+model.end()
+
+assert(model.checkPythonDump())
model.testResultsVolumes(Extrusion_1, [57985.85])
# offset "From" face
-ParamFrom.setValue(-20)
+ParamFrom.setValue(20)
model.do()
model.testNbResults(Extrusion_1, 1)
model.testNbSubResults(Extrusion_1, [0])
model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.FACE, [6])
model.testResultsVolumes(Extrusion_1, [37985.85])
-ParamFrom.setValue(20)
+ParamFrom.setValue(-20)
model.do()
model.testNbResults(Extrusion_1, 1)
model.testNbSubResults(Extrusion_1, [0])
model.testResultsVolumes(Extrusion_1, [107985.85])
# offset "From" face
-ParamFrom.setValue(-20)
+ParamFrom.setValue(20)
model.do()
model.testNbResults(Extrusion_1, 1)
model.testNbSubResults(Extrusion_1, [0])
model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.FACE, [6])
model.testResultsVolumes(Extrusion_1, [87985.85])
-ParamFrom.setValue(20)
+ParamFrom.setValue(-20)
model.do()
model.testNbResults(Extrusion_1, 1)
model.testNbSubResults(Extrusion_1, [0])
model.testResultsVolumes(Extrusion_1, [119535.04])
# offset "From" face
-ParamFrom.setValue(-20)
+ParamFrom.setValue(20)
model.do()
model.testNbResults(Extrusion_1, 1)
model.testNbSubResults(Extrusion_1, [0])
model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.FACE, [5])
model.testResultsVolumes(Extrusion_1, [84126.377])
-ParamFrom.setValue(20)
+ParamFrom.setValue(-20)
model.do()
model.testNbResults(Extrusion_1, 1)
model.testNbSubResults(Extrusion_1, [0])
model.testResultsVolumes(Extrusion_1, [105008.93])
# offset "From" face
-ParamFrom.setValue(-20)
+ParamFrom.setValue(20)
model.do()
model.testNbResults(Extrusion_1, 1)
model.testNbSubResults(Extrusion_1, [0])
model.testResultsVolumes(Extrusion_1, [179594.5])
# check failure
-ParamFrom.setValue(20)
+ParamFrom.setValue(-20)
model.do()
assert(Extrusion_1.feature().error() != "")
model.testResultsVolumes(Extrusion_1, [7626.2279286])
# offset "From" face
-ParamFrom.setValue(-20)
+ParamFrom.setValue(20)
model.do()
model.testNbResults(Extrusion_1, 1)
model.testNbSubResults(Extrusion_1, [2])
model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [40])
model.testResultsVolumes(Extrusion_1, [21514.8965])
-ParamFrom.setValue(20)
+ParamFrom.setValue(-20)
model.do()
model.testNbResults(Extrusion_1, 1)
model.testNbSubResults(Extrusion_1, [2])
model.testResultsVolumes(Extrusion_1, [31501.9671234])
# offset "From" face
-ParamFrom.setValue(-20)
+ParamFrom.setValue(20)
model.do()
model.testNbResults(Extrusion_1, 1)
model.testNbSubResults(Extrusion_1, [0])
model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.FACE, [5])
model.testResultsVolumes(Extrusion_1, [18737.752452])
-ParamFrom.setValue(20)
+ParamFrom.setValue(-20)
model.do()
model.testNbResults(Extrusion_1, 1)
model.testNbSubResults(Extrusion_1, [0])
model.testResultsVolumes(Extrusion_1, [57985.85])
# offset "From" face
-ParamFrom.setValue(-20)
+ParamFrom.setValue(20)
model.do()
model.testNbResults(Extrusion_1, 1)
model.testNbSubResults(Extrusion_1, [2])
model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.FACE, [12])
model.testResultsVolumes(Extrusion_1, [37985.85])
-ParamFrom.setValue(20)
+ParamFrom.setValue(-20)
model.do()
model.testNbResults(Extrusion_1, 1)
model.testNbSubResults(Extrusion_1, [2])
model.testResultsVolumes(Extrusion_1, [107985.85])
# offset "From" face
-ParamFrom.setValue(-20)
+ParamFrom.setValue(20)
model.do()
model.testNbResults(Extrusion_1, 1)
model.testNbSubResults(Extrusion_1, [2])
model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.FACE, [12])
model.testResultsVolumes(Extrusion_1, [87985.85])
-ParamFrom.setValue(20)
+ParamFrom.setValue(-20)
model.do()
model.testNbResults(Extrusion_1, 1)
model.testNbSubResults(Extrusion_1, [2])
model.testResultsVolumes(Extrusion_1, [119535.04])
# offset "From" face
-ParamFrom.setValue(-20)
+ParamFrom.setValue(20)
model.do()
model.testNbResults(Extrusion_1, 1)
model.testNbSubResults(Extrusion_1, [2])
model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.FACE, [9])
model.testResultsVolumes(Extrusion_1, [84126.377])
-ParamFrom.setValue(20)
+ParamFrom.setValue(-20)
model.do()
model.testNbResults(Extrusion_1, 1)
model.testNbSubResults(Extrusion_1, [2])
model.testResultsVolumes(Extrusion_1, [105008.93])
# offset "From" face
-ParamFrom.setValue(-20)
+ParamFrom.setValue(20)
model.do()
model.testNbResults(Extrusion_1, 1)
model.testNbSubResults(Extrusion_1, [2])
model.testResultsVolumes(Extrusion_1, [179594.5])
# check failure
-ParamFrom.setValue(20)
+ParamFrom.setValue(-20)
model.do()
assert(Extrusion_1.feature().error() != "")
model.testResultsVolumes(Extrusion_1, [7626.2279286])
# offset "From" face
-ParamFrom.setValue(-20)
+ParamFrom.setValue(20)
model.do()
model.testNbResults(Extrusion_1, 1)
model.testNbSubResults(Extrusion_1, [2])
model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [136])
model.testResultsVolumes(Extrusion_1, [21514.8965])
-ParamFrom.setValue(20)
+ParamFrom.setValue(-20)
model.do()
model.testNbResults(Extrusion_1, 1)
model.testNbSubResults(Extrusion_1, [2])
model.testResultsVolumes(Extrusion_1, [31501.9671234])
# offset "From" face
-ParamFrom.setValue(-20)
+ParamFrom.setValue(20)
model.do()
model.testNbResults(Extrusion_1, 1)
model.testNbSubResults(Extrusion_1, [2])
model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.FACE, [9])
model.testResultsVolumes(Extrusion_1, [18737.752452])
-ParamFrom.setValue(20)
+ParamFrom.setValue(-20)
model.do()
model.testNbResults(Extrusion_1, 1)
model.testNbSubResults(Extrusion_1, [2])
model.testResultsVolumes(Extrusion_1, [2899.292521, 1039.2304845, 2899.292521, 1131.3708499])
# offset "From" face
-ParamFrom.setValue(-20)
+ParamFrom.setValue(20)
model.do()
model.testNbResults(Extrusion_1, 4)
model.testNbSubResults(Extrusion_1, [0, 0, 0, 0])
model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [8, 8, 8, 8])
model.testResultsVolumes(Extrusion_1, [3899.292521, 1439.2304845, 3899.292521, 1531.3708499])
-ParamFrom.setValue(20)
+ParamFrom.setValue(-20)
model.do()
model.testNbResults(Extrusion_1, 4)
model.testNbSubResults(Extrusion_1, [0, 0, 0, 0])
model.testResultsVolumes(Extrusion_1, [5399.2925211, 2039.2304845, 5399.2925212, 2131.37085])
# offset "From" face
-ParamFrom.setValue(-20)
+ParamFrom.setValue(20)
model.do()
model.testNbResults(Extrusion_1, 4)
model.testNbSubResults(Extrusion_1, [0, 0, 0, 0])
model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [8, 8, 8, 8])
model.testResultsVolumes(Extrusion_1, [6399.2925211, 2439.2304845, 6399.2925212, 2531.37085])
-ParamFrom.setValue(20)
+ParamFrom.setValue(-20)
model.do()
model.testNbResults(Extrusion_1, 4)
model.testNbSubResults(Extrusion_1, [0, 0, 0, 0])
model.testResultsVolumes(Extrusion_1, [2295.81450653, 2295.81450653, 5527.16645028])
# offset "From" face
-ParamFrom.setValue(-20)
+ParamFrom.setValue(20)
model.do()
model.testNbResults(Extrusion_1, 3)
model.testNbSubResults(Extrusion_1, [0, 0, 0])
model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [8, 8, 12])
model.testResultsVolumes(Extrusion_1, [1595.81450653, 1595.81450653, 3814.47306888])
-ParamFrom.setValue(20)
+ParamFrom.setValue(-20)
model.do()
model.testNbResults(Extrusion_1, 3)
model.testNbSubResults(Extrusion_1, [0, 0, 0])
model.testResultsVolumes(Extrusion_1, [1708.843326299, 1708.843325768, 1895.559443038])
# offset "From" face
-ParamFrom.setValue(-20)
+ParamFrom.setValue(20)
model.do()
model.testNbResults(Extrusion_1, 3)
model.testNbSubResults(Extrusion_1, [0, 0, 0])
model.testResultsVolumes(Extrusion_1, [2915.069101129, 2915.069100598, 4138.27332218])
# check failure
-ParamFrom.setValue(20)
+ParamFrom.setValue(-20)
model.do()
assert(Extrusion_1.feature().error() != "")
# revert failure
-ParamFrom.setValue(10)
+ParamFrom.setValue(-10)
model.do()
model.testNbResults(Extrusion_1, 3)
model.testNbSubResults(Extrusion_1, [0, 0, 0])
model.testResultsVolumes(Extrusion_1, [1504.36096473])
# offset "From" face
-ParamFrom.setValue(-20)
+ParamFrom.setValue(20)
model.do()
model.testNbResults(Extrusion_1, 1)
model.testNbSubResults(Extrusion_1, [2])
model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [24])
model.testResultsVolumes(Extrusion_1, [4336.142699])
-ParamFrom.setValue(20)
+ParamFrom.setValue(-20)
model.do()
model.testNbResults(Extrusion_1, 1)
model.testNbSubResults(Extrusion_1, [2])
model.testResultsVolumes(Extrusion_1, [1314.8586588, 1022.169915122, 2601.32913399])
# offset "From" face
-ParamFrom.setValue(-20)
+ParamFrom.setValue(20)
model.do()
model.testNbResults(Extrusion_1, 3)
model.testNbSubResults(Extrusion_1, [0, 0, 0])
model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.FACE, [1, 1, 1])
model.testResultsVolumes(Extrusion_1, [825.71966141, 533.030917699, 1551.6191757579])
-ParamFrom.setValue(20)
+ParamFrom.setValue(-20)
model.do()
model.testNbResults(Extrusion_1, 3)
model.testNbSubResults(Extrusion_1, [0, 0, 0])
model.testResultsVolumes(Extrusion_1, [7969.186376787])
# offset "From" face
-ParamFrom.setValue(-20)
+ParamFrom.setValue(20)
model.do()
model.testNbResults(Extrusion_1, 1)
model.testNbSubResults(Extrusion_1, [0])
model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [32])
model.testResultsVolumes(Extrusion_1, [10769.186376787])
-ParamFrom.setValue(20)
+ParamFrom.setValue(-20)
model.do()
model.testNbResults(Extrusion_1, 1)
model.testNbSubResults(Extrusion_1, [0])
</doublevalue>
</groupbox>
</box>
- <box id="ByPlanesAndOffsets" title="By bounding planes and offsets" icon="icons/Features/plane_inverted_32x32.png">
+ <box id="ByPlanesAndOffsets" title="By bounding faces and offsets" icon="icons/Features/plane_inverted_32x32.png">
<groupbox title="From">
<shape_selector id="from_object"
icon="icons/Features/plane.png"
- label="Plane face"
- tooltip="Bounding plane (select a planar face)"
+ label="From face"
+ tooltip="From face"
shape_types="face"
geometrical_selection="true"
default="<base sketch>">
- <validator id="GeomValidators_Face" parameters="plane"/>
+ <validator id="FeaturesPlugin_ValidatorExtrusionBoundary"/>
</shape_selector>
<doublevalue id="from_offset"
label="Offset" step="1.0" default="0"
<groupbox title="To">
<shape_selector id="to_object"
icon="icons/Features/plane_inverted.png"
- label="Plane face"
- tooltip="Bounding plane (select a planar face)"
+ label="To face"
+ tooltip="To face"
shape_types="face"
geometrical_selection="true"
default="<base sketch>">
- <validator id="GeomValidators_Face" parameters="plane"/>
+ <validator id="FeaturesPlugin_ValidatorExtrusionBoundary"/>
</shape_selector>
<doublevalue id="to_offset"
label="Offset" step="1.0" default="0"
</doublevalue>
</groupbox>
</box>
- <box id="ByPlanesAndOffsets" title="By bounding planes and offsets" icon="icons/Features/plane_inverted_32x32.png">
+ <box id="ByPlanesAndOffsets" title="By bounding faces and offsets" icon="icons/Features/plane_inverted_32x32.png">
<groupbox title="From">
<shape_selector id="from_object"
icon="icons/Features/plane.png"
- label="Plane face"
- tooltip="Bounding plane (select a planar face)"
+ label="From face"
+ tooltip="From face"
shape_types="face"
geometrical_selection="true"
default="<base sketch>">
- <validator id="GeomValidators_Face" parameters="plane"/>
+ <validator id="FeaturesPlugin_ValidatorExtrusionBoundary"/>
</shape_selector>
<doublevalue id="from_offset"
label="Offset" step="1.0" default="0"
<groupbox title="To">
<shape_selector id="to_object"
icon="icons/Features/plane_inverted.png"
- label="Plane face"
- tooltip="Bounding plane (select a planar face)"
+ label="To face"
+ tooltip="To face"
shape_types="face"
geometrical_selection="true"
default="<base sketch>">
- <validator id="GeomValidators_Face" parameters="plane"/>
+ <validator id="FeaturesPlugin_ValidatorExtrusionBoundary"/>
</shape_selector>
<doublevalue id="to_offset"
label="Offset" step="1.0" default="0"
#include <Geom_SphericalSurface.hxx>
#include <Geom_ConicalSurface.hxx>
#include <Geom_CylindricalSurface.hxx>
+#include <Geom_OffsetSurface.hxx>
+#include <Geom_Plane.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
#include <Geom_SweptSurface.hxx>
#include <Geom_ToroidalSurface.hxx>
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
if (aSurf.IsNull())
return aResult; // no surface
- GeomLib_IsPlanarSurface isPlanar(aSurf);
- if(!isPlanar.IsPlanar()) {
- return aResult;
+ GeomLib_IsPlanarSurface isPlanarSurf(aSurf);
+ gp_Pln aPln;
+ bool isPlanar = false;
+ if (isPlanarSurf.IsPlanar()) {
+ aPln = isPlanarSurf.Plan();
+ isPlanar = true;
}
- gp_Pln aPln = isPlanar.Plan();
- double aA, aB, aC, aD;
- aPln.Coefficients(aA, aB, aC, aD);
- if (aFace.Orientation() == TopAbs_REVERSED) {
- aA = -aA;
- aB = -aB;
- aC = -aC;
- aD = -aD;
+ else if (aSurf->IsKind(STANDARD_TYPE(Geom_OffsetSurface))) {
+ Handle(Geom_OffsetSurface) anOffsetSurf = Handle(Geom_OffsetSurface)::DownCast(aSurf);
+ Handle(Geom_Surface) aBasisSurf = anOffsetSurf->BasisSurface();
+ if (aBasisSurf->IsKind(STANDARD_TYPE(Geom_Plane))) {
+ aPln = Handle(Geom_Plane)::DownCast(aBasisSurf)->Pln();
+ gp_Vec aTranslation(aPln.Axis().Direction().XYZ() * anOffsetSurf->Offset());
+ aPln.Translate(aTranslation);
+ isPlanar = true;
+ }
+ }
+
+ if (isPlanar) {
+ double aA, aB, aC, aD;
+ aPln.Coefficients(aA, aB, aC, aD);
+ if (aFace.Orientation() == TopAbs_REVERSED) {
+ aA = -aA;
+ aB = -aB;
+ aC = -aC;
+ aD = -aD;
+ }
+ aResult = std::shared_ptr<GeomAPI_Pln>(new GeomAPI_Pln(aA, aB, aC, aD));
}
- aResult = std::shared_ptr<GeomAPI_Pln>(new GeomAPI_Pln(aA, aB, aC, aD));
return aResult;
}
gp_Vec anExtVec = theDirection->impl<gp_Dir>();
// Moving prism bounding faces according to "from" and "to" sizes.
- GeomShapePtr aBoundingFromShape = buildOffset(theFromShape, theFromSize, theDirection, *this);
+ GeomShapePtr aBoundingFromShape = buildOffset(theFromShape, -theFromSize, theDirection, *this);
GeomShapePtr aBoundingToShape = buildOffset(theToShape, theToSize, theDirection, *this);
// Bounding box for shapes used in prism building.