Salome HOME
Add copyright header according to request of CEA from 06.06.2017
[modules/shaper.git] / src / SketchPlugin / Test / TestRemoveSketch.py
1 ## Copyright (C) 2014-2017  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 """
22     TestRemoveSketch.py
23 """
24 from GeomDataAPI import *
25 from ModelAPI import *
26
27 #=========================================================================
28 # Initialization of the test
29 #=========================================================================
30 __updated__ = "2017-02-01"
31
32 aSession = ModelAPI_Session.get()
33 aDocument = aSession.moduleDocument()
34
35 # create a sketch
36 aSession.startOperation()
37 aSketchFeature = featureToCompositeFeature(aDocument.addFeature("Sketch"))
38 origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
39 origin.setValue(0, 0, 0)
40 dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
41 dirx.setValue(1, 0, 0)
42 norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
43 norm.setValue(0, 0, 1)
44 aSession.finishOperation()
45
46 # create a line
47 aSession.startOperation()
48 aSketchLine = aSketchFeature.addFeature("SketchLine")
49 aLineStartPoint = geomDataAPI_Point2D(aSketchLine.attribute("StartPoint"))
50 aLineEndPoint = geomDataAPI_Point2D(aSketchLine.attribute("EndPoint"))
51 aLineStartPoint.setValue(50., 0.)
52 aLineEndPoint.setValue(100., 25.)
53 aSession.finishOperation()
54
55 # remove sketch
56 aSession.startOperation()
57 aDocument.removeFeature(aSketchFeature)
58 aSession.finishOperation()
59
60 #=========================================================================
61 # End of test
62 #=========================================================================