1 // Copyright (C) 2014-2016 CEA/DEN, EDF R&D
3 // File: PrimitivesPlugin_Box.h
4 // Created: 10 Mar 2016
5 // Author: Clarisse Genrault (CEA)
7 #ifndef PrimitivesPlugin_Box_H_
8 #define PrimitivesPlugin_Box_H_
10 #include <PrimitivesPlugin.h>
11 #include <ModelAPI_Feature.h>
12 #include <GeomAlgoAPI_Box.h>
15 class ModelAPI_ResultBody;
17 /**\class PrimitivesPlugin_Box
19 * \brief Feature for creation of a box primitive using various methods.
21 * Box creates a cuboid - Parallelepiped with 6 rectangular faces. It can be built via two
22 * methods : using two points that define a diagonal, or using 3 lengths that define the
23 * rectangular dimensions.
25 class PrimitivesPlugin_Box : public ModelAPI_Feature
29 inline static const std::string& ID()
31 static const std::string MY_BOX_ID("Box");
35 /// Attribute name for creation method
36 inline static const std::string& CREATION_METHOD()
38 static const std::string MY_CREATION_METHOD_ID("CreationMethod");
39 return MY_CREATION_METHOD_ID;
42 /// Attribute name for creation method
43 inline static const std::string& CREATION_METHOD_BY_DIMENSIONS()
45 static const std::string MY_CREATION_METHOD_ID("BoxByDimensions");
46 return MY_CREATION_METHOD_ID;
49 /// Attribute name for creation method
50 inline static const std::string& CREATION_METHOD_BY_TWO_POINTS()
52 static const std::string MY_CREATION_METHOD_ID("BoxByTwoPoints");
53 return MY_CREATION_METHOD_ID;
56 /// Attribute name of first point
57 inline static const std::string& POINT_FIRST_ID()
59 static const std::string MY_POINT_FIRST_ID("FirstPoint");
60 return MY_POINT_FIRST_ID;
63 /// Attribute name of second point
64 inline static const std::string& POINT_SECOND_ID()
66 static const std::string MY_POINT_SECOND_ID("SecondPoint");
67 return MY_POINT_SECOND_ID;
70 /// Attribute first coordinate
71 inline static const std::string& DX_ID()
73 static const std::string MY_DX_ID("dx");
77 /// Attribute second coordinate
78 inline static const std::string& DY_ID()
80 static const std::string MY_DY_ID("dy");
84 /// Attribute third coordinate
85 inline static const std::string& DZ_ID()
87 static const std::string MY_DZ_ID("dz");
91 /// Returns the kind of a feature
92 PRIMITIVESPLUGIN_EXPORT virtual const std::string& getKind()
94 static std::string MY_KIND = PrimitivesPlugin_Box::ID();
98 /// Creates a new part document if needed
99 PRIMITIVESPLUGIN_EXPORT virtual void execute();
101 /// Request for initialization of data model of the feature: adding all attributes
102 PRIMITIVESPLUGIN_EXPORT virtual void initAttributes();
104 /// Use plugin manager for features creation
105 PrimitivesPlugin_Box();
108 /// Load Naming data structure of the feature to the document
109 void loadNamingDS(std::shared_ptr<GeomAlgoAPI_Box> theBoxAlgo,
110 std::shared_ptr<ModelAPI_ResultBody> theResultBox);
112 ///Perform the creation of the box using two points defining a diagonal
113 void createBoxByTwoPoints();
115 ///Perform the creation of the box using three cordinates
116 void createBoxByDimensions();