1 // File: SketchPlugin_Sketch.h
2 // Created: 27 Mar 2014
3 // Author: Mikhail PONIKAROV
5 #ifndef SketchPlugin_Sketch_HeaderFile
6 #define SketchPlugin_Sketch_HeaderFile
8 #include "SketchPlugin.h"
9 #include <SketchPlugin_Feature.h>
10 #include <GeomAPI_Pnt.h>
13 /// Origin point of the sketcher in 3D space
14 const std::string SKETCH_ATTR_ORIGIN("Origin");
15 /// Vector X inside of the sketch plane
16 const std::string SKETCH_ATTR_DIRX("DirX");
17 /// Vector Y inside of the sketch plane
18 const std::string SKETCH_ATTR_DIRY("DirY");
19 /// Vector Z, normal to the sketch plane
20 const std::string SKETCH_ATTR_NORM("Norm");
22 /**\class SketchPlugin_Sketch
24 * \brief Feature for creation of the new part in PartSet.
26 class SketchPlugin_Sketch: public SketchPlugin_Feature
29 /// Returns the kind of a feature
30 SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
31 {static std::string MY_KIND = "Sketch"; return MY_KIND;}
33 /// Returns to which group in the document must be added feature
34 SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
35 {static std::string MY_GROUP = "Construction"; return MY_GROUP;}
37 /// Creates a new part document if needed
38 SKETCHPLUGIN_EXPORT virtual void execute();
40 /// Request for initialization of data model of the feature: adding all attributes
41 SKETCHPLUGIN_EXPORT virtual void initAttributes();
43 /// Returns the sketch preview
44 SKETCHPLUGIN_EXPORT virtual const boost::shared_ptr<GeomAPI_Shape>& preview();
46 /// Adds sub-feature of the higher level feature (sub-element of the sketch)
47 /// \param theFeature sub-feature
48 SKETCHPLUGIN_EXPORT virtual const void addSub(
49 const boost::shared_ptr<ModelAPI_Feature>& theFeature);
51 /// Converts a 2D sketch space point into point in 3D space
52 SKETCHPLUGIN_EXPORT boost::shared_ptr<GeomAPI_Pnt> to3D(
53 const double theX, const double theY);
55 /// Use plugin manager for features creation
56 SketchPlugin_Sketch();
58 /// Creates a plane and append it to the list
59 /// \param theX the X normal value
60 /// \param theY the Y normal value
61 /// \param theZ the Z normal value
62 /// \param theShapes the list of result shapes
63 void addPlane(double theX, double theY, double theZ,
64 std::list<boost::shared_ptr<GeomAPI_Shape> >& theShapes) const;