1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: ConstructionPlugin_Axis.h
4 // Created: 12 Dec 2014
5 // Author: Vitaly Smetannikov
7 #ifndef ConstructionPlugin_Axis_H
8 #define ConstructionPlugin_Axis_H
10 #include "ConstructionPlugin.h"
11 #include <ModelAPI_Feature.h>
12 #include <ModelAPI_Result.h>
13 #include <GeomAPI_ICustomPrs.h>
15 /**\class ConstructionPlugin_Axis
17 * \brief Feature for creation of the new axis in PartSet.
19 class ConstructionPlugin_Axis : public ModelAPI_Feature, public GeomAPI_ICustomPrs
22 /// Returns the kind of a feature
23 CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind()
25 static std::string MY_KIND = ConstructionPlugin_Axis::ID();
30 inline static const std::string& ID()
32 static const std::string CONSTRUCTION_AXIS_KIND("Axis");
33 return CONSTRUCTION_AXIS_KIND;
36 /// attribute name for first point
37 inline static const std::string& METHOD()
39 static const std::string METHOD_ATTR("CreationMethod");
42 /// attribute name for first point
43 inline static const std::string& POINT_FIRST()
45 static const std::string POINT_ATTR_FIRST("FirstPoint");
46 return POINT_ATTR_FIRST;
48 /// attribute name for second point
49 inline static const std::string& POINT_SECOND()
51 static const std::string POINT_ATTR_SECOND("SecondPoint");
52 return POINT_ATTR_SECOND;
54 /// attribute name for second point
55 inline static const std::string& CYLINDRICAL_FACE()
57 static const std::string CYLINDRICAL_FACE_ATTR("CylindricalFace");
58 return CYLINDRICAL_FACE_ATTR;
61 /// attribute name for X direction
62 inline static const std::string& X_DIRECTION()
64 static const std::string ATTR_X_DIRECTION("X_Direction");
65 return ATTR_X_DIRECTION;
68 /// attribute name for Y direction
69 inline static const std::string& Y_DIRECTION()
71 static const std::string ATTR_Y_DIRECTION("Y_Direction");
72 return ATTR_Y_DIRECTION;
75 /// attribute name for Y direction
76 inline static const std::string& Z_DIRECTION()
78 static const std::string ATTR_Z_DIRECTION("Z_Direction");
79 return ATTR_Z_DIRECTION;
82 /// Returns a minimal length for axis
83 inline static const double MINIMAL_LENGTH() { return 1.e-5; }
85 /// Creates a new part document if needed
86 CONSTRUCTIONPLUGIN_EXPORT virtual void execute();
88 /// Request for initialization of data model of the feature: adding all attributes
89 CONSTRUCTIONPLUGIN_EXPORT virtual void initAttributes();
91 /// Construction result is allways recomuted on the fly
92 CONSTRUCTIONPLUGIN_EXPORT virtual bool isPersistentResult() {return false;}
94 /// Use plugin manager for features creation
95 ConstructionPlugin_Axis();
97 /// Customize presentation of the feature
98 virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs,
99 std::shared_ptr<GeomAPI_ICustomPrs> theDefaultPrs);
102 /// Creates a new axis by two defined points
103 void createAxisByTwoPoints();
104 /// Creates a new axis as copy of cylindrical face axis
105 void createAxisByCylindricalFace();
106 /// Creates a new axis by point and direction
107 void createAxisByPointAndDirection();