1 // File: SketchPlugin_Constraint.h
2 // Created: 08 May 2014
3 // Author: Artem ZHIDKOV
5 #ifndef SketchPlugin_Constraint_HeaderFile
6 #define SketchPlugin_Constraint_HeaderFile
8 #include "SketchPlugin.h"
9 #include "SketchPlugin_Feature.h"
10 #include <ModelAPI_AttributeReference.h>
11 #include <ModelAPI_AttributeRefAttr.h>
15 * Each constraint uses a set of parameters. In the SolveSpace library
16 * these parameters are named "valA", "ptA", "ptB", "entityA", "entityB".
17 * The "ptA" and "ptB" parameters represents a point in the constraint.
18 * The "entityA" and "entityB" represents any other object (and a point too).
19 * And the "valA" represents a real value.
21 * The attributes below are named corresponding to the SolveSpace,
22 * some of them may be unused. The list of used attributes is defined
23 * inside the certain constraint.
25 /// The value parameter for the constraint
26 const std::string CONSTRAINT_ATTR_VALUE("ConstraintValueA");
27 /// First point for the constraint
28 const std::string CONSTRAINT_ATTR_POINT_A("ConstraintPointA");
29 /// Second point for the constraint
30 const std::string CONSTRAINT_ATTR_POINT_B("ConstraintPointB");
31 /// First entity for the constraint
32 const std::string CONSTRAINT_ATTR_ENTITY_A("ConstraintEntityA");
33 /// Second entity for the constraint
34 const std::string CONSTRAINT_ATTR_ENTITY_B("ConstraintEntityB");
37 /** \class SketchPlugin_Constraint
39 * \brief Feature for creation of a new constraint between other features.
40 * Base class for all constraints.
42 class SketchPlugin_Constraint: public SketchPlugin_Feature
45 /// \brief Returns the kind of a feature
46 SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
47 {static std::string MY_KIND = "SketchConstraint"; return MY_KIND;}
49 /// \brief Returns to which group in the document must be added feature
50 SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
51 {static std::string MY_GROUP = "Sketch"; return MY_GROUP;}
53 /** \brief Adds sub-feature of the higher level feature (sub-element of the sketch)
54 * \param theFeature sub-feature
56 SKETCHPLUGIN_EXPORT virtual const void addSub(
57 const boost::shared_ptr<ModelAPI_Feature>& theFeature) {}
59 /// \brief Use plugin manager for features creation
60 SketchPlugin_Constraint() {}