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& METHOD()
39 static const std::string METHOD_ATTR("CreationMethod");
43 /// attribute name of first point
44 inline static const std::string& POINT_FIRST()
46 static const std::string MY_POINT_FIRST("FirstPoint");
47 return MY_POINT_FIRST;
50 /// attribute name of second point
51 inline static const std::string& POINT_SECOND()
53 static const std::string MY_POINT_SECOND("SecondPoint");
54 return MY_POINT_SECOND;
57 /// attribute first coordinate
58 inline static const std::string& DX()
60 static const std::string MY_DX("dx");
64 /// attribute second coordinate
65 inline static const std::string& DY()
67 static const std::string MY_DY("dy");
71 /// attribute third coordinate
72 inline static const std::string& DZ()
74 static const std::string MY_DZ("dz");
78 /// Returns the kind of a feature
79 PRIMITIVESPLUGIN_EXPORT virtual const std::string& getKind()
81 static std::string MY_KIND = PrimitivesPlugin_Box::ID();
85 /// Creates a new part document if needed
86 PRIMITIVESPLUGIN_EXPORT virtual void execute();
88 /// Request for initialization of data model of the feature: adding all attributes
89 PRIMITIVESPLUGIN_EXPORT virtual void initAttributes();
91 /// Use plugin manager for features creation
92 PrimitivesPlugin_Box();
95 /// Load Naming data structure of the feature to the document
96 void loadNamingDS(std::shared_ptr<GeomAlgoAPI_Box> theBoxAlgo,
97 std::shared_ptr<ModelAPI_ResultBody> theResultBox);
99 ///Perform the creation of the box using two points defining a diagonal
100 void createBoxByTwoPoints();
102 ///Perform the creation of the box using three cordinates
103 void createBoxByDimensions();