Skip to content

Commit

Permalink
Sketcher: Add Sketcher Geometry Extension
Browse files Browse the repository at this point in the history
  • Loading branch information
abdullahtahiriyo authored and wwmayer committed Jul 14, 2019
1 parent 2400d63 commit 26d3d90
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/Mod/Sketcher/App/AppSketcher.cpp
Expand Up @@ -65,12 +65,13 @@ PyMOD_INIT_FUNC(Sketcher)
// call PyType_Ready, otherwise we run into a segmentation fault, later on.
// This function is responsible for adding inherited slots from a type's base class.

Sketcher::SketchObjectSF ::init();
Sketcher::SketchObject ::init();
Sketcher::SketchObjectPython ::init();
Sketcher::Sketch ::init();
Sketcher::Constraint ::init();
Sketcher::PropertyConstraintList::init();
Sketcher::SketchGeometryExtension ::init();
Sketcher::SketchObjectSF ::init();
Sketcher::SketchObject ::init();
Sketcher::SketchObjectPython ::init();
Sketcher::Sketch ::init();
Sketcher::Constraint ::init();
Sketcher::PropertyConstraintList ::init();

Base::Console().Log("Loading Sketcher module... done\n");

Expand Down
35 changes: 35 additions & 0 deletions src/Mod/Sketcher/App/SketchObject.cpp
Expand Up @@ -88,6 +88,41 @@
using namespace Sketcher;
using namespace Base;

//---------- Geometry Extension

TYPESYSTEM_SOURCE(Sketcher::SketchGeometryExtension,Part::GeometryExtension)

SketchGeometryExtension::~SketchGeometryExtension()
{
}

// Persistence implementer
unsigned int SketchGeometryExtension::getMemSize (void) const
{
return sizeof(long int);
}

void SketchGeometryExtension::Save(Base::Writer &writer) const
{

writer.Stream() << writer.ind() << "<GeoExtension type=\"" << this->getTypeId().getName()
<< "\" id=\"" << id << "\"/>" << endl;
}

void SketchGeometryExtension::Restore(Base::XMLReader &reader)
{
id = reader.getAttributeAsInteger("id");
}

PyObject * SketchGeometryExtension::getPyObject(void)
{
return 0;
}


//-------------- End Geometry Extension


const int GeoEnum::RtPnt = -1;
const int GeoEnum::HAxis = -1;
const int GeoEnum::VAxis = -2;
Expand Down
17 changes: 17 additions & 0 deletions src/Mod/Sketcher/App/SketchObject.h
Expand Up @@ -41,6 +41,23 @@
namespace Sketcher
{

class SketcherExport SketchGeometryExtension : public Part::GeometryExtension
{
TYPESYSTEM_HEADER();
public:
virtual ~SketchGeometryExtension();

// Persistence implementer ---------------------
virtual unsigned int getMemSize(void) const;
virtual void Save(Base::Writer &/*writer*/) const;
virtual void Restore(Base::XMLReader &/*reader*/);

virtual PyObject *getPyObject(void);

public:
long int id;
};

struct SketcherExport GeoEnum
{
static const int RtPnt;
Expand Down

0 comments on commit 26d3d90

Please sign in to comment.