#include <Sketch.h>
Classes | |
struct | GeoDef |
container element to store and work with the geometric elements of this sketch More... | |
Public Types | |
enum | GeoType { None = 0, Point = 1, Line = 2, Arc = 3, Circle = 4, Ellipse = 5 } |
Public Member Functions | |
void | addGeometry (const std::vector< Part::Geometry * > &geo) |
add unspecified geometry | |
int | addGeometry (const Part::Geometry *geo) |
add unspecified geometry | |
void | clear (void) |
delete all geometry and constraints, leave an empty sketch | |
int | diagnose (void) |
returns the degree of freedom of a sketch and calculates a list of conflicting constraints | |
const std::vector< int > & | getConflicting (void) const |
bool | getConstruction (int geoIndex) const |
std::vector< Part::Geometry * > | getGeometry (bool withConstrucionElements=true) const |
returns the actual geometry | |
virtual unsigned int | getMemSize (void) const |
This method is used to get the size of objects It is not meant to have the exact size, it is more or less an estimation which runs fast! Is it two bytes or a GB? | |
Base::Vector3d | getPoint (int geoId, PointPos pos) |
retrieves a point | |
int | getPointId (int geoId, PointPos pos) const |
retrieves the index of a point | |
Py::Tuple | getPyGeometry (void) const |
get the geometry as python objects | |
virtual Base::Type | getTypeId (void) const |
bool | hasConflicts (void) const |
int | initMove (int geoIndex, PointPos pos) |
initializes a point (or curve) drag by setting the current sketch status as a reference | |
int | movePoint (int geoIndex, PointPos pos, Base::Vector3d toPoint, bool relative=false) |
move this point (or curve) to a new location and solve. | |
virtual void | Restore (Base::XMLReader &) |
This method is used to restore properties from an XML document. | |
virtual void | Save (Base::Writer &) const |
This method is used to save properties to an XML document. | |
void | setConstruction (int geoIndex, bool isConstruction=true) |
set a geometric element to a construction element | |
int | setDatum (int constrId, double value) |
set the datum of a distance or angle constraint to a certain value and solve This can cause the solving to fail! | |
int | setUpSketch (const std::vector< Part::Geometry * > &GeoList, const std::vector< Constraint * > &ConstraintList, bool withDiagnose=true) |
set the sketch up with geoms and constraints | |
Sketch () | |
int | solve (void) |
solve the actual set up sketch | |
Part::TopoShape | toShape (void) const |
return the actual geometry of the sketch a TopoShape | |
~Sketch () | |
int | addAngleConstraint (int geoIndex1, PointPos pos1, int geoIndex2, PointPos pos2, double value) |
int | addAngleConstraint (int geoIndex1, int geoIndex2, double value) |
int | addAngleConstraint (int geoIndex, double value) |
add an angle constraint on a line or between two lines | |
int | addArc (const Part::GeomArcOfCircle &circleSegment) |
add a arc (circle segment) | |
int | addCircle (const Part::GeomCircle &circle) |
add a circle | |
int | addConstraint (const Constraint *constraint) |
add one constraint to the sketch | |
int | addConstraints (const std::vector< Constraint * > &ConstraintList) |
constraints | |
int | addCoordinateXConstraint (int geoIndex, PointPos pos, double value) |
add a fixed coordinate constraint to a point | |
int | addCoordinateYConstraint (int geoIndex, PointPos pos, double value) |
int | addDistanceConstraint (int geoIndex1, PointPos pos1, int geoIndex2, PointPos pos2, double value) |
int | addDistanceConstraint (int geoIndex1, PointPos pos1, int geoIndex2, double value) |
int | addDistanceConstraint (int geoIndex1, int geoIndex2, double value) |
int | addDistanceConstraint (int geoIndex1, double value) |
add a length or distance constraint | |
int | addDistanceXConstraint (int geoId1, PointPos pos1, int geoId2, PointPos pos2, double value) |
int | addDistanceXConstraint (int geoId, double value) |
add a horizontal distance constraint to two points or line ends | |
int | addDistanceYConstraint (int geoId1, PointPos pos1, int geoId2, PointPos pos2, double value) |
int | addDistanceYConstraint (int geoId, double value) |
add a vertical distance constraint to two points or line ends | |
int | addEllipse (const Part::GeomEllipse &ellipse) |
add a ellipse | |
int | addEqualConstraint (int geoIndex1, int geoIndex2) |
add an equal length or radius constraints between two lines or between circles and arcs | |
int | addHorizontalConstraint (int geoIndex1, PointPos pos1, int geoIndex2, PointPos pos2) |
int | addHorizontalConstraint (int geoIndex) |
add a horizontal constraint to a geometry | |
int | addLine (const Part::GeomLineSegment &line) |
add an infinite line | |
int | addLineSegment (const Part::GeomLineSegment &lineSegment) |
add a line segment | |
int | addParallelConstraint (int geoIndex1, int geoIndex2) |
add a parallel constraint between two lines | |
int | addPerpendicularConstraint (int geoIndex1, int geoIndex2) |
add a perpendicular constraint between two lines | |
int | addPoint (const Base::Vector3d &point) |
add dedicated geometry | |
int | addPointCoincidentConstraint (int geoIndex1, PointPos pos1, int geoIndex2, PointPos pos2) |
add a coincident constraint to two points of two geometries | |
int | addPointOnObjectConstraint (int geoId1, PointPos pos1, int geoId2) |
add a point on line constraint | |
int | addRadiusConstraint (int geoIndex, double value) |
add a radius constraint on a circle or an arc | |
int | addSymmetricConstraint (int geoId1, PointPos pos1, int geoId2, PointPos pos2, int geoId3) |
add a symmetric constraint between two points with respect to a line | |
int | addTangentConstraint (int geoIndex1, PointPos pos1, int geoIndex2, PointPos pos2) |
int | addTangentConstraint (int geoIndex1, PointPos pos1, int geoIndex2) |
int | addTangentConstraint (int geoIndex1, int geoIndex2) |
add a tangency constraint between two geometries | |
int | addVerticalConstraint (int geoIndex1, PointPos pos1, int geoIndex2, PointPos pos2) |
int | addVerticalConstraint (int geoIndex) |
add a vertical constraint to a geometry | |
Static Public Member Functions | |
static void * | create (void) |
static Base::Type | getClassTypeId (void) |
static void | init (void) |
Public Attributes | |
float | SolveTime |
Protected Attributes | |
std::vector< GCS::Arc > | Arcs |
std::vector< GCS::Circle > | Circles |
std::vector< int > | Conflicting |
int | ConstraintsCounter |
std::vector< double * > | FixParameters |
GCS::System | GCSsys |
std::vector< GeoDef > | Geoms |
std::vector< double > | InitParameters |
bool | isInitMove |
std::vector< GCS::Line > | Lines |
std::vector< double > | MoveParameters |
std::vector< double * > | Parameters |
std::vector< GCS::Point > | Points |
Definition at line 39 of file Sketch.h.
Sketch::Sketch | ( | ) |
Definition at line 62 of file Sketch.cpp.
Sketch::~Sketch | ( | ) |
Definition at line 78 of file Sketch.cpp.
References clear().
int Sketch::addAngleConstraint | ( | int | geoIndex1, | |
PointPos | pos1, | |||
int | geoIndex2, | |||
PointPos | pos2, | |||
double | value | |||
) |
Definition at line 1149 of file Sketch.cpp.
References GCS::System::addConstraintL2LAngle(), draftlibs::fcvec::angle(), ConstraintsCounter, Sketcher::end, FixParameters, GCSsys, Geoms, Line, Points, Sketcher::start, and Py::type().
int Sketch::addAngleConstraint | ( | int | geoIndex1, | |
int | geoIndex2, | |||
double | value | |||
) |
Definition at line 1127 of file Sketch.cpp.
References GCS::System::addConstraintL2LAngle(), draftlibs::fcvec::angle(), ConstraintsCounter, FixParameters, GCSsys, Geoms, Mod::PartDesign::Scripts::Gear::l1, Mod::PartDesign::Scripts::Gear::l2, Line, Lines, and Py::type().
int Sketch::addAngleConstraint | ( | int | geoIndex, | |
double | value | |||
) |
add an angle constraint on a line or between two lines
Definition at line 1109 of file Sketch.cpp.
References GCS::System::addConstraintP2PAngle(), draftlibs::fcvec::angle(), ConstraintsCounter, FixParameters, GCSsys, Geoms, RobotExample::l, Line, Lines, GCS::Line::p1, GCS::Line::p2, and Py::type().
Referenced by addConstraint().
int Sketch::addArc | ( | const Part::GeomArcOfCircle & | circleSegment | ) |
add a arc (circle segment)
Definition at line 273 of file Sketch.cpp.
References GCS::System::addConstraintArcRules(), Arc, Arcs, GCS::Arc::center, Part::GeomArcOfCircle::clone(), Part::Geometry::Construction, Sketcher::Sketch::GeoDef::construction, GCS::Arc::end, GCS::Arc::endAngle, Sketcher::Sketch::GeoDef::endPointId, GCSsys, Sketcher::Sketch::GeoDef::geo, Geoms, Part::GeomArcOfCircle::getCenter(), Part::GeomArcOfCircle::getEndPoint(), Part::GeomArcOfCircle::getRadius(), Part::GeomArcOfCircle::getRange(), Part::GeomArcOfCircle::getStartPoint(), Sketcher::Sketch::GeoDef::index, Sketcher::Sketch::GeoDef::midPointId, Parameters, Points, GCS::Arc::rad, GCS::Arc::start, GCS::Arc::startAngle, Sketcher::Sketch::GeoDef::startPointId, Sketcher::Sketch::GeoDef::type, GCS::Point::x, Base::Vector3< _Precision >::x, GCS::Point::y, and Base::Vector3< _Precision >::y.
Referenced by addGeometry(), and setUpSketch().
int Sketch::addCircle | ( | const Part::GeomCircle & | circle | ) |
add a circle
Definition at line 342 of file Sketch.cpp.
References GCS::Circle::center, Circles, Part::GeomCircle::clone(), Part::Geometry::Construction, Sketcher::Sketch::GeoDef::construction, Sketcher::Sketch::GeoDef::geo, Geoms, Part::GeomCircle::getCenter(), Part::GeomCircle::getRadius(), Sketcher::Sketch::GeoDef::index, Sketcher::Sketch::GeoDef::midPointId, Parameters, Points, GCS::Circle::rad, Sketcher::Sketch::GeoDef::type, GCS::Point::x, Base::Vector3< _Precision >::x, GCS::Point::y, and Base::Vector3< _Precision >::y.
Referenced by addGeometry(), and setUpSketch().
int Sketch::addConstraint | ( | const Constraint * | constraint | ) |
add one constraint to the sketch
Definition at line 448 of file Sketch.cpp.
References addAngleConstraint(), addCoordinateXConstraint(), addCoordinateYConstraint(), addDistanceConstraint(), addDistanceXConstraint(), addDistanceYConstraint(), addEqualConstraint(), addHorizontalConstraint(), addParallelConstraint(), addPerpendicularConstraint(), addPointCoincidentConstraint(), addPointOnObjectConstraint(), addRadiusConstraint(), addSymmetricConstraint(), addTangentConstraint(), addVerticalConstraint(), Sketcher::Angle, Sketcher::Coincident, Sketcher::Distance, Sketcher::DistanceX, Sketcher::DistanceY, Sketcher::Equal, Sketcher::Constraint::First, Sketcher::Constraint::FirstPos, Geoms, Sketcher::Constraint::GeoUndef, Sketcher::Horizontal, None, Sketcher::none, Sketcher::Parallel, Sketcher::Perpendicular, Sketcher::PointOnObject, Sketcher::Radius, Sketcher::Constraint::Second, Sketcher::Constraint::SecondPos, Sketcher::Symmetric, Sketcher::Tangent, Sketcher::Constraint::Third, Sketcher::Constraint::Type, Sketcher::Constraint::Value, and Sketcher::Vertical.
Referenced by Sketcher::SketchPy::addConstraint(), and addConstraints().
int Sketch::addConstraints | ( | const std::vector< Constraint * > & | ConstraintList | ) |
constraints
add all constraints in the list
Definition at line 550 of file Sketch.cpp.
References addConstraint(), and Geoms.
Referenced by Sketcher::SketchPy::addConstraint(), and setUpSketch().
int Sketch::addCoordinateXConstraint | ( | int | geoIndex, | |
PointPos | pos, | |||
double | value | |||
) |
add a fixed coordinate constraint to a point
Definition at line 562 of file Sketch.cpp.
References GCS::System::addConstraintCoordinateX(), ConstraintsCounter, FixParameters, GCSsys, getPointId(), draftTools::p, and Points.
Referenced by addConstraint().
int Sketch::addCoordinateYConstraint | ( | int | geoIndex, | |
PointPos | pos, | |||
double | value | |||
) |
Definition at line 577 of file Sketch.cpp.
References GCS::System::addConstraintCoordinateY(), ConstraintsCounter, FixParameters, GCSsys, getPointId(), draftTools::p, and Points.
Referenced by addConstraint().
int Sketch::addDistanceConstraint | ( | int | geoIndex1, | |
PointPos | pos1, | |||
int | geoIndex2, | |||
PointPos | pos2, | |||
double | value | |||
) |
Definition at line 1062 of file Sketch.cpp.
References GCS::System::addConstraintP2PDistance(), ConstraintsCounter, FixParameters, GCSsys, getPointId(), and Points.
int Sketch::addDistanceConstraint | ( | int | geoIndex1, | |
PointPos | pos1, | |||
int | geoIndex2, | |||
double | value | |||
) |
Definition at line 1039 of file Sketch.cpp.
References GCS::System::addConstraintP2LDistance(), ConstraintsCounter, FixParameters, GCSsys, Geoms, getPointId(), Mod::PartDesign::Scripts::Gear::l2, Line, Lines, Points, and Py::type().
int Sketch::addDistanceConstraint | ( | int | geoIndex1, | |
int | geoIndex2, | |||
double | value | |||
) |
Definition at line 1025 of file Sketch.cpp.
References Base::Console(), Geoms, and Base::ConsoleSingleton::Warning().
int Sketch::addDistanceConstraint | ( | int | geoIndex1, | |
double | value | |||
) |
add a length or distance constraint
Definition at line 1007 of file Sketch.cpp.
References GCS::System::addConstraintP2PDistance(), ConstraintsCounter, FixParameters, GCSsys, Geoms, RobotExample::l, Line, Lines, GCS::Line::p1, GCS::Line::p2, and Py::type().
Referenced by addConstraint().
int Sketch::addDistanceXConstraint | ( | int | geoId1, | |
PointPos | pos1, | |||
int | geoId2, | |||
PointPos | pos2, | |||
double | value | |||
) |
Definition at line 624 of file Sketch.cpp.
References GCS::System::addConstraintDifference(), ConstraintsCounter, FixParameters, GCSsys, getPointId(), Points, and GCS::Point::x.
int Sketch::addDistanceXConstraint | ( | int | geoId, | |
double | value | |||
) |
add a horizontal distance constraint to two points or line ends
Definition at line 592 of file Sketch.cpp.
References GCS::System::addConstraintDifference(), ConstraintsCounter, KDL::diff(), FixParameters, GCSsys, Geoms, RobotExample::l, Line, Lines, GCS::Line::p1, GCS::Line::p2, and Py::type().
Referenced by addConstraint().
int Sketch::addDistanceYConstraint | ( | int | geoId1, | |
PointPos | pos1, | |||
int | geoId2, | |||
PointPos | pos2, | |||
double | value | |||
) |
Definition at line 644 of file Sketch.cpp.
References GCS::System::addConstraintDifference(), ConstraintsCounter, FixParameters, GCSsys, getPointId(), Points, and GCS::Point::y.
int Sketch::addDistanceYConstraint | ( | int | geoId, | |
double | value | |||
) |
add a vertical distance constraint to two points or line ends
Definition at line 608 of file Sketch.cpp.
References GCS::System::addConstraintDifference(), ConstraintsCounter, KDL::diff(), FixParameters, GCSsys, Geoms, RobotExample::l, Line, Lines, GCS::Line::p1, GCS::Line::p2, and Py::type().
Referenced by addConstraint().
int Sketch::addEllipse | ( | const Part::GeomEllipse & | ellipse | ) |
int Sketch::addEqualConstraint | ( | int | geoIndex1, | |
int | geoIndex2 | |||
) |
add an equal length or radius constraints between two lines or between circles and arcs
Definition at line 1188 of file Sketch.cpp.
References GCS::System::addConstraintEqualLength(), GCS::System::addConstraintEqualRadius(), Arc, Arcs, Mod::PartDesign::Scripts::Gear::c1, Circles, Base::Console(), ConstraintsCounter, GCSsys, Geoms, Mod::PartDesign::Scripts::Gear::l1, Mod::PartDesign::Scripts::Gear::l2, Line, Lines, nameByType(), GCS::Line::p1, GCS::Line::p2, Parameters, KDL::sqrt(), boost::numeric::bindings::atlas::swap(), Py::type(), Py::value(), and Base::ConsoleSingleton::Warning().
Referenced by addConstraint().
void Sketch::addGeometry | ( | const std::vector< Part::Geometry * > & | geo | ) |
int Sketch::addGeometry | ( | const Part::Geometry * | geo | ) |
add unspecified geometry
Definition at line 166 of file Sketch.cpp.
References addArc(), addCircle(), addLineSegment(), getClassTypeId(), and Part::Geometry::getTypeId().
Referenced by addGeometry().
Definition at line 678 of file Sketch.cpp.
References GCS::System::addConstraintHorizontal(), ConstraintsCounter, GCSsys, getPointId(), and Points.
int Sketch::addHorizontalConstraint | ( | int | geoIndex | ) |
add a horizontal constraint to a geometry
Definition at line 665 of file Sketch.cpp.
References GCS::System::addConstraintHorizontal(), ConstraintsCounter, GCSsys, Geoms, RobotExample::l, Line, Lines, and Py::type().
Referenced by addConstraint().
int Sketch::addLine | ( | const Part::GeomLineSegment & | line | ) |
int Sketch::addLineSegment | ( | const Part::GeomLineSegment & | lineSegment | ) |
add a line segment
Definition at line 226 of file Sketch.cpp.
References Part::GeomLineSegment::clone(), Part::Geometry::Construction, Sketcher::Sketch::GeoDef::construction, Sketcher::end, Sketcher::Sketch::GeoDef::endPointId, Sketcher::Sketch::GeoDef::geo, Geoms, Part::GeomLineSegment::getEndPoint(), Part::GeomLineSegment::getStartPoint(), Sketcher::Sketch::GeoDef::index, RobotExample::l, Line, Lines, GCS::Line::p1, GCS::Line::p2, Parameters, Points, Sketcher::start, Sketcher::Sketch::GeoDef::startPointId, Sketcher::Sketch::GeoDef::type, GCS::Point::x, Base::Vector3< _Precision >::x, GCS::Point::y, and Base::Vector3< _Precision >::y.
Referenced by addGeometry(), and setUpSketch().
int Sketch::addParallelConstraint | ( | int | geoIndex1, | |
int | geoIndex2 | |||
) |
add a parallel constraint between two lines
Definition at line 743 of file Sketch.cpp.
References GCS::System::addConstraintParallel(), ConstraintsCounter, GCSsys, Geoms, Mod::PartDesign::Scripts::Gear::l1, Mod::PartDesign::Scripts::Gear::l2, Line, Lines, and Py::type().
Referenced by addConstraint().
int Sketch::addPerpendicularConstraint | ( | int | geoIndex1, | |
int | geoIndex2 | |||
) |
add a perpendicular constraint between two lines
Definition at line 758 of file Sketch.cpp.
References GCS::System::addConstraintPerpendicular(), Arc, Arcs, Circles, Base::Console(), ConstraintsCounter, GCSsys, Geoms, RobotExample::l, Mod::PartDesign::Scripts::Gear::l1, Mod::PartDesign::Scripts::Gear::l2, Line, Lines, nameByType(), boost::numeric::bindings::atlas::swap(), Py::type(), and Base::ConsoleSingleton::Warning().
Referenced by addConstraint().
int Sketch::addPoint | ( | const Base::Vector3d & | point | ) |
add dedicated geometry
add a point
Definition at line 192 of file Sketch.cpp.
References Sketcher::Sketch::GeoDef::construction, Sketcher::Sketch::GeoDef::geo, Geoms, Parameters, Point, Points, Sketcher::Sketch::GeoDef::startPointId, Sketcher::Sketch::GeoDef::type, GCS::Point::x, Base::Vector3< _Precision >::x, GCS::Point::y, and Base::Vector3< _Precision >::y.
int Sketch::addPointCoincidentConstraint | ( | int | geoIndex1, | |
PointPos | pos1, | |||
int | geoIndex2, | |||
PointPos | pos2 | |||
) |
add a coincident constraint to two points of two geometries
Definition at line 724 of file Sketch.cpp.
References GCS::System::addConstraintP2PCoincident(), ConstraintsCounter, GCSsys, getPointId(), and Points.
Referenced by addConstraint().
int Sketch::addPointOnObjectConstraint | ( | int | geoId1, | |
PointPos | pos1, | |||
int | geoId2 | |||
) |
add a point on line constraint
Definition at line 1247 of file Sketch.cpp.
References GCS::System::addConstraintPointOnArc(), GCS::System::addConstraintPointOnCircle(), GCS::System::addConstraintPointOnLine(), Arc, Arcs, Circles, ConstraintsCounter, GCSsys, Geoms, getPointId(), Mod::PartDesign::Scripts::Gear::l2, Line, Lines, Points, and Py::type().
Referenced by addConstraint().
int Sketch::addRadiusConstraint | ( | int | geoIndex, | |
double | value | |||
) |
add a radius constraint on a circle or an arc
Definition at line 1083 of file Sketch.cpp.
References GCS::System::addConstraintArcRadius(), GCS::System::addConstraintCircleRadius(), Arc, Arcs, Circles, ConstraintsCounter, FixParameters, GCSsys, Geoms, and Py::type().
Referenced by addConstraint().
int Sketch::addSymmetricConstraint | ( | int | geoId1, | |
PointPos | pos1, | |||
int | geoId2, | |||
PointPos | pos2, | |||
int | geoId3 | |||
) |
add a symmetric constraint between two points with respect to a line
Definition at line 1278 of file Sketch.cpp.
References GCS::System::addConstraintP2PSymmetric(), ConstraintsCounter, GCSsys, Geoms, getPointId(), RobotExample::l, Line, Lines, Points, and Py::type().
Referenced by addConstraint().
Definition at line 908 of file Sketch.cpp.
References GCS::System::addConstraintP2PCoincident(), GCS::System::addConstraintParallel(), GCS::System::addConstraintTangent(), GCS::System::addConstraintTangentArc2Line(), GCS::System::addConstraintTangentLine2Arc(), Arc, Arcs, Base::Console(), ConstraintsCounter, Sketcher::end, GCSsys, Geoms, getPointId(), Mod::PartDesign::Scripts::Gear::l1, Mod::PartDesign::Scripts::Gear::l2, Line, Lines, Sketcher::mid, GCS::Line::p1, GCS::Line::p2, Points, Sketcher::start, boost::numeric::bindings::atlas::swap(), Py::type(), and Base::ConsoleSingleton::Warning().
int Sketch::addTangentConstraint | ( | int | geoIndex1, | |
PointPos | pos1, | |||
int | geoIndex2 | |||
) |
Definition at line 841 of file Sketch.cpp.
References GCS::System::addConstraintParallel(), GCS::System::addConstraintPointOnArc(), GCS::System::addConstraintPointOnCircle(), GCS::System::addConstraintPointOnLine(), GCS::System::addConstraintTangent(), addTangentConstraint(), Arc, Arcs, Circles, Base::Console(), ConstraintsCounter, GCSsys, Geoms, getPointId(), Mod::PartDesign::Scripts::Gear::l1, Mod::PartDesign::Scripts::Gear::l2, Line, Lines, Points, Py::type(), and Base::ConsoleSingleton::Warning().
int Sketch::addTangentConstraint | ( | int | geoIndex1, | |
int | geoIndex2 | |||
) |
add a tangency constraint between two geometries
Definition at line 796 of file Sketch.cpp.
References GCS::System::addConstraintPointOnLine(), GCS::System::addConstraintTangent(), Arc, Arcs, Circles, Base::Console(), ConstraintsCounter, GCSsys, Geoms, RobotExample::l, Mod::PartDesign::Scripts::Gear::l1, Line, Lines, Points, boost::numeric::bindings::atlas::swap(), Py::type(), and Base::ConsoleSingleton::Warning().
Referenced by addConstraint(), and addTangentConstraint().
Definition at line 708 of file Sketch.cpp.
References GCS::System::addConstraintVertical(), ConstraintsCounter, GCSsys, getPointId(), and Points.
int Sketch::addVerticalConstraint | ( | int | geoIndex | ) |
add a vertical constraint to a geometry
Definition at line 695 of file Sketch.cpp.
References GCS::System::addConstraintVertical(), ConstraintsCounter, GCSsys, Geoms, RobotExample::l, Line, Lines, and Py::type().
Referenced by addConstraint().
void Sketch::clear | ( | void | ) |
delete all geometry and constraints, leave an empty sketch
Definition at line 83 of file Sketch.cpp.
References Arcs, Circles, GCS::System::clear(), Conflicting, ConstraintsCounter, FixParameters, GCSsys, Geoms, isInitMove, Lines, Parameters, and Points.
Referenced by setUpSketch(), and ~Sketch().
void * Sketcher::Sketch::create | ( | void | ) | [static] |
Reimplemented from Base::Persistence.
Definition at line 60 of file Sketch.cpp.
int Sketch::diagnose | ( | void | ) |
returns the degree of freedom of a sketch and calculates a list of conflicting constraints
0 degrees of freedom correspond to a fully constrained sketch -1 degrees of freedom correspond to an over-constrained sketch positive degrees of freedom correspond to an under-constrained sketch
an over-constrained sketch will always contain conflicting constraints a fully constrained or under-constrained sketch may contain conflicting constraints or may not
Definition at line 1622 of file Sketch.cpp.
References Conflicting, GCS::System::diagnose(), GCSsys, GCS::System::isInit(), and Parameters.
Referenced by setUpSketch().
Base::Type Sketcher::Sketch::getClassTypeId | ( | void | ) | [static] |
Reimplemented from Base::Persistence.
Definition at line 60 of file Sketch.cpp.
Referenced by addGeometry(), and setUpSketch().
const std::vector<int>& Sketcher::Sketch::getConflicting | ( | void | ) | const [inline] |
Definition at line 91 of file Sketch.h.
Referenced by Sketcher::SketchObject::execute(), SketcherGui::ViewProviderSketch::setEdit(), and SketcherGui::ViewProviderSketch::updateData().
bool Sketch::getConstruction | ( | int | geoIndex | ) | const |
Definition at line 439 of file Sketch.cpp.
References Geoms.
std::vector< Part::Geometry * > Sketch::getGeometry | ( | bool | withConstrucionElements = true |
) | const |
returns the actual geometry
Definition at line 390 of file Sketch.cpp.
References Geoms.
Referenced by SketcherGui::ViewProviderSketch::draw(), Sketcher::SketchObject::execute(), SketcherGui::ViewProviderSketch::moveConstraint(), Sketcher::SketchObject::movePoint(), and Sketcher::SketchObject::setDatum().
unsigned int Sketch::getMemSize | ( | void | ) | const [virtual] |
This method is used to get the size of objects It is not meant to have the exact size, it is more or less an estimation which runs fast! Is it two bytes or a GB?
Implements Base::Persistence.
Definition at line 1726 of file Sketch.cpp.
Base::Vector3d Sketch::getPoint | ( | int | geoId, | |
PointPos | pos | |||
) |
retrieves a point
Definition at line 1613 of file Sketch.cpp.
References getPointId(), Points, MovieTool::x, and MovieTool::y.
Referenced by SketcherGui::ViewProviderSketch::draw(), and SketcherGui::ViewProviderSketch::moveConstraint().
int Sketch::getPointId | ( | int | geoId, | |
PointPos | pos | |||
) | const |
retrieves the index of a point
Definition at line 1597 of file Sketch.cpp.
References Sketcher::end, Geoms, Sketcher::mid, Sketcher::none, and Sketcher::start.
Referenced by addCoordinateXConstraint(), addCoordinateYConstraint(), addDistanceConstraint(), addDistanceXConstraint(), addDistanceYConstraint(), addHorizontalConstraint(), addPointCoincidentConstraint(), addPointOnObjectConstraint(), addSymmetricConstraint(), addTangentConstraint(), addVerticalConstraint(), and getPoint().
Py::Tuple Sketch::getPyGeometry | ( | void | ) | const |
get the geometry as python objects
Definition at line 403 of file Sketch.cpp.
References Arc, Py::asObject(), Ellipse, Geoms, Line, Point, Points, MovieTool::x, and MovieTool::y.
Referenced by Sketcher::SketchPy::getGeometries().
Base::Type Sketcher::Sketch::getTypeId | ( | void | ) | const [virtual] |
Reimplemented from Base::Persistence.
Definition at line 60 of file Sketch.cpp.
bool Sketcher::Sketch::hasConflicts | ( | void | ) | const [inline] |
Definition at line 90 of file Sketch.h.
Referenced by Sketcher::SketchObject::execute(), Sketcher::SketchObject::hasConflicts(), initMove(), SketcherGui::ViewProviderSketch::mouseMove(), Sketcher::SketchObject::movePoint(), movePoint(), Sketcher::SketchObject::setDatum(), SketcherGui::ViewProviderSketch::setEdit(), and SketcherGui::ViewProviderSketch::updateData().
void Sketcher::Sketch::init | ( | void | ) | [static] |
Reimplemented from Base::Persistence.
Definition at line 60 of file Sketch.cpp.
Referenced by initSketcher().
int Sketch::initMove | ( | int | geoIndex, | |
PointPos | pos | |||
) |
initializes a point (or curve) drag by setting the current sketch status as a reference
Definition at line 1433 of file Sketch.cpp.
References GCS::System::addConstraintP2PCoincident(), GCS::System::addConstraintPointOnArc(), GCS::System::addConstraintPointOnCircle(), Arc, Arcs, Circles, GCS::System::clearByTag(), Sketcher::end, GCSsys, Geoms, hasConflicts(), InitParameters, GCS::System::initSolution(), isInitMove, RobotExample::l, Line, Lines, Sketcher::mid, MoveParameters, Sketcher::none, draftTools::p, GCS::Line::p1, GCS::Line::p2, Parameters, Points, GCS::Arc::rad, GCS::Circle::rad, GCS::System::rescaleConstraint(), Sketcher::start, Py::type(), GCS::Point::x, and GCS::Point::y.
Referenced by SketcherGui::ViewProviderSketch::mouseMove(), and movePoint().
int Sketch::movePoint | ( | int | geoIndex, | |
PointPos | pos, | |||
Base::Vector3d | toPoint, | |||
bool | relative = false | |||
) |
move this point (or curve) to a new location and solve.
This will introduce some additional weak constraints expressing a condition for satisfying the new point location! The relative flag permits moving relatively to the current position
Definition at line 1548 of file Sketch.cpp.
References Arc, Sketcher::end, Geoms, hasConflicts(), initMove(), InitParameters, isInitMove, Line, Sketcher::mid, MoveParameters, Sketcher::none, solve(), Sketcher::start, Py::type(), Base::Vector3< _Precision >::x, and Base::Vector3< _Precision >::y.
Referenced by SketcherGui::ViewProviderSketch::mouseMove(), and Sketcher::SketchObject::movePoint().
void Sketch::Restore | ( | Base::XMLReader & | ) | [virtual] |
This method is used to restore properties from an XML document.
It uses the XMLReader class, which bases on SAX, to read the in Save() written information. Again the Vector as an example:
void PropertyVector::Restore(Base::XMLReader &reader) { // read my Element reader.readElement("PropertyVector"); // get the value of my Attribute _cVec.x = (float)reader.getAttributeAsFloat("valueX"); _cVec.y = (float)reader.getAttributeAsFloat("valueY"); _cVec.z = (float)reader.getAttributeAsFloat("valueZ"); }
Implements Base::Persistence.
Definition at line 1736 of file Sketch.cpp.
void Sketch::Save | ( | Base::Writer & | ) | const [virtual] |
This method is used to save properties to an XML document.
A good example you'll find in PropertyStandard.cpp, e.g. the vector:
void PropertyVector::Save (Writer &writer) const { writer << writer.ind() << "<PropertyVector valueX=\"" << _cVec.x << "\" valueY=\"" << _cVec.y << "\" valueZ=\"" << _cVec.z <<"\"/>" << endl; }
The writer.ind() expression writes the indention, just for pretty printing of the XML. As you see, the writing of the XML document is not done with a DOM implementation because of performance reasons. Therefore the programmer has to take care that a valid XML document is written. This means closing tags and writing UTF-8.
Implements Base::Persistence.
Definition at line 1731 of file Sketch.cpp.
void Sketch::setConstruction | ( | int | geoIndex, | |
bool | isConstruction = true | |||
) |
set a geometric element to a construction element
Definition at line 432 of file Sketch.cpp.
References Geoms.
int Sketch::setDatum | ( | int | constrId, | |
double | value | |||
) |
set the datum of a distance or angle constraint to a certain value and solve This can cause the solving to fail!
Definition at line 1592 of file Sketch.cpp.
int Sketch::setUpSketch | ( | const std::vector< Part::Geometry * > & | GeoList, | |
const std::vector< Constraint * > & | ConstraintList, | |||
bool | withDiagnose = true | |||
) |
set the sketch up with geoms and constraints
Definition at line 110 of file Sketch.cpp.
References addArc(), addCircle(), addConstraints(), addLineSegment(), clear(), GCS::System::clearByTag(), diagnose(), GCSsys, Geoms, getClassTypeId(), GCS::System::initSolution(), and Parameters.
Referenced by Sketcher::SketchObject::execute(), Sketcher::SketchObject::hasConflicts(), Sketcher::SketchObject::movePoint(), Sketcher::SketchObject::setDatum(), SketcherGui::ViewProviderSketch::setEdit(), and SketcherGui::ViewProviderSketch::updateData().
int Sketch::solve | ( | void | ) |
solve the actual set up sketch
Definition at line 1349 of file Sketch.cpp.
References GCS::System::addConstraintEqual(), GCS::System::applySolution(), GCS::BFGS, GCS::System::clearByTag(), Base::Console(), Base::TimeInfo::diffTimeF(), GCS::DogLeg, GCSsys, InitParameters, GCS::System::initSolution(), isInitMove, GCS::LevenbergMarquardt, Base::ConsoleSingleton::Log(), Parameters, GCS::System::solve(), SolveTime, GCS::Success, GCS::System::undoSolution(), and Base::ConsoleSingleton::Warning().
Referenced by Sketcher::SketchObject::execute(), movePoint(), Sketcher::SketchObject::setDatum(), SketcherGui::ViewProviderSketch::setEdit(), and SketcherGui::ViewProviderSketch::updateData().
TopoShape Sketch::toShape | ( | void | ) | const |
return the actual geometry of the sketch a TopoShape
Definition at line 1636 of file Sketch.cpp.
References Part::TopoShape::_Shape, Base::Console(), Part::TopoShape::fuse(), Geoms, result, Base::ConsoleSingleton::Warning(), and Mesh2Shape::wires.
Referenced by Sketcher::SketchObject::execute().
std::vector<GCS::Arc> Sketcher::Sketch::Arcs [protected] |
Definition at line 213 of file Sketch.h.
Referenced by addArc(), addEqualConstraint(), addPerpendicularConstraint(), addPointOnObjectConstraint(), addRadiusConstraint(), addTangentConstraint(), clear(), and initMove().
std::vector<GCS::Circle> Sketcher::Sketch::Circles [protected] |
Definition at line 214 of file Sketch.h.
Referenced by addCircle(), addEqualConstraint(), addPerpendicularConstraint(), addPointOnObjectConstraint(), addRadiusConstraint(), addTangentConstraint(), clear(), and initMove().
std::vector<int> Sketcher::Sketch::Conflicting [protected] |
Definition at line 205 of file Sketch.h.
Referenced by clear(), and diagnose().
int Sketcher::Sketch::ConstraintsCounter [protected] |
Definition at line 204 of file Sketch.h.
Referenced by addAngleConstraint(), addCoordinateXConstraint(), addCoordinateYConstraint(), addDistanceConstraint(), addDistanceXConstraint(), addDistanceYConstraint(), addEqualConstraint(), addHorizontalConstraint(), addParallelConstraint(), addPerpendicularConstraint(), addPointCoincidentConstraint(), addPointOnObjectConstraint(), addRadiusConstraint(), addSymmetricConstraint(), addTangentConstraint(), addVerticalConstraint(), and clear().
std::vector<double*> Sketcher::Sketch::FixParameters [protected] |
Definition at line 209 of file Sketch.h.
Referenced by addAngleConstraint(), addCoordinateXConstraint(), addCoordinateYConstraint(), addDistanceConstraint(), addDistanceXConstraint(), addDistanceYConstraint(), addRadiusConstraint(), and clear().
GCS::System Sketcher::Sketch::GCSsys [protected] |
Definition at line 203 of file Sketch.h.
Referenced by addAngleConstraint(), addArc(), addCoordinateXConstraint(), addCoordinateYConstraint(), addDistanceConstraint(), addDistanceXConstraint(), addDistanceYConstraint(), addEqualConstraint(), addHorizontalConstraint(), addParallelConstraint(), addPerpendicularConstraint(), addPointCoincidentConstraint(), addPointOnObjectConstraint(), addRadiusConstraint(), addSymmetricConstraint(), addTangentConstraint(), addVerticalConstraint(), clear(), diagnose(), initMove(), setUpSketch(), and solve().
std::vector<GeoDef> Sketcher::Sketch::Geoms [protected] |
Definition at line 202 of file Sketch.h.
Referenced by addAngleConstraint(), addArc(), addCircle(), addConstraint(), addConstraints(), addDistanceConstraint(), addDistanceXConstraint(), addDistanceYConstraint(), addEllipse(), addEqualConstraint(), addHorizontalConstraint(), addLine(), addLineSegment(), addParallelConstraint(), addPerpendicularConstraint(), addPoint(), addPointOnObjectConstraint(), addRadiusConstraint(), addSymmetricConstraint(), addTangentConstraint(), addVerticalConstraint(), clear(), getConstruction(), getGeometry(), getPointId(), getPyGeometry(), initMove(), movePoint(), setConstruction(), setUpSketch(), and toShape().
std::vector<double> Sketcher::Sketch::InitParameters [protected] |
Definition at line 210 of file Sketch.h.
Referenced by initMove(), movePoint(), and solve().
bool Sketcher::Sketch::isInitMove [protected] |
Definition at line 216 of file Sketch.h.
Referenced by clear(), initMove(), movePoint(), and solve().
std::vector<GCS::Line> Sketcher::Sketch::Lines [protected] |
Definition at line 212 of file Sketch.h.
Referenced by addAngleConstraint(), addDistanceConstraint(), addDistanceXConstraint(), addDistanceYConstraint(), addEqualConstraint(), addHorizontalConstraint(), addLineSegment(), addParallelConstraint(), addPerpendicularConstraint(), addPointOnObjectConstraint(), addSymmetricConstraint(), addTangentConstraint(), addVerticalConstraint(), clear(), and initMove().
std::vector<double> Sketcher::Sketch::MoveParameters [protected] |
Definition at line 210 of file Sketch.h.
Referenced by initMove(), and movePoint().
std::vector<double*> Sketcher::Sketch::Parameters [protected] |
Definition at line 208 of file Sketch.h.
Referenced by addArc(), addCircle(), addEqualConstraint(), addLineSegment(), addPoint(), clear(), diagnose(), initMove(), setUpSketch(), and solve().
std::vector<GCS::Point> Sketcher::Sketch::Points [protected] |
Definition at line 211 of file Sketch.h.
Referenced by addAngleConstraint(), addArc(), addCircle(), addCoordinateXConstraint(), addCoordinateYConstraint(), addDistanceConstraint(), addDistanceXConstraint(), addDistanceYConstraint(), addHorizontalConstraint(), addLineSegment(), addPoint(), addPointCoincidentConstraint(), addPointOnObjectConstraint(), addSymmetricConstraint(), addTangentConstraint(), addVerticalConstraint(), clear(), getPoint(), getPyGeometry(), and initMove().
Definition at line 186 of file Sketch.h.
Referenced by SketcherGui::ViewProviderSketch::mouseMove(), SketcherGui::ViewProviderSketch::setEdit(), solve(), and SketcherGui::ViewProviderSketch::updateData().