Salome HOME
Issue #2481: Application error when create fillet
[modules/shaper.git] / src / ParametersPlugin / Test / Test1806.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       Test1806.py
23       Unit test for testing the expression evaluation even no parameters are created
24
25 """
26 #=========================================================================
27 # Initialization of the test
28 #=========================================================================
29 from ModelAPI import *
30 from GeomDataAPI import *
31
32 __updated__ = "2016-11-23"
33
34 aSession = ModelAPI_Session.get()
35 aPartSet = aSession.moduleDocument()
36
37 #=========================================================================
38 # Create a part
39 #=========================================================================
40 aSession.startOperation()
41 aPartFeature = aPartSet.addFeature("Part")
42 aSession.finishOperation()
43
44 aPart = aSession.activeDocument()
45 #=========================================================================
46 # Create a sketch with a line and length
47 #=========================================================================
48 aSession.startOperation()
49 aSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch"))
50 aXOYPlane = objectToResult(aPartSet.objectByName("Construction", "XOY"))
51 aSketchFeature.selection("External").setValue(aXOYPlane, None)
52 # Create lines
53 aLine = aSketchFeature.addFeature("SketchLine")
54 aStart = geomDataAPI_Point2D(aLine.attribute("StartPoint"))
55 aStart.setValue(0, 0)
56 anEnd = geomDataAPI_Point2D(aLine.attribute("EndPoint"))
57 anEnd.setValue(200, 0)
58
59 aDistance = aSketchFeature.addFeature("SketchConstraintDistance")
60 aDistance.refattr("ConstraintEntityA").setAttr(aStart)
61 aDistance.refattr("ConstraintEntityB").setAttr(anEnd)
62 aDistance.real("ConstraintValue").setText("25/2")
63
64 aSession.finishOperation()
65
66 assert(aDistance.real("ConstraintValue").value() == 12.5)
67 #=========================================================================
68 # End of test
69 #=========================================================================
70 from salome.shaper import model
71 assert(model.checkPythonDump())