Salome HOME
3b5a69e8e13e946a0056e041c4ee3859c8b5d56f
[modules/shaper.git] / src / SketchPlugin / Test / TestRemoveSketch.py
1 """
2     TestRemoveSketch.py
3 """
4 from GeomDataAPI import *
5 from ModelAPI import *
6
7 #=========================================================================
8 # Initialization of the test
9 #=========================================================================
10 __updated__ = "2017-02-01"
11
12 aSession = ModelAPI_Session.get()
13 aDocument = aSession.moduleDocument()
14
15 # create a sketch
16 aSession.startOperation()
17 aSketchFeature = featureToCompositeFeature(aDocument.addFeature("Sketch"))
18 origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
19 origin.setValue(0, 0, 0)
20 dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
21 dirx.setValue(1, 0, 0)
22 norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
23 norm.setValue(0, 0, 1)
24 aSession.finishOperation()
25
26 # create a line
27 aSession.startOperation()
28 aSketchLine = aSketchFeature.addFeature("SketchLine")
29 aLineStartPoint = geomDataAPI_Point2D(aSketchLine.attribute("StartPoint"))
30 aLineEndPoint = geomDataAPI_Point2D(aSketchLine.attribute("EndPoint"))
31 aLineStartPoint.setValue(50., 0.)
32 aLineEndPoint.setValue(100., 25.)
33 aSession.finishOperation()
34
35 # remove sketch
36 aSession.startOperation()
37 aDocument.removeFeature(aSketchFeature)
38 aSession.finishOperation()
39
40 #=========================================================================
41 # End of test
42 #=========================================================================