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>
13 #include <GeomAlgoAPI_BoxPoints.h>
16 class ModelAPI_ResultBody;
18 /**\class PrimitivesPlugin_Box
20 * \brief Feature for creation of a box primitive using various methods.
22 * Box creates a cuboid - Parallelepiped with 6 rectangular faces. It can be built via two
23 * methods : using two points that define a diagonal, or using 3 lengths that define the
24 * rectangular dimensions.
26 class PrimitivesPlugin_Box : public ModelAPI_Feature
30 inline static const std::string& ID()
32 static const std::string MY_BOX_ID("Box");
36 /// Attribute name for creation method
37 inline static const std::string& CREATION_METHOD()
39 static const std::string MY_CREATION_METHOD_ID("CreationMethod");
40 return MY_CREATION_METHOD_ID;
43 /// Attribute name for creation method
44 inline static const std::string& CREATION_METHOD_BY_DIMENSIONS()
46 static const std::string MY_CREATION_METHOD_ID("BoxByDimensions");
47 return MY_CREATION_METHOD_ID;
50 /// Attribute name for creation method
51 inline static const std::string& CREATION_METHOD_BY_TWO_POINTS()
53 static const std::string MY_CREATION_METHOD_ID("BoxByTwoPoints");
54 return MY_CREATION_METHOD_ID;
57 /// Attribute name of first point
58 inline static const std::string& POINT_FIRST_ID()
60 static const std::string MY_POINT_FIRST_ID("FirstPoint");
61 return MY_POINT_FIRST_ID;
64 /// Attribute name of second point
65 inline static const std::string& POINT_SECOND_ID()
67 static const std::string MY_POINT_SECOND_ID("SecondPoint");
68 return MY_POINT_SECOND_ID;
71 /// Attribute first coordinate
72 inline static const std::string& DX_ID()
74 static const std::string MY_DX_ID("dx");
78 /// Attribute second coordinate
79 inline static const std::string& DY_ID()
81 static const std::string MY_DY_ID("dy");
85 /// Attribute third coordinate
86 inline static const std::string& DZ_ID()
88 static const std::string MY_DZ_ID("dz");
92 /// Returns the kind of a feature
93 PRIMITIVESPLUGIN_EXPORT virtual const std::string& getKind()
95 static std::string MY_KIND = PrimitivesPlugin_Box::ID();
99 /// Creates a new part document if needed
100 PRIMITIVESPLUGIN_EXPORT virtual void execute();
102 /// Request for initialization of data model of the feature: adding all attributes
103 PRIMITIVESPLUGIN_EXPORT virtual void initAttributes();
105 /// Use plugin manager for features creation
106 PrimitivesPlugin_Box();
109 /// Load Naming data structure of the feature to the document
110 void loadNamingDS(std::shared_ptr<GeomAlgoAPI_Box> theBoxAlgo,
111 std::shared_ptr<ModelAPI_ResultBody> theResultBox);
113 ///Perform the creation of the box using two points defining a diagonal
114 void createBoxByTwoPoints();
116 ///Perform the creation of the box using three cordinates
117 void createBoxByDimensions();