]> SALOME platform Git repositories - modules/shaper.git/blob - src/GeomAPI/Test/TestCone.py
Salome HOME
[Code coverage GeomAPI]: Call methods related to GUI
[modules/shaper.git] / src / GeomAPI / Test / TestCone.py
1 ## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
2 ##
3 ## This library is free software; you can redistribute it and/or
4 ## modify it under the terms of the GNU Lesser General Public
5 ## License as published by the Free Software Foundation; either
6 ## version 2.1 of the License, or (at your option) any later version.
7 ##
8 ## This library is distributed in the hope that it will be useful,
9 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 ## Lesser General Public License for more details.
12 ##
13 ## You should have received a copy of the GNU Lesser General Public
14 ## License along with this library; if not, write to the Free Software
15 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 ##
17 ## See http:##www.salome-platform.org/ or
18 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 ##
20
21 from GeomAPI import *
22 from SketchAPI import *
23
24 from salome.shaper import model
25
26 import math
27
28 TOLERANCE = 1.e-7
29
30 def assertCircle(theEdge, theCenter, theRadius):
31     assert(theEdge.isCircle())
32     aCircle = theEdge.circle()
33     assert(aCircle.center().distance(theCenter) < TOLERANCE), "({}, {}, {}) != expected ({}, {}, {})".format(aCircle.center().x(), aCircle.center().y(), aCircle.center().z(), theCenter.x(), theCenter.y(), theCenter.z())
34     assert(math.fabs(aCircle.radius() - theRadius) < TOLERANCE), "Radius {} != {}".format(aCircle.radius(), theRadius)
35
36 def checkCircleEdge(theDocument, theEdgeName, theCenter, theRadius):
37     anEdge = model.addEdge(theDocument, [model.selection("EDGE", theEdgeName)])
38     aShape = anEdge.result().resultSubShapePair()[0].shape()
39     assert(aShape.isEdge())
40     assert(aShape.edge().isClosed())
41     assertCircle(aShape.edge(), theCenter, theRadius)
42     theDocument.removeFeature(anEdge.feature())
43
44 def checkCircleFace(theDocument, theFaceName, theCenter, theRadius):
45     aFaceFeature = model.addFace(theDocument, [model.selection("FACE", theFaceName)])
46     aShape = aFaceFeature.result().resultSubShapePair()[0].shape()
47     assert(aShape.isFace())
48     aFace = aShape.face();
49     aSubs = aFace.subShapes(GeomAPI.GeomAPI_Shape.EDGE)
50     assert(aSubs.size() == 1)
51     assertCircle(aSubs[0].edge(), theCenter, theRadius)
52     theDocument.removeFeature(aFaceFeature.feature())
53
54 def assertEllipse(theEdge, theFirstFocus, theSecondFocus, theMajorRadius, theMinorRadius, theNormal = None):
55     assert(theEdge.isEllipse())
56     anEllipse = theEdge.ellipse()
57     assert(anEllipse.firstFocus().distance(theFirstFocus) < TOLERANCE), "({}, {}, {}) != expected ({}, {}, {})".format(anEllipse.firstFocus().x(), anEllipse.firstFocus().y(), anEllipse.firstFocus().z(), theFirstFocus.x(), theFirstFocus.y(), theFirstFocus.z())
58     assert(anEllipse.secondFocus().distance(theSecondFocus) < TOLERANCE), "({}, {}, {}) != expected ({}, {}, {})".format(anEllipse.secondFocus().x(), anEllipse.secondFocus().y(), anEllipse.secondFocus().z(), theSecondFocus.x(), theSecondFocus.y(), theSecondFocus.z())
59     assert(math.fabs(anEllipse.majorRadius() - theMajorRadius) < TOLERANCE), "Major radius {} != {}".format(anEllipse.majorRadius(), theMajorRadius)
60     assert(math.fabs(anEllipse.minorRadius() - theMinorRadius) < TOLERANCE), "Minor radius {} != {}".format(anEllipse.minorRadius(), theMinorRadius)
61
62     center = GeomAPI.GeomAPI_Pnt((theFirstFocus.x() + theSecondFocus.x()) * 0.5, (theFirstFocus.y() + theSecondFocus.y()) * 0.5, (theFirstFocus.z() + theSecondFocus.z()) * 0.5)
63     assert(anEllipse.center().distance(center) < TOLERANCE), "({}, {}, {}) != expected ({}, {}, {})".format(anEllipse.center().x(), anEllipse.center().y(), anEllipse.center().z(), center.x(), center.y(), center.z())
64
65     if theNormal is not None:
66         assert(math.fabs(anEllipse.normal().dot(theNormal) - 1.) < TOLERANCE), "Normal ({}, {}, {}) != ({}, {}, {})".format(anEllipse.normal().x(), anEllipse.normal().y(), anEllipse.normal().z(), theNormal.x(), theNormal.y(), theNormal.z())
67
68 def checkEllipseEdge(theDocument, theEdgeName, theFirstFocus, theSecondFocus, theMajorRadius, theMinorRadius, theNormal):
69     anEdge = model.addEdge(theDocument, [model.selection("EDGE", theEdgeName)])
70     aShape = anEdge.result().resultSubShapePair()[0].shape()
71     assert(aShape.isEdge())
72     assertEllipse(aShape.edge(), theFirstFocus, theSecondFocus, theMajorRadius, theMinorRadius, theNormal)
73     theDocument.removeFeature(anEdge.feature())
74
75 def checkEllipseFace(theDocument, theFaceName, theFirstFocus, theSecondFocus, theMajorRadius, theMinorRadius):
76     aFaceFeature = model.addFace(theDocument, [model.selection("FACE", theFaceName)])
77     aShape = aFaceFeature.result().resultSubShapePair()[0].shape()
78     assert(aShape.isFace())
79     aFace = aShape.face();
80     aSubs = aFace.subShapes(GeomAPI.GeomAPI_Shape.EDGE)
81     assert(aSubs.size() == 1)
82     assertEllipse(aSubs[0].edge(), theFirstFocus, theSecondFocus, theMajorRadius, theMinorRadius)
83     theDocument.removeFeature(aFaceFeature.feature())
84
85 def assertCone(theCone, theApex, theAxis, theSemiAngle, theRadius1, theRadius2, theHeight):
86     assert(theCone is not None)
87     assert(theCone.isSemiInfinite() == False)
88     assert(theCone.isInfinite() == False)
89     anApex = theCone.apex()
90     anAxis = theCone.axis()
91     assert(anApex.distance(theApex) < TOLERANCE), "({}, {}, {}) != expected ({}, {}, {})".format(anApex.x(), anApex.y(), anApex.z(), theApex.x(), theApex.y(), theApex.z())
92     assert(anAxis.isParallel(theAxis, TOLERANCE)), "dir({}, {}, {}) is not parallel to dir({}, {}, {})".format(anAxis.x(), anAxis.y(), anAxis.z(), theAxis.x(), theAxis.y(), theAxis.z())
93     assert(math.fabs(theCone.semiAngle() - theSemiAngle) < TOLERANCE), "SemiAngle {} != {}".format(theCone.semiAngle(), theSemiAngle)
94     assert(math.fabs(theCone.radius1() - theRadius1) < TOLERANCE), "Radius1 {} != {}".format(theCone.radius1(), theRadius1)
95     assert(math.fabs(theCone.radius2() - theRadius2) < TOLERANCE), "Radius2 {} != {}".format(theCone.radius2(), theRadius2)
96     assert(math.fabs(theCone.height() - theHeight) < TOLERANCE), "Height {} != {}".format(theCone.height(), theHeight)
97
98 def checkConeFace(theDocument, theFaceName, theApex, theAxis, theSemiAngle, theRadius1, theRadius2, theHeight):
99     # check conical face
100     aFace = model.addFace(theDocument, [model.selection("FACE", theFaceName)])
101     aShape = aFace.result().resultSubShapePair()[0].shape()
102     assert(aShape.isFace())
103     assertCone(aShape.face().getCone(), theApex, theAxis, theSemiAngle, theRadius1, theRadius2, theHeight)
104     theDocument.removeFeature(aFace.feature())
105
106 def checkConeShell(theDocument, theFaceNames, theApex, theAxis, theSemiAngle, theRadius1, theRadius2, theHeight):
107     # check conical shell
108     aSelection = []
109     for name in theFaceNames:
110         aSelection.append(model.selection("FACE", name))
111     aShell = model.addShell(theDocument, aSelection)
112     aShape = aShell.result().resultSubShapePair()[0].shape()
113     assert(aShape.isShell())
114     assertCone(aShape.shell().getCone(), theApex, theAxis, theSemiAngle, theRadius1, theRadius2, theHeight)
115     theDocument.removeFeature(aShell.feature())
116
117 def checkConeSolid(theDocument, theFaceNames, theApex, theAxis, theSemiAngle, theRadius1, theRadius2, theHeight):
118     # check cone
119     aSelection = []
120     for name in theFaceNames:
121         aSelection.append(model.selection("FACE", name))
122     aSolid = model.addSolid(theDocument, aSelection)
123     aShape = aSolid.result().resultSubShapePair()[0].shape()
124     assert(aShape.isSolid())
125     assertCone(aShape.solid().getCone(), theApex, theAxis, theSemiAngle, theRadius1, theRadius2, theHeight)
126     theDocument.removeFeature(aSolid.feature())
127
128 def checkConeAll(theDocument, theFeature, theFaceName, theApex, theAxis, theSemiAngle, theRadius1, theRadius2, theHeight):
129     # check solid
130     aShape = theFeature.result().resultSubShapePair()[0].shape()
131     assert(aShape.isSolid())
132     assertCone(aShape.solid().getCone(), theApex, theAxis, theSemiAngle, theRadius1, theRadius2, theHeight)
133
134     checkConeShell(theDocument, [theFaceName], theApex, theAxis, theSemiAngle, theRadius1, theRadius2, theHeight)
135     checkConeFace(theDocument, theFaceName, theApex, theAxis, theSemiAngle, theRadius1, theRadius2, theHeight)
136
137 def checkNonCone(theFeature):
138     aShape = theFeature.result().resultSubShapePair()[0].shape()
139     assert(aShape.isSolid())
140     assert(aShape.solid().getCone() is None)
141
142 def checkNonConeShell(theFeature):
143     aShape = theFeature.result().resultSubShapePair()[0].shape()
144     assert(aShape.isShell())
145     assert(aShape.shell().getCone() is None)
146
147 def checkSegment(theDocument, theEdgeName, theStartPoint, theEndPoint):
148     anEdgeFeature = model.addEdge(theDocument, [model.selection("EDGE", theEdgeName)])
149     aShape = anEdgeFeature.result().resultSubShapePair()[0].shape()
150     assert(aShape.isEdge())
151     anEdge = aShape.edge()
152     assert(anEdge.isLine())
153     assert(anEdge.firstPoint().distance(theStartPoint) < TOLERANCE)
154     assert(anEdge.lastPoint().distance(theEndPoint) < TOLERANCE)
155     theDocument.removeFeature(anEdgeFeature.feature())
156
157 def checkVertex(theDocument, theVertexName, theCoordinates):
158     aVertex = model.addVertex(theDocument, [model.selection("VERTEX", theVertexName)])
159     aShape = aVertex.result().resultSubShapePair()[0].shape()
160     assert(aShape.isVertex())
161     assert(aShape.vertex().point().distance(theCoordinates) < TOLERANCE)
162     theDocument.removeFeature(aVertex.feature())
163
164 def semiAngle(theRadius1, theRadius2, theHeight):
165     return math.atan(math.fabs(theRadius1 - theRadius2) / theHeight)
166
167
168 model.begin()
169 partSet = model.moduleDocument()
170 Part_1 = model.addPart(partSet)
171 Part_1_doc = Part_1.document()
172 ParamR1 = model.addParameter(Part_1_doc, "R1", "50")
173 ParamR2 = model.addParameter(Part_1_doc, "R2", "5")
174 ParamH = model.addParameter(Part_1_doc, "H", "70")
175 ParamShift = model.addParameter(Part_1_doc, "Shift", "5")
176 ParamAngle = model.addParameter(Part_1_doc, "Angle", "60")
177 Cone_1 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), "R1", "R2", "H")
178 model.do()
179
180 # Test 1. Check cone
181 aSemiAngle = semiAngle(ParamR1.value(), ParamR2.value(), ParamH.value())
182 anApex = GeomAPI.GeomAPI_Pnt(0, 0, ParamR1.value() / math.tan(aSemiAngle))
183 anAxis = GeomAPI.GeomAPI_Dir(0, 0, 1)
184 checkConeAll(Part_1_doc, Cone_1, "Cone_1_1/Face_1", anApex, anAxis, aSemiAngle, ParamR2.value(), ParamR1.value(), ParamH.value())
185 checkCircleFace(Part_1_doc, "Cone_1_1/Face_2", GeomAPI.GeomAPI_Pnt(0, 0, ParamH.value()), ParamR2.value())
186 checkCircleEdge(Part_1_doc, "[Cone_1_1/Face_1][Cone_1_1/Face_2]", GeomAPI.GeomAPI_Pnt(0, 0, ParamH.value()), ParamR2.value())
187 checkCircleFace(Part_1_doc, "Cone_1_1/Face_3", GeomAPI.GeomAPI_Pnt(0, 0, 0), ParamR1.value())
188 checkCircleEdge(Part_1_doc, "[Cone_1_1/Face_1][Cone_1_1/Face_3]", GeomAPI.GeomAPI_Pnt(0, 0, 0), ParamR1.value())
189 checkSegment(Part_1_doc, "[Cone_1_1/Face_1][weak_name_3]", GeomAPI.GeomAPI_Pnt(ParamR1.value(), 0, 0), GeomAPI.GeomAPI_Pnt(ParamR2.value(), 0, ParamH.value()))
190
191 # Test 2. Update cone radii
192 ParamR1.setValue(0)
193 model.do()
194 aSemiAngle = semiAngle(ParamR1.value(), ParamR2.value(), ParamH.value())
195 anApex.setZ(0)
196 checkConeAll(Part_1_doc, Cone_1, "Cone_1_1/Face_1", anApex, anAxis, aSemiAngle, ParamR1.value(), ParamR2.value(), ParamH.value())
197 checkCircleFace(Part_1_doc, "Cone_1_1/Face_2", GeomAPI.GeomAPI_Pnt(0, 0, ParamH.value()), ParamR2.value())
198 checkCircleEdge(Part_1_doc, "[Cone_1_1/Face_1][Cone_1_1/Face_2]", GeomAPI.GeomAPI_Pnt(0, 0, ParamH.value()), ParamR2.value())
199 checkSegment(Part_1_doc, "[Cone_1_1/Face_1][weak_name_3]", GeomAPI.GeomAPI_Pnt(0, 0, 0), GeomAPI.GeomAPI_Pnt(ParamR2.value(), 0, ParamH.value()))
200 checkVertex(Part_1_doc, "Cone_1_1/Vertex_2", GeomAPI.GeomAPI_Pnt(0, 0, 0))
201
202 ParamR2.setValue(50)
203 ParamR1.setValue(10)
204 model.do()
205 aSemiAngle = semiAngle(ParamR1.value(), ParamR2.value(), ParamH.value())
206 anApex.setZ(-ParamR1.value() / math.tan(aSemiAngle))
207 checkConeAll(Part_1_doc, Cone_1, "Cone_1_1/Face_1", anApex, anAxis, aSemiAngle, ParamR1.value(), ParamR2.value(), ParamH.value())
208 checkCircleFace(Part_1_doc, "Cone_1_1/Face_2", GeomAPI.GeomAPI_Pnt(0, 0, ParamH.value()), ParamR2.value())
209 checkCircleEdge(Part_1_doc, "[Cone_1_1/Face_1][Cone_1_1/Face_2]", GeomAPI.GeomAPI_Pnt(0, 0, ParamH.value()), ParamR2.value())
210 checkCircleFace(Part_1_doc, "Cone_1_1/Face_3", GeomAPI.GeomAPI_Pnt(0, 0, 0), ParamR1.value())
211 checkCircleEdge(Part_1_doc, "[Cone_1_1/Face_1][Cone_1_1/Face_3]", GeomAPI.GeomAPI_Pnt(0, 0, 0), ParamR1.value())
212 checkSegment(Part_1_doc, "[Cone_1_1/Face_1][weak_name_3]", GeomAPI.GeomAPI_Pnt(ParamR1.value(), 0, 0), GeomAPI.GeomAPI_Pnt(ParamR2.value(), 0, ParamH.value()))
213
214 # Test 3. Translate cone
215 Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cone_1_1")], model.selection("EDGE", "PartSet/OX"), "Shift")
216 anApex.setX(anApex.x() + ParamShift.value())
217 checkConeAll(Part_1_doc, Translation_1, "Translation_1_1/MF:Translated&Cone_1_1/Face_1", anApex, anAxis, aSemiAngle, ParamR1.value(), ParamR2.value(), ParamH.value())
218 checkCircleFace(Part_1_doc, "Translation_1_1/MF:Translated&Cone_1_1/Face_2", GeomAPI.GeomAPI_Pnt(ParamShift.value(), 0, ParamH.value()), ParamR2.value())
219 checkCircleEdge(Part_1_doc, "[Translation_1_1/MF:Translated&Cone_1_1/Face_1][Translation_1_1/MF:Translated&Cone_1_1/Face_2]", GeomAPI.GeomAPI_Pnt(ParamShift.value(), 0, ParamH.value()), ParamR2.value())
220 checkCircleFace(Part_1_doc, "Translation_1_1/MF:Translated&Cone_1_1/Face_3", GeomAPI.GeomAPI_Pnt(ParamShift.value(), 0, 0), ParamR1.value())
221 checkCircleEdge(Part_1_doc, "[Translation_1_1/MF:Translated&Cone_1_1/Face_1][Translation_1_1/MF:Translated&Cone_1_1/Face_3]", GeomAPI.GeomAPI_Pnt(ParamShift.value(), 0, 0), ParamR1.value())
222 checkSegment(Part_1_doc, "[Translation_1_1/MF:Translated&Cone_1_1/Face_1][weak_name_3]", GeomAPI.GeomAPI_Pnt(ParamR1.value() + ParamShift.value(), 0, 0), GeomAPI.GeomAPI_Pnt(ParamR2.value() + ParamShift.value(), 0, ParamH.value()))
223
224 # Test 4. Rotate cone
225 Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], model.selection("EDGE", "PartSet/OY"), "Angle")
226 anAngle = ParamAngle.value() * math.pi / 180.0
227 anAxis = GeomAPI.GeomAPI_Dir(math.sin(anAngle), 0, math.cos(anAngle))
228 x, z = anApex.x(), anApex.z()
229 anApex.setX(x * math.cos(anAngle) + z * math.sin(anAngle))
230 anApex.setZ(-x * math.sin(anAngle) + z * math.cos(anAngle))
231 checkConeAll(Part_1_doc, Rotation_1, "Rotation_1_1/MF:Rotated&Cone_1_1/Face_1", anApex, anAxis, aSemiAngle, ParamR1.value(), ParamR2.value(), ParamH.value())
232 aCenter = GeomAPI.GeomAPI_Pnt(ParamShift.value() * math.cos(anAngle) + ParamH.value() * math.sin(anAngle), 0, -ParamShift.value() * math.sin(anAngle) + ParamH.value() * math.cos(anAngle))
233 checkCircleFace(Part_1_doc, "Rotation_1_1/MF:Rotated&Cone_1_1/Face_2", aCenter, ParamR2.value())
234 checkCircleEdge(Part_1_doc, "[Rotation_1_1/MF:Rotated&Cone_1_1/Face_1][Rotation_1_1/MF:Rotated&Cone_1_1/Face_2]", aCenter, ParamR2.value())
235 aCenter = GeomAPI.GeomAPI_Pnt(ParamShift.value() * math.cos(anAngle), 0, -ParamShift.value() * math.sin(anAngle))
236 checkCircleFace(Part_1_doc, "Rotation_1_1/MF:Rotated&Cone_1_1/Face_3", aCenter, ParamR1.value())
237 checkCircleEdge(Part_1_doc, "[Rotation_1_1/MF:Rotated&Cone_1_1/Face_1][Rotation_1_1/MF:Rotated&Cone_1_1/Face_3]", aCenter, ParamR1.value())
238
239 # Test 5. Split cone by plane and check conical shell and elliptic face
240 Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), 20, False)
241 Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Rotation_1_1"), model.selection("FACE", "Plane_1")])
242 checkConeShell(Part_1_doc, ["Partition_1_1_1/Modified_Face&Cone_1_1/Face_1", "Partition_1_1_2/Modified_Face&Cone_1_1/Face_1"], anApex, anAxis, aSemiAngle, ParamR1.value(), ParamR2.value(), ParamH.value())
243
244 aFirstFocus = GeomAPI.GeomAPI_Pnt(20, 0, 31.062397266842858)
245 aSecondFocus = GeomAPI.GeomAPI_Pnt(20, 0, -1.0935246846933797)
246 aMajorRadius = 27.91915871311068
247 aMinorRadius = 22.824955511666207
248 aNormal = GeomAPI.GeomAPI_Dir(1, 0, 0)
249 checkEllipseFace(Part_1_doc, "_weak_name_1_Partition_1_1_2", aFirstFocus, aSecondFocus, aMajorRadius, aMinorRadius)
250 checkEllipseEdge(Part_1_doc, "Partition_1_1_1/Generated_Edge&Cone_1_1/Face_1", aFirstFocus, aSecondFocus, aMajorRadius, aMinorRadius, aNormal)
251
252 # Test 6. Compose a conical solid
253 Solid_1_objects = ["Rotation_1_1/MF:Rotated&Cone_1_1/Face_3",
254                    "Partition_1_1_1/Modified_Face&Cone_1_1/Face_1",
255                    "Partition_1_1_2/Modified_Face&Cone_1_1/Face_1",
256                    "Rotation_1_1/MF:Rotated&Cone_1_1/Face_2"]
257 checkConeSolid(Part_1_doc, Solid_1_objects, anApex, anAxis, aSemiAngle, ParamR1.value(), ParamR2.value(), ParamH.value())
258
259 # Test 7. Check non-cone
260 Cone_2 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 5, 10)
261 Cone_3 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10, 20)
262 Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Cone_2_1"), model.selection("SOLID", "Cone_3_1")], True)
263 Solid_2_objects = [model.selection("FACE", "Fuse_1_1/Modified_Face&Cone_2_1/Face_3&Cone_3_1/Face_3"),
264                    model.selection("FACE", "Fuse_1_1/Modified_Face&Cone_2_1/Face_1"),
265                    model.selection("FACE", "Fuse_1_1/Modified_Face&Cone_3_1/Face_1"),
266                    model.selection("FACE", "Cone_3_1/Face_2")]
267 Solid_2 = model.addSolid(Part_1_doc, Solid_2_objects)
268 checkNonCone(Solid_2)
269
270 # Test 8. Check non-conical shell
271 Shell_1_objects = [model.selection("FACE", "Rotation_1_1/MF:Rotated&Cone_1_1/Face_3"),
272                    model.selection("FACE", "Partition_1_1_1/Modified_Face&Cone_1_1/Face_1"),
273                    model.selection("FACE", "Partition_1_1_2/Modified_Face&Cone_1_1/Face_1"),
274                    model.selection("FACE", "Rotation_1_1/MF:Rotated&Cone_1_1/Face_2")]
275 Shell_1 = model.addShell(Part_1_doc, Shell_1_objects)
276 checkNonConeShell(Shell_1)
277
278 Shell_2 = model.addShell(Part_1_doc, [model.selection("FACE", "Fuse_1_1/Modified_Face&Cone_2_1/Face_1"), model.selection("FACE", "Fuse_1_1/Modified_Face&Cone_3_1/Face_1")])
279 checkNonConeShell(Shell_2)
280
281 # Test 9. Check error on conversion to wrong type of curve
282 anEdge = model.addEdge(Part_1_doc, [model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Cone_1_1/Face_1][Rotation_1_1/MF:Rotated&Cone_1_1/Face_2]")])
283 aShape = anEdge.result().resultSubShapePair()[0].shape()
284 assert(aShape.isEdge())
285 assert(aShape.edge().ellipse() is None)
286 assert(aShape.edge().line() is None)
287
288 anEdge = model.addEdge(Part_1_doc, [model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Cone_1_1/Face_1][weak_name_2]")])
289 aShape = anEdge.result().resultSubShapePair()[0].shape()
290 assert(aShape.isEdge())
291 assert(aShape.edge().circle() is None)
292
293 model.end()