]> SALOME platform Git repositories - modules/shaper.git/blob - src/SketchPlugin/Test/Test2018.py
Salome HOME
da9b567ed719bb98f3e3be0f6da88bc827fce9d9
[modules/shaper.git] / src / SketchPlugin / Test / Test2018.py
1 """
2     Test2018.py
3     Test case for issue #2018 "After split auxiliary circle edit of axiliary state of arc is wrong"
4 """
5
6 from ModelAPI import *
7 from ModelAPI import ModelAPI_Feature
8 from ModelAPI import FeatureList
9 from ModelGeomAlgo import ModelGeomAlgo_Point2D
10 from SketchAPI import SketchAPI_Arc
11 from salome.shaper import model
12
13 def getArcs(theSketch):
14     anArcs = []
15     for aSubObj in theSketch.features().list():
16         aFeature = ModelAPI_Feature.feature(aSubObj)
17         if aFeature is not None and aFeature.getKind() == "SketchArc":
18             anArcs.append(aFeature)
19     return anArcs
20
21
22 model.begin()
23 partSet = model.moduleDocument()
24 Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY"))
25 SketchCircle_1 = Sketch_1.addCircle(-316.2976090885591, -103.0319555403832, 230.3644881376851)
26 SketchCircle_1.setAuxiliary(True)
27 SketchLine_1 = Sketch_1.addLine(-489.6131019153831, 48.7229038254136, -457.9545454545454, 334.0909090909091)
28 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.results()[1])
29 SketchLine_2 = Sketch_1.addLine(-457.9545454545454, 334.0909090909091, -251.2069112222553, 117.9454153513332)
30 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
31 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchCircle_1.results()[1])
32
33 # prepare point on circle
34 SketchLine_intersecting = Sketch_1.addLine(-316.2976090885591, -103.0319555403832, -457.9545454545454, 334.0909090909091)
35 Intersection_Point = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchCircle_1.feature(), FeatureList([SketchLine_intersecting.feature()]))
36 removeFeaturesAndReferences(FeatureSet([SketchLine_intersecting.feature()]))
37 GeomPoint = Intersection_Point[0]
38
39 #perform split
40 Sketch_1.addSplit(SketchCircle_1, Sketch_1.to2D(GeomPoint))
41 model.do()
42
43 anArcs = getArcs(Sketch_1)
44 # check auxiliary flags
45 for arc in anArcs:
46     aCurrentArc = SketchAPI_Arc(arc)
47     assert(aCurrentArc.auxiliary().value())
48     aCurrentArc.setAuxiliary(False)
49     model.do()
50     assert(aCurrentArc.auxiliary().value() == False)
51
52 model.end()
53
54 assert(model.checkPythonDump())