1 ## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
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.
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.
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
17 ## See http:##www.salome-platform.org/ or
18 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
23 Unit Test of ConstructionPlugin_Axis class
26 static const std::string CONSTRUCTION_AXIS_KIND("Axis");
27 static const std::string METHOD_ATTR("CreationMethod");
28 static const std::string POINT_ATTR_FIRST("FirstPoint");
29 static const std::string POINT_ATTR_SECOND("SecondPoint");
30 static const std::string CYLINDRICAL_FACE_ATTR("CylindricalFace");
31 static const std::string X_ATTR("X");
32 static const std::string Y_ATTR("Y");
33 static const std::string Z_ATTR("Z");
36 data()->addAttribute(ConstructionPlugin_Axis::METHOD(), ModelAPI_AttributeString::typeId());
38 data()->addAttribute(ConstructionPlugin_Axis::POINT_FIRST(), ModelAPI_AttributeSelection::typeId());
39 data()->addAttribute(ConstructionPlugin_Axis::POINT_SECOND(), ModelAPI_AttributeSelection::typeId());
41 data()->addAttribute(ConstructionPlugin_Axis::CYLINDRICAL_FACE(), ModelAPI_AttributeSelection::typeId());
43 data()->addAttribute(ConstructionPlugin_Axis::X(), ModelAPI_AttributeDouble::typeId());
44 data()->addAttribute(ConstructionPlugin_Axis::Y(), ModelAPI_AttributeDouble::typeId());
45 data()->addAttribute(ConstructionPlugin_Axis::Z(), ModelAPI_AttributeDouble::typeId());
50 #=========================================================================
51 # Initialization of the test
52 #=========================================================================
53 from ModelAPI import *
54 from GeomDataAPI import *
55 from GeomAlgoAPI import *
59 __updated__ = "2016-01-04"
61 aSession = ModelAPI_Session.get()
62 aDocument = aSession.moduleDocument()
63 # Create a part for creation of a box
64 aSession.startOperation()
65 aPartFeature = aDocument.addFeature("Part")
66 aSession.finishOperation()
67 assert (len(aPartFeature.results()) == 1)
69 aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
70 aPart = aPartResult.partDoc()
71 #=========================================================================
72 # Creation of an Axis by coordinates
73 #=========================================================================
74 aSession.startOperation()
75 anAxisByDimensions = aPart.addFeature("Axis")
76 anAxisByDimensions.string("CreationMethod").setValue("AxisByDimensionsCase")
77 anAxisByDimensions.real("DX").setValue(2.5)
78 anAxisByDimensions.real("DY").setValue(3.2)
79 anAxisByDimensions.real("DZ").setValue(1.4)
80 anAxisByDimensions.execute()
83 assert(len(anAxisByDimensions.results()) > 0)
84 anAxisByDimensions = modelAPI_ResultConstruction(anAxisByDimensions.firstResult())
85 assert(anAxisByDimensions is not None)
87 aSession.finishOperation()
88 #=========================================================================
90 #=========================================================================
92 from salome.shaper import model
93 assert(model.checkPythonDump())