SketchPlugin_Sketch.h
SketchPlugin_Line.h
SketchPlugin_Point.h
+ SketchPlugin_Circle.h
+ SketchPlugin_Arc.h
SketchPlugin_Constraint.h
SketchPlugin_ConstraintCoincidence.h
SketchPlugin_ConstraintDistance.h
+ SketchPlugin_ConstraintDiameter.h
+ SketchPlugin_ConstraintParallel.h
+ SketchPlugin_ConstraintPerpendicular.h
)
SET(PROJECT_SOURCES
SketchPlugin_Sketch.cpp
SketchPlugin_Line.cpp
SketchPlugin_Point.cpp
+ SketchPlugin_Circle.cpp
+ SketchPlugin_Arc.cpp
SketchPlugin_ConstraintCoincidence.cpp
SketchPlugin_ConstraintDistance.cpp
+ SketchPlugin_ConstraintDiameter.cpp
+ SketchPlugin_ConstraintParallel.cpp
+ SketchPlugin_ConstraintPerpendicular.cpp
)
SET(PROJECT_LIBRARIES
--- /dev/null
+// File: SketchPlugin_Arc.cpp
+// Created: 26 Apr 2014
+// Author: Artem ZHIDKOV
+
+#include "SketchPlugin_Arc.h"
+#include "SketchPlugin_Sketch.h"
+#include <ModelAPI_Data.h>
+#include <GeomDataAPI_Point2D.h>
+
+SketchPlugin_Arc::SketchPlugin_Arc()
+ : SketchPlugin_Feature()
+{
+}
+
+void SketchPlugin_Arc::initAttributes()
+{
+ data()->addAttribute(ARC_ATTR_CENTER, GeomDataAPI_Point2D::type());
+ data()->addAttribute(ARC_ATTR_START, GeomDataAPI_Point2D::type());
+ data()->addAttribute(ARC_ATTR_END, GeomDataAPI_Point2D::type());
+}
+
+void SketchPlugin_Arc::execute()
+{
+}
+
+const boost::shared_ptr<GeomAPI_Shape>& SketchPlugin_Arc::preview()
+{
+ /// \todo Implement preview for arc of circle
+ return getPreview();
+}
--- /dev/null
+// File: SketchPlugin_Arc.h
+// Created: 26 May 2014
+// Author: Artem ZHIDKOV
+
+#ifndef SketchPlugin_Arc_HeaderFile
+#define SketchPlugin_Arc_HeaderFile
+
+#include "SketchPlugin.h"
+#include <SketchPlugin_Feature.h>
+
+/// Central 2D point of the circle which contains the arc
+const std::string ARC_ATTR_CENTER("ArcCenter");
+/// Start 2D point of the arc
+const std::string ARC_ATTR_START("ArcStartPoint");
+/// End 2D point of the arc
+const std::string ARC_ATTR_END("ArcEndPoint");
+
+/**\class SketchPlugin_Arc
+ * \ingroup DataModel
+ * \brief Feature for creation of the new arc of circle in PartSet.
+ */
+class SketchPlugin_Arc: public SketchPlugin_Feature
+{
+public:
+ /// Returns the kind of a feature
+ SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
+ {static std::string MY_KIND = "SketchArc"; return MY_KIND;}
+
+ /// Returns to which group in the document must be added feature
+ SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
+ {static std::string MY_GROUP = "Sketch"; return MY_GROUP;}
+
+ /// Creates a new part document if needed
+ SKETCHPLUGIN_EXPORT virtual void execute();
+
+ /// Request for initialization of data model of the feature: adding all attributes
+ SKETCHPLUGIN_EXPORT virtual void initAttributes();
+
+ /// Returns the sketch preview
+ SKETCHPLUGIN_EXPORT virtual const boost::shared_ptr<GeomAPI_Shape>& preview();
+
+ /// Adds sub-feature of the higher level feature (sub-element of the sketch)
+ /// \param theFeature sub-feature
+ SKETCHPLUGIN_EXPORT virtual const void addSub(
+ const boost::shared_ptr<ModelAPI_Feature>& theFeature) {};
+
+ /// Use plugin manager for features creation
+ SketchPlugin_Arc();
+};
+
+#endif
--- /dev/null
+// File: SketchPlugin_Circle.cpp
+// Created: 26 May 2014
+// Author: Artem ZHIDKOV
+
+#include "SketchPlugin_Circle.h"
+#include "SketchPlugin_Sketch.h"
+#include <ModelAPI_Data.h>
+#include <GeomDataAPI_Point2D.h>
+#include <ModelAPI_AttributeDouble.h>
+
+SketchPlugin_Circle::SketchPlugin_Circle()
+ : SketchPlugin_Feature()
+{
+}
+
+void SketchPlugin_Circle::initAttributes()
+{
+ data()->addAttribute(CIRCLE_ATTR_CENTER, GeomDataAPI_Point2D::type());
+ data()->addAttribute(CIRCLE_ATTR_RADIUS, ModelAPI_AttributeDouble::type());
+}
+
+void SketchPlugin_Circle::execute()
+{
+}
+
+const boost::shared_ptr<GeomAPI_Shape>& SketchPlugin_Circle::preview()
+{
+ /// \todo Implement preview for the circle
+ return getPreview();
+}
--- /dev/null
+// File: SketchPlugin_Circle.h
+// Created: 26 May 2014
+// Author: Artem ZHIDKOV
+
+#ifndef SketchPlugin_Circle_HeaderFile
+#define SketchPlugin_Circle_HeaderFile
+
+#include "SketchPlugin.h"
+#include <SketchPlugin_Feature.h>
+
+/// 2D point - center of the circle
+const std::string CIRCLE_ATTR_CENTER("CircleCenter");
+/// Radius of the circle
+const std::string CIRCLE_ATTR_RADIUS("CircleRadius");
+
+/**\class SketchPlugin_Circle
+ * \ingroup DataModel
+ * \brief Feature for creation of the new circle in PartSet.
+ */
+class SketchPlugin_Circle: public SketchPlugin_Feature
+{
+public:
+ /// Returns the kind of a feature
+ SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
+ {static std::string MY_KIND = "SketchCircle"; return MY_KIND;}
+
+ /// Returns to which group in the document must be added feature
+ SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
+ {static std::string MY_GROUP = "Sketch"; return MY_GROUP;}
+
+ /// Creates a new part document if needed
+ SKETCHPLUGIN_EXPORT virtual void execute();
+
+ /// Request for initialization of data model of the feature: adding all attributes
+ SKETCHPLUGIN_EXPORT virtual void initAttributes();
+
+ /// Returns the sketch preview
+ SKETCHPLUGIN_EXPORT virtual const boost::shared_ptr<GeomAPI_Shape>& preview();
+
+ /// Adds sub-feature of the higher level feature (sub-element of the sketch)
+ /// \param theFeature sub-feature
+ SKETCHPLUGIN_EXPORT virtual const void addSub(
+ const boost::shared_ptr<ModelAPI_Feature>& theFeature) {};
+
+ /// Use plugin manager for features creation
+ SketchPlugin_Circle();
+};
+
+#endif
--- /dev/null
+// File: SketchPlugin_ConstraintDiameter.cpp
+// Created: 26 May 2014
+// Author: Artem ZHIDKOV
+
+#include "SketchPlugin_ConstraintDiameter.h"
+
+#include <ModelAPI_AttributeDouble.h>
+#include <ModelAPI_Data.h>
+#include <SketchPlugin_Point.h>
+
+SketchPlugin_ConstraintDiameter::SketchPlugin_ConstraintDiameter()
+{
+}
+
+void SketchPlugin_ConstraintDiameter::initAttributes()
+{
+ data()->addAttribute(CONSTRAINT_ATTR_VALUE, ModelAPI_AttributeDouble::type());
+ data()->addAttribute(CONSTRAINT_ATTR_ENTITY_A, ModelAPI_AttributeRefAttr::type());
+}
+
+void SketchPlugin_ConstraintDiameter::execute()
+{
+}
+
+const boost::shared_ptr<GeomAPI_Shape>& SketchPlugin_ConstraintDiameter::preview()
+{
+ /// \todo Preview for diameter constraint
+ return getPreview();
+}
+
--- /dev/null
+// File: SketchPlugin_ConstraintDiameter.h
+// Created: 26 May 2014
+// Author: Artem ZHIDKOV
+
+#ifndef SketchPlugin_ConstraintDiameter_HeaderFile
+#define SketchPlugin_ConstraintDiameter_HeaderFile
+
+#include "SketchPlugin.h"
+#include "SketchPlugin_Constraint.h"
+
+
+/** \class SketchPlugin_ConstraintDiameter
+ * \ingroup DataModel
+ * \brief Feature for creation of a new constraint which defines a diameter of a circle
+ *
+ * These constraint has two attributes:
+ * CONSTRAINT_ATTR_VALUE (diameter), CONSTRAINT_ATTR_ENTITY_A (a circle)
+ */
+class SketchPlugin_ConstraintDiameter: public SketchPlugin_Constraint
+{
+public:
+ /// \brief Returns the kind of a feature
+ SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
+ {static std::string MY_KIND = "SketchConstraintDiameter"; return MY_KIND;}
+
+ /// \brief Returns to which group in the document must be added feature
+ SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
+ {static std::string MY_GROUP = "Sketch"; return MY_GROUP;}
+
+ /// \brief Creates a new part document if needed
+ SKETCHPLUGIN_EXPORT virtual void execute();
+
+ /// \brief Request for initialization of data model of the feature: adding all attributes
+ SKETCHPLUGIN_EXPORT virtual void initAttributes();
+
+ /// \brief Returns the sketch preview
+ SKETCHPLUGIN_EXPORT virtual const boost::shared_ptr<GeomAPI_Shape>& preview();
+
+ /// \brief Use plugin manager for features creation
+ SketchPlugin_ConstraintDiameter();
+};
+
+#endif
--- /dev/null
+// File: SketchPlugin_ConstraintParallel.cpp
+// Created: 26 May 2014
+// Author: Artem ZHIDKOV
+
+#include "SketchPlugin_ConstraintParallel.h"
+
+#include <ModelAPI_AttributeDouble.h>
+#include <ModelAPI_Data.h>
+#include <SketchPlugin_Point.h>
+
+SketchPlugin_ConstraintParallel::SketchPlugin_ConstraintParallel()
+{
+}
+
+void SketchPlugin_ConstraintParallel::initAttributes()
+{
+ data()->addAttribute(CONSTRAINT_ATTR_ENTITY_A, ModelAPI_AttributeRefAttr::type());
+ data()->addAttribute(CONSTRAINT_ATTR_ENTITY_B, ModelAPI_AttributeRefAttr::type());
+}
+
+void SketchPlugin_ConstraintParallel::execute()
+{
+}
+
+const boost::shared_ptr<GeomAPI_Shape>& SketchPlugin_ConstraintParallel::preview()
+{
+ /// \todo Preview for parallel constraint
+ return getPreview();
+}
+
--- /dev/null
+// File: SketchPlugin_ConstraintParallel.h
+// Created: 26 May 2014
+// Author: Artem ZHIDKOV
+
+#ifndef SketchPlugin_ConstraintParallel_HeaderFile
+#define SketchPlugin_ConstraintParallel_HeaderFile
+
+#include "SketchPlugin.h"
+#include "SketchPlugin_Constraint.h"
+
+
+/** \class SketchPlugin_ConstraintParallel
+ * \ingroup DataModel
+ * \brief Feature for creation of a new constraint parallelism of two lines
+ *
+ * These constraint has two attributes:
+ * CONSTRAINT_ATTR_ENTITY_A and CONSTRAINT_ATTR_ENTITY_B
+ */
+class SketchPlugin_ConstraintParallel: public SketchPlugin_Constraint
+{
+public:
+ /// \brief Returns the kind of a feature
+ SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
+ {static std::string MY_KIND = "SketchConstraintParallel"; return MY_KIND;}
+
+ /// \brief Returns to which group in the document must be added feature
+ SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
+ {static std::string MY_GROUP = "Sketch"; return MY_GROUP;}
+
+ /// \brief Creates a new part document if needed
+ SKETCHPLUGIN_EXPORT virtual void execute();
+
+ /// \brief Request for initialization of data model of the feature: adding all attributes
+ SKETCHPLUGIN_EXPORT virtual void initAttributes();
+
+ /// \brief Returns the sketch preview
+ SKETCHPLUGIN_EXPORT virtual const boost::shared_ptr<GeomAPI_Shape>& preview();
+
+ /// \brief Use plugin manager for features creation
+ SketchPlugin_ConstraintParallel();
+};
+
+#endif
--- /dev/null
+// File: SketchPlugin_ConstraintPerpendicular.cpp
+// Created: 26 May 2014
+// Author: Artem ZHIDKOV
+
+#include "SketchPlugin_ConstraintPerpendicular.h"
+
+#include <ModelAPI_AttributeDouble.h>
+#include <ModelAPI_Data.h>
+#include <SketchPlugin_Point.h>
+
+SketchPlugin_ConstraintPerpendicular::SketchPlugin_ConstraintPerpendicular()
+{
+}
+
+void SketchPlugin_ConstraintPerpendicular::initAttributes()
+{
+ data()->addAttribute(CONSTRAINT_ATTR_ENTITY_A, ModelAPI_AttributeRefAttr::type());
+ data()->addAttribute(CONSTRAINT_ATTR_ENTITY_B, ModelAPI_AttributeRefAttr::type());
+}
+
+void SketchPlugin_ConstraintPerpendicular::execute()
+{
+}
+
+const boost::shared_ptr<GeomAPI_Shape>& SketchPlugin_ConstraintPerpendicular::preview()
+{
+ /// \todo Preview for perpendicular constraint
+ return getPreview();
+}
+
--- /dev/null
+// File: SketchPlugin_ConstraintPerpendicular.h
+// Created: 26 May 2014
+// Author: Artem ZHIDKOV
+
+#ifndef SketchPlugin_ConstraintPerpendicular_HeaderFile
+#define SketchPlugin_ConstraintPerpendicular_HeaderFile
+
+#include "SketchPlugin.h"
+#include "SketchPlugin_Constraint.h"
+
+
+/** \class SketchPlugin_ConstraintPerpendicular
+ * \ingroup DataModel
+ * \brief Feature for creation of a new constraint for perpendicularity of two lines
+ *
+ * These constraint has two attributes:
+ * CONSTRAINT_ATTR_ENTITY_A and CONSTRAINT_ATTR_ENTITY_B
+ */
+class SketchPlugin_ConstraintPerpendicular: public SketchPlugin_Constraint
+{
+public:
+ /// \brief Returns the kind of a feature
+ SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
+ {static std::string MY_KIND = "SketchConstraintPerpendicular"; return MY_KIND;}
+
+ /// \brief Returns to which group in the document must be added feature
+ SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
+ {static std::string MY_GROUP = "Sketch"; return MY_GROUP;}
+
+ /// \brief Creates a new part document if needed
+ SKETCHPLUGIN_EXPORT virtual void execute();
+
+ /// \brief Request for initialization of data model of the feature: adding all attributes
+ SKETCHPLUGIN_EXPORT virtual void initAttributes();
+
+ /// \brief Returns the sketch preview
+ SKETCHPLUGIN_EXPORT virtual const boost::shared_ptr<GeomAPI_Shape>& preview();
+
+ /// \brief Use plugin manager for features creation
+ SketchPlugin_ConstraintPerpendicular();
+};
+
+#endif
{
public:
/// Returns the kind of a feature
- SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
+ SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
{static std::string MY_KIND = "SketchLine"; return MY_KIND;}
/// Returns to which group in the document must be added feature
- SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
+ SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
{static std::string MY_GROUP = "Sketch"; return MY_GROUP;}
/// Creates a new part document if needed
- SKETCHPLUGIN_EXPORT virtual void execute();
+ SKETCHPLUGIN_EXPORT virtual void execute();
/// Request for initialization of data model of the feature: adding all attributes
- SKETCHPLUGIN_EXPORT virtual void initAttributes();
+ SKETCHPLUGIN_EXPORT virtual void initAttributes();
/// Returns the sketch preview
SKETCHPLUGIN_EXPORT virtual const boost::shared_ptr<GeomAPI_Shape>& preview();
{
public:
/// Returns the kind of a feature
- SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
+ SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
{static std::string MY_KIND = "SketchPoint"; return MY_KIND;}
/// Returns to which group in the document must be added feature
- SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
+ SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
{static std::string MY_GROUP = "Sketch"; return MY_GROUP;}
/// Creates a new part document if needed
- SKETCHPLUGIN_EXPORT virtual void execute();
+ SKETCHPLUGIN_EXPORT virtual void execute();
/// Request for initialization of data model of the feature: adding all attributes
- SKETCHPLUGIN_EXPORT virtual void initAttributes();
+ SKETCHPLUGIN_EXPORT virtual void initAttributes();
/// Returns the sketch preview
SKETCHPLUGIN_EXPORT virtual const boost::shared_ptr<GeomAPI_Shape>& preview();
{
public:
/// Returns the kind of a feature
- SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
+ SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
{static std::string MY_KIND = "Sketch"; return MY_KIND;}
/// Returns to which group in the document must be added feature
- SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
+ SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
{static std::string MY_GROUP = "Construction"; return MY_GROUP;}
/// Creates a new part document if needed
- SKETCHPLUGIN_EXPORT virtual void execute();
+ SKETCHPLUGIN_EXPORT virtual void execute();
/// Request for initialization of data model of the feature: adding all attributes
- SKETCHPLUGIN_EXPORT virtual void initAttributes();
+ SKETCHPLUGIN_EXPORT virtual void initAttributes();
/// Returns the sketch preview
SKETCHPLUGIN_EXPORT virtual const boost::shared_ptr<GeomAPI_Shape>& preview();
<point_selector id="StartPoint" title="Start point" tooltip="Start point of the line"/>
<point_selector id="EndPoint" title="End point" tooltip="End point of the line"/>
</feature>
+ <feature id="SketchCircle" title="Circle" tooltip="Create a new circle" icon="" internal="1">
+ <point_selector id="CircleCenter" title="Center" tooltip="Center of the circle"/>
+ </feature>
+ <feature id="SketchArc" title="Arc" tooltip="Create a new arc of a circle" icon="" internal="1">
+ <point_selector id="ArcCenter" title="Center" tooltip="Center of the arc"/>
+ <point_selector id="ArcStartPoint" title="Start point" tooltip="Start point of the arc"/>
+ <point_selector id="ArcEndPoint" title="End point" tooltip="End point of the arc"/>
+ </feature>
<feature id="SketchConstraintCoincidence" title="Points coincidence" tooltip="Create constraint for the coincidence of two points" internal="1"/>
<feature id="SketchConstraintDistance" title="Distance between objects" tooltip="Create constraint for the distance from a point to an object" internal="1"/>
+ <feature id="SketchConstraintDiameter" title="Diameter of a circle" tooltip="Create constraint for the given diameter of a circle" internal="1"/>
+ <feature id="SketchConstraintParallel" title="Parallelism of a lines" tooltip="Create constraint defining two parallel lines" internal="1"/>
+ <feature id="SketchConstraintPerpendicular" title="Orthgonality of a lines" tooltip="Create constraint defining two perpendicular lines" internal="1"/>
</group>
</workbench>
</plugin>