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(
51 const std::shared_ptr<ModelAPI_Feature> & theFeature,
52 const ModelHighAPI_Double & theDX,
53 const ModelHighAPI_Double & theDY,
54 const ModelHighAPI_Double & theDZ)
55 : ModelHighAPI_Interface(theFeature)
58 setDimensions(theDX, theDY, theDZ);
61 ConstructionAPI_Axis::~ConstructionAPI_Axis()
66 //--------------------------------------------------------------------------------------
67 void ConstructionAPI_Axis::setPoints(
68 const ModelHighAPI_Selection & thePoint1,
69 const ModelHighAPI_Selection & thePoint2)
71 fillAttribute("AxisByPointsCase", creationMethod());
72 fillAttribute(thePoint1, firstPoint());
73 fillAttribute(thePoint2, secondPoint());
78 void ConstructionAPI_Axis::setCylindricalFace(
79 const ModelHighAPI_Selection & theCylindricalFace)
81 fillAttribute("AxisByCylindricalFaceCase", creationMethod());
82 fillAttribute(theCylindricalFace, cylindricalFace());
87 void ConstructionAPI_Axis::setPointAndDirection(
88 const ModelHighAPI_Selection & thePoint,
89 const ModelHighAPI_Double & theX,
90 const ModelHighAPI_Double & theY,
91 const ModelHighAPI_Double & theZ)
93 fillAttribute("AxisByPointAndDirection", creationMethod());
94 fillAttribute(thePoint, firstPoint());
95 fillAttribute(theX, xDirection());
96 fillAttribute(theY, yDirection());
97 fillAttribute(theZ, zDirection());
102 void ConstructionAPI_Axis::setDimensions(
103 const ModelHighAPI_Double & theDX,
104 const ModelHighAPI_Double & theDY,
105 const ModelHighAPI_Double & theDZ)
107 fillAttribute("AxisByDimensionsCase", creationMethod());
108 fillAttribute(theDX, xDimension());
109 fillAttribute(theDY, yDimension());
110 fillAttribute(theDZ, zDimension());
115 //--------------------------------------------------------------------------------------
116 AxisPtr addAxis(const std::shared_ptr<ModelAPI_Document> & thePart,
117 const ModelHighAPI_Selection & thePoint1,
118 const ModelHighAPI_Selection & thePoint2)
120 // TODO(spo): check that thePart is not empty
121 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Axis::ID());
122 return AxisPtr(new ConstructionAPI_Axis(aFeature, thePoint1, thePoint2));
125 AxisPtr addAxis(const std::shared_ptr<ModelAPI_Document> & thePart,
126 const ModelHighAPI_Selection & theCylindricalFace)
128 // TODO(spo): check that thePart is not empty
129 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Axis::ID());
130 return AxisPtr(new ConstructionAPI_Axis(aFeature, theCylindricalFace));
133 AxisPtr addAxis(const std::shared_ptr<ModelAPI_Document> & thePart,
134 const ModelHighAPI_Selection & thePoint,
135 const ModelHighAPI_Double & theX,
136 const ModelHighAPI_Double & theY,
137 const ModelHighAPI_Double & theZ)
139 // TODO(spo): check that thePart is not empty
140 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Axis::ID());
141 return AxisPtr(new ConstructionAPI_Axis(aFeature, thePoint, theX, theY, theZ));
144 AxisPtr addAxis(const std::shared_ptr<ModelAPI_Document> & thePart,
145 const ModelHighAPI_Double & theDX,
146 const ModelHighAPI_Double & theDY,
147 const ModelHighAPI_Double & theDZ)
149 // TODO(spo): check that thePart is not empty
150 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Axis::ID());
151 return AxisPtr(new ConstructionAPI_Axis(aFeature, theDX, theDY, theDZ));