1 // Copyright (C) 2014-2016 CEA/DEN, EDF R&D
3 // File: ConstructionPlugin_Axis.h
4 // Created: 12 Dec 2014
5 // Author: Vitaly Smetannikov
7 // Modified by CEA (delegation to Alyotech) : 29 Mar 2016
9 #ifndef ConstructionPlugin_Axis_H
10 #define ConstructionPlugin_Axis_H
12 #include "ConstructionPlugin.h"
13 #include <ModelAPI_Feature.h>
14 #include <ModelAPI_Result.h>
15 #include <GeomAPI_ICustomPrs.h>
17 /**\class ConstructionPlugin_Axis
19 * \brief Feature for creation of the new axis in PartSet.
21 class ConstructionPlugin_Axis : public ModelAPI_Feature, public GeomAPI_ICustomPrs
24 /// Returns the kind of a feature
25 CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind()
27 static std::string MY_KIND = ConstructionPlugin_Axis::ID();
32 inline static const std::string& ID()
34 static const std::string CONSTRUCTION_AXIS_KIND("Axis");
35 return CONSTRUCTION_AXIS_KIND;
38 /// attribute name for first point
39 inline static const std::string& METHOD()
41 static const std::string METHOD_ATTR("CreationMethod");
45 /// Attribute name for creation method.
46 inline static const std::string& CREATION_METHOD_BY_LINE()
48 static const std::string METHOD_ATTR("by_line");
52 /// attribute name for first point
53 inline static const std::string& POINT_FIRST()
55 static const std::string POINT_ATTR_FIRST("FirstPoint");
56 return POINT_ATTR_FIRST;
58 /// attribute name for second point
59 inline static const std::string& POINT_SECOND()
61 static const std::string POINT_ATTR_SECOND("SecondPoint");
62 return POINT_ATTR_SECOND;
64 /// attribute name for second point
65 inline static const std::string& CYLINDRICAL_FACE()
67 static const std::string CYLINDRICAL_FACE_ATTR("CylindricalFace");
68 return CYLINDRICAL_FACE_ATTR;
70 /// attribute name for the X dimension
71 inline static const std::string& DX()
73 static const std::string DX_ATTR("DX");
76 /// attribute name for the Y dimension
77 inline static const std::string& DY()
79 static const std::string DY_ATTR("DY");
82 /// attribute name for the Z dimension
83 inline static const std::string& DZ()
85 static const std::string DZ_ATTR("DZ");
89 /// attribute name for X direction
90 inline static const std::string& X_DIRECTION()
92 static const std::string ATTR_X_DIRECTION("X_Direction");
93 return ATTR_X_DIRECTION;
96 /// attribute name for Y direction
97 inline static const std::string& Y_DIRECTION()
99 static const std::string ATTR_Y_DIRECTION("Y_Direction");
100 return ATTR_Y_DIRECTION;
103 /// attribute name for Y direction
104 inline static const std::string& Z_DIRECTION()
106 static const std::string ATTR_Z_DIRECTION("Z_Direction");
107 return ATTR_Z_DIRECTION;
110 /// Attribute name for line.
111 inline static const std::string& LINE()
113 static const std::string ATTR_ID("line");
117 /// Returns a minimal length for axis
118 inline static const double MINIMAL_LENGTH() { return 1.e-5; }
120 /// Creates a new part document if needed
121 CONSTRUCTIONPLUGIN_EXPORT virtual void execute();
123 /// Request for initialization of data model of the feature: adding all attributes
124 CONSTRUCTIONPLUGIN_EXPORT virtual void initAttributes();
126 /// Construction result is allways recomuted on the fly
127 CONSTRUCTIONPLUGIN_EXPORT virtual bool isPersistentResult() {return false;}
129 /// Use plugin manager for features creation
130 ConstructionPlugin_Axis();
132 /// Customize presentation of the feature
133 virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs,
134 std::shared_ptr<GeomAPI_ICustomPrs> theDefaultPrs);
137 /// Creates a new axis by two defined points
138 void createAxisByTwoPoints();
139 /// Creates a new axis using three dimensions
140 void createAxisByDimensions();
141 /// Creates a new axis as copy of cylindrical face axis
142 void createAxisByCylindricalFace();
143 /// Creates a new axis by point and direction
144 void createAxisByPointAndDirection();
145 void createAxisByLine();