1 // Name : ConstructionAPI_Axis.cpp
5 // 15/06/16 - Sergey POKHODENKO - Creation of the file
7 //--------------------------------------------------------------------------------------
8 #include "ConstructionAPI_Axis.h"
9 //--------------------------------------------------------------------------------------
10 #include <ModelHighAPI_Tools.h>
11 //--------------------------------------------------------------------------------------
12 ConstructionAPI_Axis::ConstructionAPI_Axis(
13 const std::shared_ptr<ModelAPI_Feature> & theFeature)
14 : ModelHighAPI_Interface(theFeature)
19 ConstructionAPI_Axis::ConstructionAPI_Axis(
20 const std::shared_ptr<ModelAPI_Feature> & theFeature,
21 const ModelHighAPI_Selection & thePoint1,
22 const ModelHighAPI_Selection & thePoint2)
23 : ModelHighAPI_Interface(theFeature)
26 setPoints(thePoint1, thePoint2);
29 ConstructionAPI_Axis::ConstructionAPI_Axis(
30 const std::shared_ptr<ModelAPI_Feature> & theFeature,
31 const ModelHighAPI_Selection & theCylindricalFace)
32 : ModelHighAPI_Interface(theFeature)
35 setCylindricalFace(theCylindricalFace);
38 ConstructionAPI_Axis::ConstructionAPI_Axis(
39 const std::shared_ptr<ModelAPI_Feature> & theFeature,
40 const ModelHighAPI_Selection & thePoint,
41 const ModelHighAPI_Double & theX,
42 const ModelHighAPI_Double & theY,
43 const ModelHighAPI_Double & theZ)
44 : ModelHighAPI_Interface(theFeature)
47 setPointAndDirection(thePoint, theX, theY, theZ);
50 ConstructionAPI_Axis::~ConstructionAPI_Axis()
55 //--------------------------------------------------------------------------------------
56 void ConstructionAPI_Axis::setPoints(
57 const ModelHighAPI_Selection & thePoint1,
58 const ModelHighAPI_Selection & thePoint2)
60 fillAttribute("AxisByPointsCase", creationMethod());
61 fillAttribute(thePoint1, firstPoint());
62 fillAttribute(thePoint2, secondPoint());
67 void ConstructionAPI_Axis::setCylindricalFace(
68 const ModelHighAPI_Selection & theCylindricalFace)
70 fillAttribute("AxisByCylindricalFaceCase", creationMethod());
71 fillAttribute(theCylindricalFace, cylindricalFace());
76 void ConstructionAPI_Axis::setPointAndDirection(
77 const ModelHighAPI_Selection & thePoint,
78 const ModelHighAPI_Double & theX,
79 const ModelHighAPI_Double & theY,
80 const ModelHighAPI_Double & theZ)
82 fillAttribute("AxisByPointAndDirection", creationMethod());
83 fillAttribute(thePoint, firstPoint());
84 fillAttribute(theX, xDirection());
85 fillAttribute(theY, yDirection());
86 fillAttribute(theZ, zDirection());
91 //--------------------------------------------------------------------------------------
92 // TODO(spo): make add* as static functions of the class
94 AxisPtr addAxis(const std::shared_ptr<ModelAPI_Document> & thePart,
95 const ModelHighAPI_Selection & thePoint1,
96 const ModelHighAPI_Selection & thePoint2)
98 // TODO(spo): check that thePart is not empty
99 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Axis::ID());
100 return AxisPtr(new ConstructionAPI_Axis(aFeature, thePoint1, thePoint2));
103 AxisPtr addAxis(const std::shared_ptr<ModelAPI_Document> & thePart,
104 const ModelHighAPI_Selection & theCylindricalFace)
106 // TODO(spo): check that thePart is not empty
107 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Axis::ID());
108 return AxisPtr(new ConstructionAPI_Axis(aFeature, theCylindricalFace));
111 AxisPtr addAxis(const std::shared_ptr<ModelAPI_Document> & thePart,
112 const ModelHighAPI_Selection & thePoint,
113 const ModelHighAPI_Double & theX,
114 const ModelHighAPI_Double & theY,
115 const ModelHighAPI_Double & theZ)
117 // TODO(spo): check that thePart is not empty
118 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Axis::ID());
119 return AxisPtr(new ConstructionAPI_Axis(aFeature, thePoint, theX, theY, theZ));