]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Extrusion: fix error with offset plane. Make Extrusion CUT and FUSE be able to be...
authorazv <azv@opencascade.com>
Mon, 16 Sep 2019 04:05:44 +0000 (07:05 +0300)
committerazv <azv@opencascade.com>
Mon, 23 Sep 2019 09:37:55 +0000 (12:37 +0300)
25 files changed:
src/FeaturesPlugin/CMakeLists.txt
src/FeaturesPlugin/Test/TestExtrusionCut_ByFaces.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestExtrusion_ByFaces01.py
src/FeaturesPlugin/Test/TestExtrusion_ByFaces02.py
src/FeaturesPlugin/Test/TestExtrusion_ByFaces03.py
src/FeaturesPlugin/Test/TestExtrusion_ByFaces04.py
src/FeaturesPlugin/Test/TestExtrusion_ByFaces05.py
src/FeaturesPlugin/Test/TestExtrusion_ByFaces06.py
src/FeaturesPlugin/Test/TestExtrusion_ByFaces07.py
src/FeaturesPlugin/Test/TestExtrusion_ByFaces08.py
src/FeaturesPlugin/Test/TestExtrusion_ByFaces09.py
src/FeaturesPlugin/Test/TestExtrusion_ByFaces10.py
src/FeaturesPlugin/Test/TestExtrusion_ByFaces11.py
src/FeaturesPlugin/Test/TestExtrusion_ByFaces12.py
src/FeaturesPlugin/Test/TestExtrusion_ByFaces13.py
src/FeaturesPlugin/Test/TestExtrusion_ByFaces14.py
src/FeaturesPlugin/Test/TestExtrusion_ByFaces15.py
src/FeaturesPlugin/Test/TestExtrusion_ByFaces16.py
src/FeaturesPlugin/Test/TestExtrusion_ByFaces17.py
src/FeaturesPlugin/Test/TestExtrusion_ByFaces18.py
src/FeaturesPlugin/Test/TestExtrusion_ByFaces19.py
src/FeaturesPlugin/extrusioncut_widget.xml
src/FeaturesPlugin/extrusionfuse_widget.xml
src/GeomAPI/GeomAPI_Face.cpp
src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp

index 8a255d67989029e88b305c38dc158307cc1fd45c..6bf8e45d5979995f7e2e184efec6dadfc349564d 100644 (file)
@@ -176,6 +176,7 @@ ADD_UNIT_TESTS(TestExtrusion.py
                TestExtrusionCut.py
                TestExtrusionCut_BySize.py
                TestExtrusionCut_ByPlanesAndOffsets.py
+               TestExtrusionCut_ByFaces.py
                TestExtrusionFuse.py
                TestExtrusionFuse_BySize.py
                TestExtrusionFuse_ByPlanesAndOffsets.py
diff --git a/src/FeaturesPlugin/Test/TestExtrusionCut_ByFaces.py b/src/FeaturesPlugin/Test/TestExtrusionCut_ByFaces.py
new file mode 100644 (file)
index 0000000..ef51f27
--- /dev/null
@@ -0,0 +1,150 @@
+# 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())
index c7b08bb94c8f04bb1873e961276a486ebb98f7f8..11dcce3cb271367dfd4c8ca965ca3f68952b9906 100644 (file)
@@ -109,7 +109,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.FACE, [6])
 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])
@@ -117,7 +117,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.SOLID, [1])
 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])
index a55c34e6d5e845ebcbf66588b067ebb945f3985b..5444ef5c4e679f168463df4c205586cffc2ac5ad 100644 (file)
@@ -99,7 +99,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.FACE, [6])
 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])
@@ -107,7 +107,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.SOLID, [1])
 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])
index 83608d6edb1a54a111fe1a3e7891e1c36d96f9da..af9a6c6a3868426d91ebb9f4b5d7dae1c3df027c 100644 (file)
@@ -129,7 +129,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [44])
 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])
@@ -137,7 +137,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.SOLID, [1])
 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])
index 7e8a0eb9dd1d21166b6f47640b26513f3c45b0d0..ef7c7113646ddd806d537609c80dbe126da6caee 100644 (file)
@@ -101,7 +101,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [44])
 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])
@@ -110,7 +110,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.FACE, [5])
 model.testResultsVolumes(Extrusion_1, [179594.5])
 
 # check failure
-ParamFrom.setValue(20)
+ParamFrom.setValue(-20)
 model.do()
 assert(Extrusion_1.feature().error() != "")
 
index fff109f06d48d4d0ac1215572cef5e25402927a0..8715c1ecb4c5b1e8c65aa97b1269484393ac6b04 100644 (file)
@@ -134,7 +134,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [32])
 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])
@@ -144,7 +144,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.EDGE, [20])
 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])
index 095c967961856fff1d6bfd0413ebf733773701b4..0fd7070e75f73e5e313700e28d503c3090a87026 100644 (file)
@@ -92,7 +92,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [40])
 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])
@@ -100,7 +100,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.SOLID, [1])
 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])
index 0318fcd138768ccb9cdaf8f3fb93332f67316356..a3bbdee05b24269a138caaafa019b81235b7b698 100644 (file)
@@ -120,7 +120,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [96])
 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])
@@ -128,7 +128,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.SOLID, [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])
index 18ce0b44265352e0b8206a3f73444db43dc004a5..72726ad98c03ce06cfba1386d361a592ad4a47cd 100644 (file)
@@ -104,7 +104,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.FACE, [12])
 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])
@@ -112,7 +112,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.SOLID, [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])
index da81086add5b9c72e1b72de71ac58778c6828bbe..ada092a9f12aca369d4399377a2eab28addcb5bc 100644 (file)
@@ -132,7 +132,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [68])
 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])
@@ -140,7 +140,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.SOLID, [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])
index e618ca61c61c4ba5b33210dce0731809ec1e5e58..024dd08aa2724944ec52100c2bfa55dd20f31d97 100644 (file)
@@ -105,7 +105,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [80])
 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])
@@ -114,7 +114,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.FACE, [10])
 model.testResultsVolumes(Extrusion_1, [179594.5])
 
 # check failure
-ParamFrom.setValue(20)
+ParamFrom.setValue(-20)
 model.do()
 assert(Extrusion_1.feature().error() != "")
 
index f66471f5b9cad72dce1552144e7b36d3f48c9aff..8156d5230a5c3f2b4200f5870e7cecbdc4d39087 100644 (file)
@@ -139,7 +139,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [128])
 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])
@@ -149,7 +149,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.EDGE, [68])
 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])
index 5473797ac507e17448bcabe0548ae9fa7165e448..7cf8233a6857598346ff74c35f6d23eff56e08f5 100644 (file)
@@ -97,7 +97,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [64])
 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])
@@ -105,7 +105,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.SOLID, [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])
index 710db14d5cce9819c5c271a818b3db5b72a0a204..3575f1bb70d366715b27f052b1e0853891bd7aa5 100644 (file)
@@ -101,7 +101,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [8, 8, 8, 8])
 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])
@@ -111,7 +111,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.EDGE, [4, 4, 4, 4])
 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])
index 7f8348c69a4e7450c1e7a18e4a9351a7f454f386..21789d9a81e9b83a7e1fe2057e2202c85b4c60f1 100644 (file)
@@ -102,7 +102,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [8, 8, 8, 8])
 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])
@@ -112,7 +112,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.EDGE, [4, 4, 4, 4])
 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])
index a65ebacdabf8e5b2bddc93cfd9bf57057de06286..edb34500c16e653a6933e44133c057c0501d9b98 100644 (file)
@@ -138,7 +138,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [8, 8, 12])
 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])
@@ -148,7 +148,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.EDGE, [4, 4, 6])
 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])
index bd18ce050afe624ae37f1aea9f085aedf88d4a8f..8436dbc9db9daa39b7254e00074be2ba2ab3a163 100644 (file)
@@ -104,7 +104,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [8, 8, 12])
 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])
@@ -115,12 +115,12 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [8, 8, 12])
 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])
index fd8effa219c1cca396c582d939c57c50a9477658..3ec3accb85a9f6bd20b3f9ca78ed54d5c964ba3f 100644 (file)
@@ -135,7 +135,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [20])
 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])
@@ -145,7 +145,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.EDGE, [12])
 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])
index 2edfe7af7b373dad7c0677e7512b67d3fb160caf..8e86fe8590596adf84c39340b7188d94a0b269da 100644 (file)
@@ -97,7 +97,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [8, 8, 10])
 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])
@@ -105,7 +105,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.SOLID, [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])
index 68584bc5c719c5177c89c9088e099b1045f6e8fa..9abd1ca358c22a1dec5231e35c9d9250d9892f48 100644 (file)
@@ -117,7 +117,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [32])
 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])
@@ -127,7 +127,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.EDGE, [16])
 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])
index 96079ccbd281a6b1de39bc7de8417fa733c58224..dc6c9539ed40af62b85da70d3c8502604afca52c 100644 (file)
           </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="&lt;base sketch&gt;">
-            <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="&lt;base sketch&gt;">
-            <validator id="GeomValidators_Face" parameters="plane"/>
+            <validator id="FeaturesPlugin_ValidatorExtrusionBoundary"/>
           </shape_selector>
           <doublevalue  id="to_offset"
             label="Offset" step="1.0" default="0"
index 80082d14ec637dc2c0b1ccebc6d0c205ef33dea1..c5bc4cf34ca8ca7d3ab4098d861be0e774df920e 100644 (file)
           </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="&lt;base sketch&gt;">
-            <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="&lt;base sketch&gt;">
-            <validator id="GeomValidators_Face" parameters="plane"/>
+            <validator id="FeaturesPlugin_ValidatorExtrusionBoundary"/>
           </shape_selector>
           <doublevalue  id="to_offset"
             label="Offset" step="1.0" default="0"
index bb907330c08eb1fd1b2ccea4d2451a8ad2865d99..4af6f9fb10db5a3749e0c9242a87c7bf34be3d87 100644 (file)
@@ -37,6 +37,8 @@
 #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>
@@ -203,20 +205,35 @@ std::shared_ptr<GeomAPI_Pln> GeomAPI_Face::getPlane() const
   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;
 }
 
index cc1ff67b2f6b7e041338607ae48be3c40c1048fb..a4b9d1b3fff9c305a2ea991104a2d958db53a6b7 100644 (file)
@@ -537,7 +537,7 @@ void GeomAlgoAPI_Prism::buildByFaces(const GeomShapePtr             theBaseShape
   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.