]> SALOME platform Git repositories - modules/shaper.git/blob - src/SketchPlugin/Test/TestFilletInteracting.py
Salome HOME
Do not call model.checkPythonDump() in Fillet test cases until the Tangency constrain...
[modules/shaper.git] / src / SketchPlugin / Test / TestFilletInteracting.py
1 """
2     TestFilletInteracting.py
3     Unit test of SketchPlugin_Fillet feature.
4     In scope of interaction with another constraints applied to filleted features.
5 """
6
7 from GeomAPI import *
8 from GeomDataAPI import *
9 from ModelAPI import *
10 import math
11 import unittest
12 from salome.shaper import model
13
14 __updated__ = "2017-03-06"
15
16 def isArcLineSmooth(theArc, theLine, theTolerance):
17   aCenter = geomDataAPI_Point2D(theArc.attribute("ArcCenter"))
18   aDistance = distancePointLine(aCenter, theLine)
19   aRadius = arcRadius(theArc)
20   return math.fabs(aRadius - aDistance) < theTolerance
21
22 def isArcArcSmooth(theArc1, theArc2, theTolerance):
23   aCenter1 = geomDataAPI_Point2D(theArc1.attribute("ArcCenter"))
24   aCenter2 = geomDataAPI_Point2D(theArc2.attribute("ArcCenter"))
25   aDistance = distancePointPoint(aCenter1, aCenter2)
26   aRadius1 = arcRadius(theArc1)
27   aRadius2 = arcRadius(theArc2)
28   aRadSum = aRadius1 + aRadius2
29   aRadDiff = math.fabs(aRadius1 - aRadius2)
30   return math.fabs(aDistance - aRadSum) < theTolerance or math.fabs(aDistance - aRadDiff) < theTolerance
31
32 def arcRadius(theArc):
33   aCenter = geomDataAPI_Point2D(theArc.attribute("ArcCenter"))
34   aStart = geomDataAPI_Point2D(theArc.attribute("ArcStartPoint"))
35   return distancePointPoint(aCenter, aStart)
36
37 def distancePointPoint(thePoint1, thePoint2):
38   return math.hypot(thePoint1.x() - thePoint2.x(), thePoint1.y() - thePoint2.y())
39
40 def distancePointLine(thePoint, theLine):
41   aLineStart = geomDataAPI_Point2D(theLine.attribute("StartPoint"))
42   aLineEnd = geomDataAPI_Point2D(theLine.attribute("EndPoint"))
43   aLength = distancePointPoint(aLineStart, aLineEnd)
44   aDir1x, aDir1y = aLineEnd.x() - aLineStart.x(), aLineEnd.y() - aLineStart.y()
45   aDir2x, aDir2y = thePoint.x() - aLineStart.x(), thePoint.y() - aLineStart.y()
46   aCross = aDir1x * aDir2y - aDir1y * aDir2x
47   return math.fabs(aCross) / aLength
48
49
50
51 class TestFilletInteracting(unittest.TestCase):
52   def setUp(self):
53     model.begin()
54     self.myDocument = model.moduleDocument()
55     self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY"))
56     self.myTolerance = 1.e-6
57     self.myDOF = 0
58
59   def tearDown(self):
60     model.end()
61     # TODO: Revert commented line to check Python dump
62     #self.assertTrue(model.checkPythonDump())
63     model.reset()
64
65
66   def checkDOF(self):
67     self.assertEqual(model.dof(self.mySketch), self.myDOF)
68
69   def collectFeatures(self):
70     self.myFeatures = {}
71     for aSubObj in self.mySketch.features().list():
72       aFeature = ModelAPI.ModelAPI_Feature.feature(aSubObj)
73       if aFeature is not None:
74         if self.myFeatures.get(aFeature.getKind()) == None:
75           self.myFeatures[aFeature.getKind()] = 1
76         else:
77           self.myFeatures[aFeature.getKind()] += 1
78
79   def checkNbFeatures(self, theFeatureKind, theFeatureCount):
80     if theFeatureCount == 0:
81       self.assertIsNone(self.myFeatures.get(theFeatureKind))
82     else:
83       self.assertIsNotNone(self.myFeatures.get(theFeatureKind), "No features of kind {0} but expected {1}".format(theFeatureKind, theFeatureCount))
84       self.assertEqual(self.myFeatures[theFeatureKind], theFeatureCount, "Observed number of {0} is {1} but expected {2}".format(theFeatureKind, self.myFeatures[theFeatureKind], theFeatureCount))
85
86   def checkFillet(self):
87     aPtPtCoincidences = self.getCoincidences()
88     for coinc in aPtPtCoincidences:
89       aConnectedFeatures = self.connectedFeatures(coinc)
90       self.assertEqual(len(aConnectedFeatures), 2)
91       if aConnectedFeatures[0].getKind() == "SketchArc":
92         if aConnectedFeatures[1].getKind() == "SketchArc":
93           self.assertTrue(isArcArcSmooth(aConnectedFeatures[0], aConnectedFeatures[1], self.myTolerance))
94         elif aConnectedFeatures[1].getKind() == "SketchLine":
95           self.assertTrue(isArcLineSmooth(aConnectedFeatures[0], aConnectedFeatures[1], self.myTolerance))
96       elif aConnectedFeatures[0].getKind() == "SketchLine" and aConnectedFeatures[1].getKind() == "SketchArc":
97         self.assertTrue(isArcLineSmooth(aConnectedFeatures[1], aConnectedFeatures[0], self.myTolerance))
98
99   def getCoincidences(self):
100     aCoincidences = []
101     for aSubObj in self.mySketch.features().list():
102       aSubFeature = ModelAPI.ModelAPI_Feature.feature(aSubObj)
103       if aSubFeature is not None and aSubFeature.getKind() == "SketchConstraintCoincidence":
104         anEntityA = aSubFeature.refattr("ConstraintEntityA")
105         anEntityB = aSubFeature.refattr("ConstraintEntityB")
106         if not anEntityA.isObject() and not anEntityB.isObject():
107           aCoincidences.append(aSubFeature)
108     return aCoincidences
109
110   def connectedFeatures(self, theCoincidence):
111     anEntityA = theCoincidence.refattr("ConstraintEntityA")
112     anEntityB = theCoincidence.refattr("ConstraintEntityB")
113     aFeatureA = ModelAPI.ModelAPI_Feature.feature(anEntityA.attr().owner())
114     aFeatureB = ModelAPI.ModelAPI_Feature.feature(anEntityB.attr().owner())
115     return [aFeatureA, aFeatureB]
116
117
118   @unittest.expectedFailure
119   def test_fillet_two_lines(self):
120     """ Test 1. Fillet on two connected lines
121     """
122     aSketchLineA = self.mySketch.addLine(10., 10., 20., 10.)
123     aSketchLineB = self.mySketch.addLine(10., 10., 10., 20.)
124     self.myDOF += 8
125     self.checkDOF()
126     self.mySketch.setCoincident(aSketchLineA.startPoint(), aSketchLineB.startPoint())
127     self.myDOF -= 2
128     model.do()
129     self.checkDOF()
130     self.mySketch.setFillet(aSketchLineA.startPoint())
131     self.myDOF += 1
132     model.do()
133     self.checkFillet()
134     self.checkDOF()
135
136     self.collectFeatures()
137     self.checkNbFeatures("SketchLine", 2)
138     self.checkNbFeatures("SketchArc", 1)
139     self.checkNbFeatures("SketchConstraintCoincidence", 2)
140     self.checkNbFeatures("SketchConstraintTangent", 2)
141     self.checkNbFeatures("SketchFillet", 0)
142
143     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0])
144     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3])
145     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6])
146
147   def test_wrong_fillet_two_lines(self):
148     """ Test 2. Check the fillet is wrong on two connected lines when selecting incorrect point
149     """
150     aSketchLineA = self.mySketch.addLine(10., 10., 20., 10.)
151     aSketchLineB = self.mySketch.addLine(10., 10., 10., 20.)
152     self.myDOF += 8
153     self.checkDOF()
154     self.mySketch.setCoincident(aSketchLineA.startPoint(), aSketchLineB.startPoint())
155     self.myDOF -= 2
156     model.do()
157     self.checkDOF()
158     aFillet = self.mySketch.setFillet(aSketchLineA.endPoint())
159     model.do()
160     self.checkDOF()
161
162     self.collectFeatures()
163     self.checkNbFeatures("SketchLine", 2)
164     self.checkNbFeatures("SketchArc", 0) # no arcs should be created
165     self.checkNbFeatures("SketchConstraintCoincidence", 1) # number of coincidences should not change
166     self.checkNbFeatures("SketchConstraintTangent", 0) # no tangencies should not be created
167     self.checkNbFeatures("SketchFillet", 1) # fillet feature should still exist. it should be wrong
168
169     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0])
170     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [2])
171     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [4])
172
173     # remove fillet for correct python dump
174     self.myDocument.removeFeature(aFillet.feature())
175
176   @unittest.expectedFailure
177   def test_fillet_arc_line(self):
178     """ Test 3. Fillet on connected arc and line
179     """
180     aSketchLine = self.mySketch.addLine(10., 10., 20., 10.)
181     aSketchArc = self.mySketch.addArc(20., 10., 20., 20., 10., 10., False)
182     self.myDOF += 9
183     self.checkDOF()
184     self.mySketch.setCoincident(aSketchLine.startPoint(), aSketchArc.endPoint())
185     self.myDOF -= 2
186     model.do()
187     self.checkDOF()
188     self.mySketch.setFillet(aSketchLine.startPoint())
189     self.myDOF += 1
190     model.do()
191     self.checkFillet()
192     self.checkDOF()
193
194     self.collectFeatures()
195     self.checkNbFeatures("SketchLine", 1)
196     self.checkNbFeatures("SketchArc", 2)
197     self.checkNbFeatures("SketchConstraintCoincidence", 2)
198     self.checkNbFeatures("SketchConstraintTangent", 2)
199     self.checkNbFeatures("SketchFillet", 0)
200
201     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0])
202     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3])
203     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6])
204
205   @unittest.expectedFailure
206   def test_fillet_two_arcs(self):
207     """ Test 4. Fillet on two connected arcs
208     """
209     aSketchArc1 = self.mySketch.addArc(20., 0., 20., 20., 10., 17.32050807568877293, False)
210     aSketchArc2 = self.mySketch.addArc(20., 34.64101615137754586, 20., 14.64101615137754586, 10., 17.32050807568877293, True)
211     self.myDOF += 10
212     self.checkDOF()
213     self.mySketch.setCoincident(aSketchArc1.endPoint(), aSketchArc2.endPoint())
214     self.myDOF -= 2
215     model.do()
216     self.checkDOF()
217     self.mySketch.setFillet(aSketchArc1.endPoint())
218     self.myDOF += 1
219     model.do()
220     self.checkFillet()
221     self.checkDOF()
222
223     self.collectFeatures()
224     self.checkNbFeatures("SketchLine", 0)
225     self.checkNbFeatures("SketchArc", 3)
226     self.checkNbFeatures("SketchConstraintCoincidence", 2)
227     self.checkNbFeatures("SketchConstraintTangent", 2)
228     self.checkNbFeatures("SketchFillet", 0)
229
230     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0])
231     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3])
232     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6])
233
234   @unittest.expectedFailure
235   def test_fillet_with_horizontal_vertical(self):
236     """ Test 5. Fillet on two connected lines in case of Horizontal or Vertical constraints applied
237     """
238     aSketchLineA = self.mySketch.addLine(10., 10., 20., 10.)
239     aSketchLineB = self.mySketch.addLine(10., 10., 10., 20.)
240     self.myDOF += 8
241     self.checkDOF()
242     self.mySketch.setCoincident(aSketchLineA.startPoint(), aSketchLineB.startPoint())
243     self.myDOF -= 2
244     model.do()
245     self.checkDOF()
246     self.mySketch.setHorizontal(aSketchLineA.result())
247     self.mySketch.setVertical(aSketchLineB.result())
248     self.myDOF -= 2
249     model.do()
250     self.checkDOF()
251     self.mySketch.setFillet(aSketchLineA.startPoint())
252     self.myDOF += 1
253     model.do()
254     self.checkFillet()
255     self.checkDOF()
256
257     self.collectFeatures()
258     self.checkNbFeatures("SketchLine", 2)
259     self.checkNbFeatures("SketchArc", 1)
260     self.checkNbFeatures("SketchConstraintCoincidence", 2)
261     self.checkNbFeatures("SketchConstraintTangent", 2)
262     self.checkNbFeatures("SketchConstraintHorizontal", 1)
263     self.checkNbFeatures("SketchConstraintVertical", 1)
264     self.checkNbFeatures("SketchFillet", 0)
265
266     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0])
267     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3])
268     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6])
269
270   @unittest.expectedFailure
271   def test_fillet_with_orthogonal(self):
272     """ Test 6. Fillet on two connected lines in case of Perpendicular constraint applied
273     """
274     aSketchLineA = self.mySketch.addLine(10., 10., 20., 10.)
275     aSketchLineB = self.mySketch.addLine(10., 10., 10., 20.)
276     self.myDOF += 8
277     self.checkDOF()
278     self.mySketch.setCoincident(aSketchLineA.startPoint(), aSketchLineB.startPoint())
279     self.myDOF -= 2
280     model.do()
281     self.checkDOF()
282     self.mySketch.setPerpendicular(aSketchLineA.result(), aSketchLineB.result())
283     self.myDOF -= 1
284     model.do()
285     self.checkDOF()
286     self.mySketch.setFillet(aSketchLineA.startPoint())
287     self.myDOF += 1
288     model.do()
289     self.checkFillet()
290     self.checkDOF()
291
292     self.collectFeatures()
293     self.checkNbFeatures("SketchLine", 2)
294     self.checkNbFeatures("SketchArc", 1)
295     self.checkNbFeatures("SketchConstraintCoincidence", 2)
296     self.checkNbFeatures("SketchConstraintTangent", 2)
297     self.checkNbFeatures("SketchConstraintPerpendicular", 1)
298     self.checkNbFeatures("SketchFillet", 0)
299
300     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0])
301     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3])
302     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6])
303
304   @unittest.expectedFailure
305   def test_fillet_with_parallel(self):
306     """ Test 7. Fillet on two connected lines in case of Parallel constraint applied
307     """
308     aSketchLineA = self.mySketch.addLine(10., 10., 20., 10.)
309     aSketchLineB = self.mySketch.addLine(10., 10., 10., 20.)
310     self.myDOF += 8
311     self.checkDOF()
312     self.mySketch.setCoincident(aSketchLineA.startPoint(), aSketchLineB.startPoint())
313     self.myDOF -= 2
314     model.do()
315     self.checkDOF()
316     # third line to apply parallel constraint
317     aSketchLineC = self.mySketch.addLine(10., 0., 20., 5.)
318     self.myDOF += 4
319     self.mySketch.setParallel(aSketchLineB.result(), aSketchLineC.result())
320     self.myDOF -= 1
321     model.do()
322     self.checkDOF()
323     self.mySketch.setFillet(aSketchLineA.startPoint())
324     self.myDOF += 1
325     model.do()
326     self.checkFillet()
327     self.checkDOF()
328
329     self.collectFeatures()
330     self.checkNbFeatures("SketchLine", 3)
331     self.checkNbFeatures("SketchArc", 1)
332     self.checkNbFeatures("SketchConstraintCoincidence", 2)
333     self.checkNbFeatures("SketchConstraintTangent", 2)
334     self.checkNbFeatures("SketchConstraintParallel", 1)
335     self.checkNbFeatures("SketchFillet", 0)
336
337     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0])
338     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [4])
339     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [8])
340
341   @unittest.expectedFailure
342   def test_fillet_with_equal_lines(self):
343     """ Test 8. Fillet on two connected lines in case of Equal constraint applied
344     """
345     aSketchLineA = self.mySketch.addLine(10., 10., 20., 10.)
346     aSketchLineB = self.mySketch.addLine(10., 10., 10., 20.)
347     self.myDOF += 8
348     self.checkDOF()
349     self.mySketch.setCoincident(aSketchLineA.startPoint(), aSketchLineB.startPoint())
350     self.myDOF -= 2
351     model.do()
352     self.checkDOF()
353     self.mySketch.setEqual(aSketchLineA.result(), aSketchLineB.result())
354     self.myDOF -= 1
355     model.do()
356     self.checkDOF()
357     self.mySketch.setFillet(aSketchLineA.startPoint())
358     self.myDOF += 2
359     model.do()
360     self.checkFillet()
361     self.checkDOF()
362
363     self.collectFeatures()
364     self.checkNbFeatures("SketchLine", 2)
365     self.checkNbFeatures("SketchArc", 1)
366     self.checkNbFeatures("SketchConstraintCoincidence", 2)
367     self.checkNbFeatures("SketchConstraintTangent", 2)
368     self.checkNbFeatures("SketchConstraintEqual", 0) # Equal constraint expected to be removed
369     self.checkNbFeatures("SketchFillet", 0)
370
371     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0])
372     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3])
373     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6])
374
375   @unittest.expectedFailure
376   def test_fillet_with_equal_arcs(self):
377     """ Test 9. Fillet on two connected arcs in case of Equal constraint applied
378     """
379     aSketchArc1 = self.mySketch.addArc(20., 0., 20., 20., 10., 17.32050807568877293, False)
380     aSketchArc2 = self.mySketch.addArc(20., 34.64101615137754586, 20., 14.64101615137754586, 10., 17.32050807568877293, True)
381     self.myDOF += 10
382     self.checkDOF()
383     self.mySketch.setCoincident(aSketchArc1.endPoint(), aSketchArc2.endPoint())
384     self.myDOF -= 2
385     model.do()
386     self.checkDOF()
387     self.mySketch.setEqual(aSketchArc1.results()[1], aSketchArc2.results()[1])
388     self.myDOF -= 1
389     model.do()
390     self.checkDOF()
391     self.mySketch.setFillet(aSketchArc1.endPoint())
392     self.myDOF += 1
393     model.do()
394     self.checkFillet()
395     self.checkDOF()
396
397     self.collectFeatures()
398     self.checkNbFeatures("SketchLine", 0)
399     self.checkNbFeatures("SketchArc", 3)
400     self.checkNbFeatures("SketchConstraintCoincidence", 2)
401     self.checkNbFeatures("SketchConstraintTangent", 2)
402     self.checkNbFeatures("SketchConstraintEqual", 0) # Equal constraint expected to be removed
403     self.checkNbFeatures("SketchFillet", 0)
404
405     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0])
406     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3])
407     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6])
408
409   @unittest.expectedFailure
410   def test_fillet_with_length(self):
411     """ Test 10. Fillet on two connected lines in case of Length constraint applied
412     """
413     aSketchLineA = self.mySketch.addLine(10., 10., 20., 10.)
414     aSketchLineB = self.mySketch.addLine(10., 10., 10., 20.)
415     self.myDOF += 8
416     self.checkDOF()
417     self.mySketch.setCoincident(aSketchLineA.startPoint(), aSketchLineB.startPoint())
418     self.myDOF -= 2
419     model.do()
420     self.checkDOF()
421     self.mySketch.setLength(aSketchLineA.result(), 15.)
422     self.myDOF -= 1
423     model.do()
424     self.checkDOF()
425     self.mySketch.setFillet(aSketchLineA.startPoint())
426     self.myDOF += 2
427     model.do()
428     self.checkFillet()
429     self.checkDOF()
430
431     self.collectFeatures()
432     self.checkNbFeatures("SketchLine", 2)
433     self.checkNbFeatures("SketchArc", 1)
434     self.checkNbFeatures("SketchConstraintCoincidence", 2)
435     self.checkNbFeatures("SketchConstraintTangent", 2)
436     self.checkNbFeatures("SketchConstraintLength", 0) # Length constraint expected to be removed
437     self.checkNbFeatures("SketchFillet", 0)
438
439     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0])
440     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3])
441     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6])
442
443   @unittest.expectedFailure
444   def test_fillet_with_radius(self):
445     """ Test 11. Fillet on connected arc and line in case of Radius constraint is applied to arc
446     """
447     aSketchLine = self.mySketch.addLine(10., 10., 20., 10.)
448     aSketchArc = self.mySketch.addArc(0., 10., 0., 20., 10., 10., True)
449     self.myDOF += 9
450     self.checkDOF()
451     self.mySketch.setCoincident(aSketchLine.startPoint(), aSketchArc.endPoint())
452     self.myDOF -= 2
453     model.do()
454     self.checkDOF()
455     self.mySketch.setRadius(aSketchArc.results()[1], 12.)
456     self.myDOF -= 1
457     model.do()
458     self.checkDOF()
459     self.mySketch.setFillet(aSketchLine.startPoint())
460     self.myDOF += 1
461     model.do()
462     self.checkFillet()
463     self.checkDOF()
464
465     self.collectFeatures()
466     self.checkNbFeatures("SketchLine", 1)
467     self.checkNbFeatures("SketchArc", 2)
468     self.checkNbFeatures("SketchConstraintCoincidence", 2)
469     self.checkNbFeatures("SketchConstraintTangent", 2)
470     self.checkNbFeatures("SketchConstraintRadius", 1)
471     self.checkNbFeatures("SketchFillet", 0)
472
473     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0])
474     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3])
475     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6])
476
477   @unittest.expectedFailure
478   def test_fillet_with_distance(self):
479     """ Test 12. Fillet on two connected lines in case of Distance constraint applied
480     """
481     aSketchLineA = self.mySketch.addLine(10., 10., 20., 10.)
482     aSketchLineB = self.mySketch.addLine(10., 10., 10., 20.)
483     self.myDOF += 8
484     self.checkDOF()
485     self.mySketch.setCoincident(aSketchLineA.startPoint(), aSketchLineB.startPoint())
486     self.myDOF -= 2
487     model.do()
488     self.checkDOF()
489     # third line to apply Distance constraints
490     aSketchLineC = self.mySketch.addLine(10., 0., 20., 5.)
491     self.myDOF += 4
492     self.mySketch.setDistance(aSketchLineB.startPoint(), aSketchLineC.result(), 10.)
493     self.mySketch.setDistance(aSketchLineB.endPoint(), aSketchLineC.result(), 5.)
494     self.myDOF -= 2
495     model.do()
496     self.checkDOF()
497     self.mySketch.setFillet(aSketchLineA.startPoint())
498     self.myDOF += 1
499     model.do()
500     self.checkFillet()
501     self.checkDOF()
502
503     self.collectFeatures()
504     self.checkNbFeatures("SketchLine", 3)
505     self.checkNbFeatures("SketchArc", 1)
506     self.checkNbFeatures("SketchConstraintCoincidence", 2)
507     self.checkNbFeatures("SketchConstraintTangent", 2)
508     self.checkNbFeatures("SketchConstraintDistance", 1) # only one Distance should be left
509     self.checkNbFeatures("SketchFillet", 0)
510
511     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0])
512     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [4])
513     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [8])
514
515   @unittest.expectedFailure
516   def test_fillet_with_fixed_point(self):
517     """ Test 13. Fillet on two connected lines in case of Fixed constraint applied to the fillet point
518     """
519     aSketchLineA = self.mySketch.addLine(10., 10., 20., 10.)
520     aSketchLineB = self.mySketch.addLine(10., 10., 10., 20.)
521     self.myDOF += 8
522     self.checkDOF()
523     self.mySketch.setCoincident(aSketchLineA.startPoint(), aSketchLineB.startPoint())
524     self.myDOF -= 2
525     model.do()
526     self.checkDOF()
527     self.mySketch.setFixed(aSketchLineA.startPoint())
528     self.myDOF -= 2
529     model.do()
530     self.checkDOF()
531     self.mySketch.setFillet(aSketchLineA.startPoint())
532     self.myDOF += 1
533     model.do()
534     self.checkFillet()
535     self.checkDOF()
536
537     self.collectFeatures()
538     self.checkNbFeatures("SketchLine", 2)
539     self.checkNbFeatures("SketchArc", 1)
540     self.checkNbFeatures("SketchConstraintCoincidence", 2)
541     self.checkNbFeatures("SketchConstraintTangent", 2)
542     self.checkNbFeatures("SketchConstraintFixed", 0) # Fixed constraint expected to be removed
543     self.checkNbFeatures("SketchFillet", 0)
544
545     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0])
546     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3])
547     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6])
548
549   @unittest.expectedFailure
550   def test_fillet_with_fixed_line(self):
551     """ Test 14. Fillet on two connected lines in case of Fixed constraint applied to one of lines
552     """
553     aSketchLineA = self.mySketch.addLine(10., 10., 20., 10.)
554     aSketchLineB = self.mySketch.addLine(10., 10., 10., 20.)
555     self.myDOF += 8
556     self.checkDOF()
557     self.mySketch.setCoincident(aSketchLineA.startPoint(), aSketchLineB.startPoint())
558     self.myDOF -= 2
559     model.do()
560     self.checkDOF()
561     self.mySketch.setFixed(aSketchLineA.result())
562     self.myDOF -= 4
563     model.do()
564     self.checkDOF()
565     self.mySketch.setFillet(aSketchLineA.startPoint())
566     self.myDOF += 1
567     model.do()
568     self.checkFillet()
569     self.checkDOF()
570
571     self.collectFeatures()
572     self.checkNbFeatures("SketchLine", 2)
573     self.checkNbFeatures("SketchArc", 1)
574     self.checkNbFeatures("SketchConstraintCoincidence", 2)
575     self.checkNbFeatures("SketchConstraintTangent", 2)
576     self.checkNbFeatures("SketchConstraintLength", 0) # Fixed constraint expected to be kept
577     self.checkNbFeatures("SketchFillet", 0)
578
579     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0])
580     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3])
581     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6])
582
583   @unittest.expectedFailure
584   def test_fillet_with_angle(self):
585     """ Test 15. Fillet on two connected lines in case of Perpendicular constraint applied
586     """
587     aSketchLineA = self.mySketch.addLine(10., 10., 20., 10.)
588     aSketchLineB = self.mySketch.addLine(10., 10., 10., 20.)
589     self.myDOF += 8
590     self.checkDOF()
591     self.mySketch.setCoincident(aSketchLineA.startPoint(), aSketchLineB.startPoint())
592     self.myDOF -= 2
593     model.do()
594     self.checkDOF()
595     self.mySketch.setAngle(aSketchLineA.result(), aSketchLineB.result(), 60.)
596     self.myDOF -= 1
597     model.do()
598     self.checkDOF()
599     self.mySketch.setFillet(aSketchLineA.startPoint())
600     self.myDOF += 1
601     model.do()
602     self.checkFillet()
603     self.checkDOF()
604
605     self.collectFeatures()
606     self.checkNbFeatures("SketchLine", 2)
607     self.checkNbFeatures("SketchArc", 1)
608     self.checkNbFeatures("SketchConstraintCoincidence", 2)
609     self.checkNbFeatures("SketchConstraintTangent", 2)
610     self.checkNbFeatures("SketchConstraintAngle", 1)
611     self.checkNbFeatures("SketchFillet", 0)
612
613     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0])
614     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3])
615     model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6])
616
617
618 # TODO: Remove unittest.expectedFailure if the Tangency in PlaneGCS will be updated
619 if __name__ == '__main__':
620   unittest.main()