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