SketchObject.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef SKETCHER_SKETCHOBJECT_H
00026 #define SKETCHER_SKETCHOBJECT_H
00027
00028 #include <App/PropertyStandard.h>
00029 #include <App/PropertyFile.h>
00030 #include <App/FeaturePython.h>
00031
00032 #include <Mod/Part/App/Part2DObject.h>
00033 #include <Mod/Part/App/PropertyGeometryList.h>
00034 #include <Mod/Sketcher/App/PropertyConstraintList.h>
00035
00036 namespace Sketcher
00037 {
00038
00039 class SketcherExport SketchObject : public Part::Part2DObject
00040 {
00041 PROPERTY_HEADER(Sketcher::SketchObject);
00042
00043 public:
00044 SketchObject();
00045
00047 Part ::PropertyGeometryList Geometry;
00048 Sketcher::PropertyConstraintList Constraints;
00049 App ::PropertyLinkSubList ExternalConstraints;
00052
00053 App::DocumentObjectExecReturn *execute(void);
00054
00056 const char* getViewProviderName(void) const {
00057 return "SketcherGui::ViewProviderSketch";
00058 }
00060
00062 int addGeometry(const Part::Geometry *geo);
00064 int addGeometry(const std::vector<Part::Geometry *> &geoList);
00066 int delGeometry(int GeoNbr);
00068 int addConstraints(const std::vector<Constraint *> &ConstraintList);
00070 int addConstraint(const Constraint *constraint);
00072 int delConstraint(int ConstrId);
00073 int delConstraintOnPoint(int GeoId, PointPos PosId, bool onlyCoincident=true);
00074 int delConstraintOnPoint(int VertexId, bool onlyCoincident=true);
00076 int transferConstraints(int fromGeoId, PointPos fromPosId, int toGeoId, PointPos toPosId);
00078 int addExternal(App::DocumentObject *Obj, const char* SubName);
00080 std::vector<Part::Geometry *> getExternalGeometry(void);
00082 int delExternal(int ConstrId);
00083
00085 int hasConflicts(void) const;
00086
00088 int setDatum(int ConstrId, double Datum);
00090 int movePoint(int geoIndex1, PointPos Pos1, const Base::Vector3d& toPoint, bool relative=false);
00092 Base::Vector3d getPoint(int geoIndex1, PointPos Pos1);
00093
00095 int toggleConstruction(int GeoNbr);
00096
00098 int fillet(int geoId, PointPos pos, double radius, bool trim=true);
00099 int fillet(int geoId1, int geoId2,
00100 const Base::Vector3d& refPnt1, const Base::Vector3d& refPnt2,
00101 double radius, bool trim=true);
00102
00104 int trim(int geoId, const Base::Vector3d& point);
00105
00107 void getGeoVertexIndex(int VertexId, int &GeoId, PointPos &PosId);
00108 int getHighestVertexIndex(void) { return VertexId2GeoId.size() - 1; }
00109 int getHighestCurveIndex(void) { return Geometry.getSize() - 1; }
00110 void rebuildVertexIndex(void);
00111
00113 void getCoincidentPoints(int GeoId, PointPos PosId, std::vector<int> &GeoIdList,
00114 std::vector<PointPos> &PosIdList);
00115 void getCoincidentPoints(int VertexId, std::vector<int> &GeoIdList, std::vector<PointPos> &PosIdList);
00116
00118 static void appendConflictMsg(const std::vector<int> &conflicting, std::string &msg);
00119
00120
00121 virtual PyObject *getPyObject(void);
00122 virtual unsigned int getMemSize(void) const;
00123 virtual void Save(Base::Writer &) const;
00124 virtual void Restore(Base::XMLReader &);
00125
00126 protected:
00128 virtual void onChanged(const App::Property* );
00129
00130 private:
00131 std::vector<int> VertexId2GeoId;
00132 std::vector<PointPos> VertexId2PosId;
00133 };
00134
00135 typedef App::FeaturePythonT<SketchObject> SketchObjectPython;
00136
00137 }
00138
00139
00140 #endif // SKETCHER_SKETCHOBJECT_H