Sketcher::Sketch Class Reference

#include <Sketch.h>

Classes

struct  ConstrDef
 container element to store and work with the constraints of this sketch More...
 
struct  GeoDef
 container element to store and work with the geometric elements of this sketch More...
 

Public Types

enum  GeoType {
}
 

Public Member Functions

int addAngleAtPointConstraint (int geoId1, PointPos pos1, int geoId2, PointPos pos2, int geoId3, PointPos pos3, double *value, ConstraintType cTyp, bool driving=true)
 
int addAngleConstraint (int geoId, double *value, bool driving=true)
 add an angle constraint on a line or between two lines More...
 
int addAngleConstraint (int geoId1, int geoId2, double *value, bool driving=true)
 add an angle constraint on a line or between two lines More...
 
int addAngleConstraint (int geoId1, PointPos pos1, int geoId2, PointPos pos2, double *value, bool driving=true)
 add an angle constraint on a line or between two lines More...
 
int addAngleViaPointConstraint (int geoId1, int geoId2, int geoId3, PointPos pos3, double value, bool driving=true)
 add angle-via-point constraint between any two curves More...
 
int addArc (const Part::GeomArcOfCircle &circleSegment, bool fixed=false)
 add a arc (circle segment) More...
 
int addArcOfEllipse (const Part::GeomArcOfEllipse &ellipseSegment, bool fixed=false)
 add an arc of ellipse More...
 
int addArcOfHyperbola (const Part::GeomArcOfHyperbola &hyperbolaSegment, bool fixed=false)
 add an arc of hyperbola More...
 
int addArcOfParabola (const Part::GeomArcOfParabola &parabolaSegment, bool fixed=false)
 add an arc of parabola More...
 
int addBSpline (const Part::GeomBSplineCurve &spline, bool fixed=false)
 add a BSpline More...
 
int addCircle (const Part::GeomCircle &circle, bool fixed=false)
 add a circle More...
 
int addConstraint (const Constraint *constraint)
 add one constraint to the sketch More...
 
int addConstraints (const std::vector< Constraint * > &ConstraintList)
 constraints More...
 
int addConstraints (const std::vector< Constraint * > &ConstraintList, const std::vector< bool > &unenforceableConstraints)
 add all constraints in the list, provided that are enforceable More...
 
int addCoordinateXConstraint (int geoId, PointPos pos, double *value, bool driving=true)
 add a fixed X coordinate constraint to a point More...
 
int addCoordinateYConstraint (int geoId, PointPos pos, double *value, bool driving=true)
 add a fixed Y coordinate constraint to a point More...
 
int addDiameterConstraint (int geoId, double *value, bool driving=true)
 add a radius constraint on a circle or an arc More...
 
int addDistanceConstraint (int geoId1, double *value, bool driving=true)
 add a length or distance constraint More...
 
int addDistanceConstraint (int geoId1, PointPos pos1, int geoId2, double *value, bool driving=true)
 add a length or distance constraint More...
 
int addDistanceConstraint (int geoId1, PointPos pos1, int geoId2, PointPos pos2, double *value, bool driving=true)
 add a length or distance constraint More...
 
int addDistanceXConstraint (int geoId, double *value, bool driving=true)
 add a horizontal distance constraint to two points or line ends More...
 
int addDistanceXConstraint (int geoId1, PointPos pos1, int geoId2, PointPos pos2, double *value, bool driving=true)
 add a horizontal distance constraint to two points or line ends More...
 
int addDistanceYConstraint (int geoId, double *value, bool driving=true)
 add a vertical distance constraint to two points or line ends More...
 
int addDistanceYConstraint (int geoId1, PointPos pos1, int geoId2, PointPos pos2, double *value, bool driving=true)
 add a vertical distance constraint to two points or line ends More...
 
int addEllipse (const Part::GeomEllipse &ellipse, bool fixed=false)
 add an ellipse More...
 
int addEqualConstraint (int geoId1, int geoId2)
 add an equal length or radius constraints between two lines or between circles and arcs More...
 
int addGeometry (const Part::Geometry *geo, bool fixed=false)
 add unspecified geometry More...
 
int addGeometry (const std::vector< Part::Geometry * > &geo, bool fixed=false)
 add unspecified geometry More...
 
int addGeometry (const std::vector< Part::Geometry * > &geo, const std::vector< bool > &blockedGeometry)
 add unspecified geometry, where each element's "fixed" status is given by the blockedGeometry array More...
 
int addHorizontalConstraint (int geoId)
 add a horizontal constraint to a geometry More...
 
int addHorizontalConstraint (int geoId1, PointPos pos1, int geoId2, PointPos pos2)
 
int addInternalAlignmentBSplineControlPoint (int geoId1, int geoId2, int poleindex)
 
int addInternalAlignmentEllipseFocus1 (int geoId1, int geoId2)
 
int addInternalAlignmentEllipseFocus2 (int geoId1, int geoId2)
 
int addInternalAlignmentEllipseMajorDiameter (int geoId1, int geoId2)
 Internal Alignment constraints. More...
 
int addInternalAlignmentEllipseMinorDiameter (int geoId1, int geoId2)
 
int addInternalAlignmentHyperbolaFocus (int geoId1, int geoId2)
 
int addInternalAlignmentHyperbolaMajorDiameter (int geoId1, int geoId2)
 add InternalAlignmentHyperbolaMajorRadius to a line and a hyperbola More...
 
int addInternalAlignmentHyperbolaMinorDiameter (int geoId1, int geoId2)
 
int addInternalAlignmentKnotPoint (int geoId1, int geoId2, int knotindex)
 
int addInternalAlignmentParabolaFocus (int geoId1, int geoId2)
 
int addLine (const Part::GeomLineSegment &line, bool fixed=false)
 add an infinite line More...
 
int addLineSegment (const Part::GeomLineSegment &lineSegment, bool fixed=false)
 add a line segment More...
 
int addParallelConstraint (int geoId1, int geoId2)
 add a parallel constraint between two lines More...
 
int addPerpendicularConstraint (int geoId1, int geoId2)
 add a perpendicular constraint between two lines More...
 
int addPoint (const Part::GeomPoint &point, bool fixed=false)
 add dedicated geometry More...
 
int addPointCoincidentConstraint (int geoId1, PointPos pos1, int geoId2, PointPos pos2)
 add a coincident constraint to two points of two geometries More...
 
int addPointOnObjectConstraint (int geoId1, PointPos pos1, int geoId2, bool driving=true)
 add a point on line constraint More...
 
int addRadiusConstraint (int geoId, double *value, bool driving=true)
 add a radius constraint on a circle or an arc More...
 
int addSnellsLawConstraint (int geoIdRay1, PointPos posRay1, int geoIdRay2, PointPos posRay2, int geoIdBnd, double *value, double *second, bool driving=true)
 add a snell's law constraint More...
 
int addSymmetricConstraint (int geoId1, PointPos pos1, int geoId2, PointPos pos2, int geoId3)
 add a symmetric constraint between two points with respect to a line More...
 
int addSymmetricConstraint (int geoId1, PointPos pos1, int geoId2, PointPos pos2, int geoId3, PointPos pos3)
 add a symmetric constraint between three points, the last point is in the middle of the first two More...
 
int addTangentConstraint (int geoId1, int geoId2)
 add a tangency constraint between two geometries More...
 
int addVerticalConstraint (int geoId)
 add a vertical constraint to a geometry More...
 
int addVerticalConstraint (int geoId1, PointPos pos1, int geoId2, PointPos pos2)
 
double calculateAngleViaPoint (int geoId1, int geoId2, double px, double py)
 
double calculateConstraintError (int icstr)
 
Base::Vector3d calculateNormalAtPoint (int geoIdCurve, double px, double py) const
 
void clear (void)
 delete all geometry and constraints, leave an empty sketch More...
 
GeoListFacade extractGeoListFacade () const
 
std::vector< Part::Geometry * > extractGeometry (bool withConstructionElements=true, bool withExternalElements=false) const
 returns the actual geometry More...
 
void getBlockedGeometry (std::vector< bool > &blockedGeometry, std::vector< bool > &unenforceableConstraints, const std::vector< Constraint * > &ConstraintList) const
 get boolean list indicating whether the geometry is to be blocked or not More...
 
const std::vector< int > & getConflicting (void) const
 
GCS::DebugMode getDebugMode (void)
 
std::set< std::pair< int, Sketcher::PointPos > > getDependencyGroup (int geoId, PointPos pos) const
 
int getGeometrySize (void) const
 Returns the size of the Geometry. More...
 
const std::vector< int > & getMalformedConstraints (void) const
 
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? More...
 
const std::vector< int > & getPartiallyRedundant (void) const
 
Base::Vector3d getPoint (int geoId, PointPos pos) const
 retrieves a point More...
 
int getPointId (int geoId, PointPos pos) const
 retrieves the index of a point More...
 
Py::Tuple getPyGeometry (void) const
 get the geometry as python objects More...
 
GCS::QRAlgorithm getQRAlgorithm ()
 
bool getRecalculateInitialSolutionWhileMovingPoint () const
 Sets whether the initial solution should be recalculated while dragging after a certain distance from the previous drag point for smoother dragging operation. More...
 
const std::vector< int > & getRedundant (void) const
 
std::shared_ptr< SolverGeometryExtensiongetSolverExtension (int geoId) const
 
double getSolverPrecision ()
 get standard (aka fine) solver precision More...
 
float getSolveTime () const
 
bool hasConflicts (void) const
 
bool hasMalformedConstraints (void) const
 
bool hasPartialRedundancies (void) const
 
bool hasRedundancies (void) const
 
int initBSplinePieceMove (int geoId, PointPos pos, const Base::Vector3d &firstPoint, bool fine=true)
 Initializes a B-spline piece drag by setting the current sketch status as a reference. More...
 
int initMove (int geoId, PointPos pos, bool fine=true)
 initializes a point (or curve) drag by setting the current sketch status as a reference More...
 
int limitBSplineMove (int geoId, PointPos pos, const Base::Vector3d &firstPoint)
 Limits a b-spline drag to the segment around firstPoint. More...
 
int movePoint (int geoId, PointPos pos, Base::Vector3d toPoint, bool relative=false)
 move this point (or curve) to a new location and solve. More...
 
void resetInitMove ()
 Resets the initialization of a point or curve drag. More...
 
int resetSolver ()
 resets the solver More...
 
virtual void Restore (Base::XMLReader &)
 This method is used to restore properties from an XML document. More...
 
virtual void Save (Base::Writer &) const
 This method is used to save properties to an XML document. More...
 
void setConvergence (double conv)
 
void setConvergenceRedundant (double conv)
 
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! More...
 
void setDebugMode (GCS::DebugMode mode)
 
void setDL_tolf (double val)
 
void setDL_tolfRedundant (double val)
 
void setDL_tolg (double val)
 
void setDL_tolgRedundant (double val)
 
void setDL_tolx (double val)
 
void setDL_tolxRedundant (double val)
 
void setDogLegGaussStep (GCS::DogLegGaussStep mode)
 
void setLM_eps (double val)
 
void setLM_eps1 (double val)
 
void setLM_eps1Redundant (double val)
 
void setLM_epsRedundant (double val)
 
void setLM_tau (double val)
 
void setLM_tauRedundant (double val)
 
void setMaxIter (int maxiter)
 
void setMaxIterRedundant (int maxiter)
 
void setQRAlgorithm (GCS::QRAlgorithm alg)
 
void setQRPivotThreshold (double val)
 
void setRecalculateInitialSolutionWhileMovingPoint (bool recalculateInitialSolutionWhileMovingPoint)
 
void setSketchSizeMultiplier (bool mult)
 
void setSketchSizeMultiplierRedundant (bool mult)
 
int setUpSketch (const std::vector< Part::Geometry * > &GeoList, const std::vector< Constraint * > &ConstraintList, int extGeoCount=0)
 set the sketch up with geoms and constraints More...
 
 Sketch ()
 
int solve (void)
 solve the actual set up sketch More...
 
Part::TopoShape toShape (void) const
 return the actual geometry of the sketch a TopoShape More...
 
void updateExtension (int geoId, std::unique_ptr< Part::GeometryExtension > &&ext)
 
 ~Sketch ()
 
- Public Member Functions inherited from Base::Persistence
void dumpToStream (std::ostream &stream, int compression)
 
virtual unsigned int getMemSize () const =0
 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? More...
 
virtual Base::Type getTypeId (void) const
 
virtual void Restore (XMLReader &)=0
 This method is used to restore properties from an XML document. More...
 
virtual void RestoreDocFile (Reader &)
 This method is used to restore large amounts of data from a file In this method you simply stream in your SaveDocFile() saved data. More...
 
void restoreFromStream (std::istream &stream)
 
virtual void Save (Writer &) const =0
 This method is used to save properties to an XML document. More...
 
virtual void SaveDocFile (Writer &) const
 This method is used to save large amounts of data to a binary file. More...
 
- Public Member Functions inherited from Base::BaseClass
 BaseClass ()
 Construction. More...
 
 BaseClass (const BaseClass &)=default
 
virtual PyObjectgetPyObject ()
 This method returns the Python wrapper for a C++ object. More...
 
virtual Type getTypeId () const
 
bool isDerivedFrom (const Type type) const
 
BaseClassoperator= (const BaseClass &)=default
 
virtual void setPyObject (PyObject *)
 
virtual ~BaseClass ()
 Destruction. More...
 

Public Attributes

GCS::Algorithm defaultSolver
 
GCS::Algorithm defaultSolverRedundant
 

Protected Attributes

std::vector< GCS::ArcArcs
 
std::vector< GCS::ArcOfEllipseArcsOfEllipse
 
std::vector< GCS::ArcOfHyperbolaArcsOfHyperbola
 
std::vector< GCS::ArcOfParabolaArcsOfParabola
 
std::vector< GCS::BSplineBSplines
 
std::vector< GCS::CircleCircles
 
std::vector< intConflicting
 
int ConstraintsCounter
 
std::vector< ConstrDefConstrs
 
GCS::DebugMode debugMode
 
std::vector< double * > DrivenParameters
 
std::vector< GCS::EllipseEllipses
 
std::vector< double * > FixParameters
 
GCS::System GCSsys
 
std::vector< GeoDefGeoms
 
std::vector< double > InitParameters
 
Base::Vector3d initToPoint
 
bool isFine
 
bool isInitMove
 
std::vector< GCS::LineLines
 
std::vector< intMalformedConstraints
 
std::vector< double > MoveParameters
 
double moveStep
 
std::map< double *, std::tuple< int, Sketcher::PointPos, int > > param2geoelement
 
std::vector< double * > Parameters
 
std::vector< intPartiallyRedundant
 
std::vector< std::set< std::pair< int, Sketcher::PointPos > > > pDependencyGroups
 
std::vector< double * > pDependentParametersList
 
std::vector< GCS::PointPoints
 
bool RecalculateInitialSolutionWhileMovingPoint
 
std::vector< intRedundant
 
bool resolveAfterGeometryUpdated
 
std::vector< std::shared_ptr< SolverGeometryExtension > > solverExtensions
 
float SolveTime
 

Additional Inherited Members

- Static Public Member Functions inherited from Base::Persistence
static void * create (void)
 
static std::string encodeAttribute (const std::string &)
 Encodes an attribute upon saving. More...
 
static Base::Type getClassTypeId (void)
 
static void init (void)
 
- Static Public Member Functions inherited from Base::BaseClass
static void * create ()
 
static Type getClassTypeId ()
 
static void init ()
 
- Static Protected Member Functions inherited from Base::BaseClass
static void initSubclass (Base::Type &toInit, const char *ClassName, const char *ParentName, Type::instantiationMethod method=nullptr)
 

Member Enumeration Documentation

◆ GeoType

Enumerator
Point 
Line 
Arc 
Circle 
Ellipse 
ArcOfEllipse 
ArcOfHyperbola 
ArcOfParabola 
BSpline 

Constructor & Destructor Documentation

◆ Sketch()

◆ ~Sketch()

Sketch::~Sketch ( )

References clear().

Member Function Documentation

◆ addAngleAtPointConstraint()

◆ addAngleConstraint() [1/3]

int Sketch::addAngleConstraint ( int  geoId,
double *  value,
bool  driving = true 
)

add an angle constraint on a line or between two lines

double * value is a pointer to double allocated in the heap, containing the constraint value and already inserted into either the FixParameters or Parameters array, as the case may be.

References GCS::System::addConstraintL2LAngle(), GCS::System::addConstraintP2PAngle(), Arc, Arcs, ConstraintsCounter, GCSsys, Geoms, and Lines.

Referenced by addConstraint().

◆ addAngleConstraint() [2/3]

int Sketch::addAngleConstraint ( int  geoId1,
int  geoId2,
double *  value,
bool  driving = true 
)

add an angle constraint on a line or between two lines

double * value is a pointer to double allocated in the heap, containing the constraint value and already inserted into either the FixParameters or Parameters array, as the case may be.

References GCS::System::addConstraintL2LAngle(), ConstraintsCounter, GCSsys, Geoms, and Lines.

◆ addAngleConstraint() [3/3]

int Sketch::addAngleConstraint ( int  geoId1,
PointPos  pos1,
int  geoId2,
PointPos  pos2,
double *  value,
bool  driving = true 
)

add an angle constraint on a line or between two lines

double * value is a pointer to double allocated in the heap, containing the constraint value and already inserted into either the FixParameters or Parameters array, as the case may be.

References GCS::System::addConstraintL2LAngle(), ConstraintsCounter, Sketcher::end, GCSsys, Geoms, and Sketcher::start.

◆ addAngleViaPointConstraint()

int Sketcher::Sketch::addAngleViaPointConstraint ( int  geoId1,
int  geoId2,
int  geoId3,
PointPos  pos3,
double  value,
bool  driving = true 
)

add angle-via-point constraint between any two curves

double * value is a pointer to double allocated in the heap, containing the constraint value and already inserted into either the FixParameters or Parameters array, as the case may be.

◆ addArc()

◆ addArcOfEllipse()

◆ addArcOfHyperbola()

◆ addArcOfParabola()

◆ addBSpline()

◆ addCircle()

◆ addConstraint()

int Sketch::addConstraint ( const Constraint constraint)

add one constraint to the sketch

References addAngleAtPointConstraint(), addAngleConstraint(), addCoordinateXConstraint(), addCoordinateYConstraint(), addDiameterConstraint(), addDistanceConstraint(), addDistanceXConstraint(), addDistanceYConstraint(), addEqualConstraint(), addHorizontalConstraint(), addInternalAlignmentBSplineControlPoint(), addInternalAlignmentEllipseFocus1(), addInternalAlignmentEllipseFocus2(), addInternalAlignmentEllipseMajorDiameter(), addInternalAlignmentEllipseMinorDiameter(), addInternalAlignmentHyperbolaFocus(), addInternalAlignmentHyperbolaMajorDiameter(), addInternalAlignmentHyperbolaMinorDiameter(), addInternalAlignmentKnotPoint(), addInternalAlignmentParabolaFocus(), addParallelConstraint(), addPerpendicularConstraint(), addPointCoincidentConstraint(), addPointOnObjectConstraint(), addRadiusConstraint(), addSnellsLawConstraint(), addSymmetricConstraint(), addTangentConstraint(), addVerticalConstraint(), Sketcher::Constraint::AlignmentType, Sketcher::Angle, Sketcher::Block, Sketcher::BSplineControlPoint, Sketcher::BSplineKnotPoint, Sketcher::Coincident, Sketcher::Sketch::ConstrDef::constr, Constrs, Sketcher::Diameter, Sketcher::Distance, Sketcher::DistanceX, Sketcher::DistanceY, DrivenParameters, Sketcher::EllipseFocus1, Sketcher::EllipseFocus2, Sketcher::EllipseMajorDiameter, Sketcher::EllipseMinorDiameter, Sketcher::Equal, Sketcher::Constraint::First, Sketcher::Constraint::FirstPos, FixParameters, Geoms, Sketcher::Constraint::getValue(), Sketcher::Horizontal, Sketcher::HyperbolaFocus, Sketcher::HyperbolaMajor, Sketcher::HyperbolaMinor, Sketcher::InternalAlignment, Sketcher::Constraint::InternalAlignmentIndex, Sketcher::Constraint::isDriving, Sketcher::none, Sketcher::NumConstraintTypes, Sketcher::ParabolaFocus, Sketcher::Parallel, Parameters, Sketcher::Perpendicular, Sketcher::PointOnObject, Sketcher::Radius, Sketcher::Constraint::Second, Sketcher::Constraint::SecondPos, Sketcher::SnellsLaw, Sketcher::Symmetric, Sketcher::Tangent, Sketcher::Constraint::Third, Sketcher::Constraint::ThirdPos, Sketcher::Constraint::Type, Sketcher::Vertical, and Sketcher::Weight.

Referenced by addConstraints(), and Sketcher::SketchObject::calculateConstraintError().

◆ addConstraints() [1/2]

int Sketch::addConstraints ( const std::vector< Constraint * > &  ConstraintList)

constraints

add all constraints in the list

References addConstraint(), Base::Console(), Base::ConsoleSingleton::Error(), and MalformedConstraints.

Referenced by setUpSketch().

◆ addConstraints() [2/2]

int Sketch::addConstraints ( const std::vector< Constraint * > &  ConstraintList,
const std::vector< bool > &  unenforceableConstraints 
)

add all constraints in the list, provided that are enforceable

References addConstraint(), Sketcher::Block, Base::Console(), ConstraintsCounter, Base::ConsoleSingleton::Error(), and MalformedConstraints.

◆ addCoordinateXConstraint()

int Sketch::addCoordinateXConstraint ( int  geoId,
PointPos  pos,
double *  value,
bool  driving = true 
)

add a fixed X coordinate constraint to a point

double * value is a pointer to double allocated in the heap, containing the constraint value and already inserted into either the FixParameters or Parameters array, as the case may be.

References GCS::System::addConstraintCoordinateX(), ConstraintsCounter, GCSsys, and getPointId().

Referenced by addConstraint().

◆ addCoordinateYConstraint()

int Sketch::addCoordinateYConstraint ( int  geoId,
PointPos  pos,
double *  value,
bool  driving = true 
)

add a fixed Y coordinate constraint to a point

double * value is a pointer to double allocated in the heap, containing the constraint value and already inserted into either the FixParameters or Parameters array, as the case may be.

References GCS::System::addConstraintCoordinateY(), ConstraintsCounter, GCSsys, and getPointId().

Referenced by addConstraint().

◆ addDiameterConstraint()

int Sketch::addDiameterConstraint ( int  geoId,
double *  value,
bool  driving = true 
)

add a radius constraint on a circle or an arc

double * value is a pointer to double allocated in the heap, containing the constraint value and already inserted into either the FixParameters or Parameters array, as the case may be.

References GCS::System::addConstraintArcDiameter(), GCS::System::addConstraintCircleDiameter(), Arc, Arcs, Circles, ConstraintsCounter, GCSsys, and Geoms.

Referenced by addConstraint().

◆ addDistanceConstraint() [1/3]

int Sketch::addDistanceConstraint ( int  geoId1,
double *  value,
bool  driving = true 
)

add a length or distance constraint

double * value is a pointer to double allocated in the heap, containing the constraint value and already inserted into either the FixParameters or Parameters array, as the case may be.

References GCS::System::addConstraintP2PDistance(), ConstraintsCounter, GCSsys, Geoms, and Lines.

Referenced by addConstraint().

◆ addDistanceConstraint() [2/3]

int Sketch::addDistanceConstraint ( int  geoId1,
PointPos  pos1,
int  geoId2,
double *  value,
bool  driving = true 
)

add a length or distance constraint

double * value is a pointer to double allocated in the heap, containing the constraint value and already inserted into either the FixParameters or Parameters array, as the case may be.

References GCS::System::addConstraintP2LDistance(), ConstraintsCounter, GCSsys, Geoms, getPointId(), and Lines.

◆ addDistanceConstraint() [3/3]

int Sketch::addDistanceConstraint ( int  geoId1,
PointPos  pos1,
int  geoId2,
PointPos  pos2,
double *  value,
bool  driving = true 
)

add a length or distance constraint

double * value is a pointer to double allocated in the heap, containing the constraint value and already inserted into either the FixParameters or Parameters array, as the case may be.

References GCS::System::addConstraintP2PDistance(), ConstraintsCounter, GCSsys, and getPointId().

◆ addDistanceXConstraint() [1/2]

int Sketch::addDistanceXConstraint ( int  geoId,
double *  value,
bool  driving = true 
)

add a horizontal distance constraint to two points or line ends

double * value is a pointer to double allocated in the heap, containing the constraint value and already inserted into either the FixParameters or Parameters array, as the case may be.

References GCS::System::addConstraintDifference(), ConstraintsCounter, GCSsys, Geoms, and Lines.

Referenced by addConstraint().

◆ addDistanceXConstraint() [2/2]

int Sketch::addDistanceXConstraint ( int  geoId1,
PointPos  pos1,
int  geoId2,
PointPos  pos2,
double *  value,
bool  driving = true 
)

add a horizontal distance constraint to two points or line ends

double * value is a pointer to double allocated in the heap, containing the constraint value and already inserted into either the FixParameters or Parameters array, as the case may be.

References GCS::System::addConstraintDifference(), ConstraintsCounter, GCSsys, getPointId(), and GCS::Point::x.

◆ addDistanceYConstraint() [1/2]

int Sketch::addDistanceYConstraint ( int  geoId,
double *  value,
bool  driving = true 
)

add a vertical distance constraint to two points or line ends

double * value is a pointer to double allocated in the heap, containing the constraint value and already inserted into either the FixParameters or Parameters array, as the case may be.

References GCS::System::addConstraintDifference(), ConstraintsCounter, GCSsys, Geoms, and Lines.

Referenced by addConstraint().

◆ addDistanceYConstraint() [2/2]

int Sketch::addDistanceYConstraint ( int  geoId1,
PointPos  pos1,
int  geoId2,
PointPos  pos2,
double *  value,
bool  driving = true 
)

add a vertical distance constraint to two points or line ends

double * value is a pointer to double allocated in the heap, containing the constraint value and already inserted into either the FixParameters or Parameters array, as the case may be.

References GCS::System::addConstraintDifference(), ConstraintsCounter, GCSsys, getPointId(), and GCS::Point::y.

◆ addEllipse()

◆ addEqualConstraint()

◆ addGeometry() [1/3]

◆ addGeometry() [2/3]

int Sketch::addGeometry ( const std::vector< Part::Geometry * > &  geo,
bool  fixed = false 
)

add unspecified geometry

References addGeometry().

◆ addGeometry() [3/3]

int Sketch::addGeometry ( const std::vector< Part::Geometry * > &  geo,
const std::vector< bool > &  blockedGeometry 
)

add unspecified geometry, where each element's "fixed" status is given by the blockedGeometry array

References addGeometry().

◆ addHorizontalConstraint() [1/2]

int Sketch::addHorizontalConstraint ( int  geoId)

add a horizontal constraint to a geometry

References GCS::System::addConstraintHorizontal(), ConstraintsCounter, GCSsys, Geoms, and Lines.

Referenced by addConstraint().

◆ addHorizontalConstraint() [2/2]

int Sketch::addHorizontalConstraint ( int  geoId1,
PointPos  pos1,
int  geoId2,
PointPos  pos2 
)

◆ addInternalAlignmentBSplineControlPoint()

int Sketch::addInternalAlignmentBSplineControlPoint ( int  geoId1,
int  geoId2,
int  poleindex 
)

◆ addInternalAlignmentEllipseFocus1()

int Sketch::addInternalAlignmentEllipseFocus1 ( int  geoId1,
int  geoId2 
)

◆ addInternalAlignmentEllipseFocus2()

int Sketch::addInternalAlignmentEllipseFocus2 ( int  geoId1,
int  geoId2 
)

◆ addInternalAlignmentEllipseMajorDiameter()

int Sketch::addInternalAlignmentEllipseMajorDiameter ( int  geoId1,
int  geoId2 
)

Internal Alignment constraints.

add InternalAlignmentEllipseMajorDiameter to a line and an ellipse

References GCS::System::addConstraintInternalAlignmentEllipseMajorDiameter(), ArcOfEllipse, ArcsOfEllipse, ConstraintsCounter, Ellipses, Sketcher::end, GCSsys, Geoms, getPointId(), and Sketcher::start.

Referenced by addConstraint().

◆ addInternalAlignmentEllipseMinorDiameter()

int Sketch::addInternalAlignmentEllipseMinorDiameter ( int  geoId1,
int  geoId2 
)

◆ addInternalAlignmentHyperbolaFocus()

int Sketch::addInternalAlignmentHyperbolaFocus ( int  geoId1,
int  geoId2 
)

◆ addInternalAlignmentHyperbolaMajorDiameter()

int Sketch::addInternalAlignmentHyperbolaMajorDiameter ( int  geoId1,
int  geoId2 
)

◆ addInternalAlignmentHyperbolaMinorDiameter()

int Sketch::addInternalAlignmentHyperbolaMinorDiameter ( int  geoId1,
int  geoId2 
)

◆ addInternalAlignmentKnotPoint()

int Sketch::addInternalAlignmentKnotPoint ( int  geoId1,
int  geoId2,
int  knotindex 
)

◆ addInternalAlignmentParabolaFocus()

int Sketch::addInternalAlignmentParabolaFocus ( int  geoId1,
int  geoId2 
)

◆ addLine()

int Sketch::addLine ( const Part::GeomLineSegment line,
bool  fixed = false 
)

add an infinite line

References Geoms.

◆ addLineSegment()

◆ addParallelConstraint()

int Sketch::addParallelConstraint ( int  geoId1,
int  geoId2 
)

add a parallel constraint between two lines

References GCS::System::addConstraintParallel(), ConstraintsCounter, GCSsys, Geoms, and Lines.

Referenced by addConstraint().

◆ addPerpendicularConstraint()

int Sketch::addPerpendicularConstraint ( int  geoId1,
int  geoId2 
)

◆ addPoint()

◆ addPointCoincidentConstraint()

int Sketch::addPointCoincidentConstraint ( int  geoId1,
PointPos  pos1,
int  geoId2,
PointPos  pos2 
)

add a coincident constraint to two points of two geometries

References GCS::System::addConstraintP2PCoincident(), ConstraintsCounter, GCSsys, and getPointId().

Referenced by addConstraint().

◆ addPointOnObjectConstraint()

◆ addRadiusConstraint()

int Sketch::addRadiusConstraint ( int  geoId,
double *  value,
bool  driving = true 
)

add a radius constraint on a circle or an arc

double * value is a pointer to double allocated in the heap, containing the constraint value and already inserted into either the FixParameters or Parameters array, as the case may be.

References GCS::System::addConstraintArcRadius(), GCS::System::addConstraintCircleRadius(), Arc, Arcs, Circles, ConstraintsCounter, GCSsys, and Geoms.

Referenced by addConstraint().

◆ addSnellsLawConstraint()

int Sketch::addSnellsLawConstraint ( int  geoIdRay1,
PointPos  posRay1,
int  geoIdRay2,
PointPos  posRay2,
int  geoIdBnd,
double *  value,
double *  second,
bool  driving = true 
)

add a snell's law constraint

double * value and double * second are each a pointer to double allocated in the heap and already inserted into either the FixParameters or Parameters array, as the case may be.

value must contain the constraint value (the ratio of n2/n1) second may be initialized to any value, however the solver will provide n1 in value and n2 in second.

References GCS::System::addConstraintSnellsLaw(), Base::Console(), ConstraintsCounter, Sketcher::end, Base::ConsoleSingleton::Error(), GCSsys, Geoms, getPointId(), and Sketcher::start.

Referenced by addConstraint().

◆ addSymmetricConstraint() [1/2]

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

References GCS::System::addConstraintP2PSymmetric(), ConstraintsCounter, GCSsys, Geoms, getPointId(), and Lines.

Referenced by addConstraint().

◆ addSymmetricConstraint() [2/2]

int Sketch::addSymmetricConstraint ( int  geoId1,
PointPos  pos1,
int  geoId2,
PointPos  pos2,
int  geoId3,
PointPos  pos3 
)

add a symmetric constraint between three points, the last point is in the middle of the first two

References GCS::System::addConstraintP2PSymmetric(), ConstraintsCounter, GCSsys, and getPointId().

◆ addTangentConstraint()

int Sketch::addTangentConstraint ( int  geoId1,
int  geoId2 
)

◆ addVerticalConstraint() [1/2]

int Sketch::addVerticalConstraint ( int  geoId)

add a vertical constraint to a geometry

References GCS::System::addConstraintVertical(), ConstraintsCounter, GCSsys, Geoms, and Lines.

Referenced by addConstraint().

◆ addVerticalConstraint() [2/2]

int Sketch::addVerticalConstraint ( int  geoId1,
PointPos  pos1,
int  geoId2,
PointPos  pos2 
)

◆ calculateAngleViaPoint()

double Sketch::calculateAngleViaPoint ( int  geoId1,
int  geoId2,
double  px,
double  py 
)

◆ calculateConstraintError()

double Sketcher::Sketch::calculateConstraintError ( int  icstr)

◆ calculateNormalAtPoint()

Base::Vector3d Sketch::calculateNormalAtPoint ( int  geoIdCurve,
double  px,
double  py 
) const

◆ clear()

◆ extractGeoListFacade()

◆ extractGeometry()

std::vector< Part::Geometry * > Sketch::extractGeometry ( bool  withConstructionElements = true,
bool  withExternalElements = false 
) const

◆ getBlockedGeometry()

void Sketch::getBlockedGeometry ( std::vector< bool > &  blockedGeometry,
std::vector< bool > &  unenforceableConstraints,
const std::vector< Constraint * > &  ConstraintList 
) const

get boolean list indicating whether the geometry is to be blocked or not

References Sketcher::Block, and Sketcher::InternalAlignment.

◆ getConflicting()

const std::vector< int > & Sketcher::Sketch::getConflicting ( void  ) const

◆ getDebugMode()

GCS::DebugMode Sketcher::Sketch::getDebugMode ( void  )

◆ getDependencyGroup()

std::set< std::pair< int, Sketcher::PointPos > > Sketch::getDependencyGroup ( int  geoId,
PointPos  pos 
) const

◆ getGeometrySize()

int Sketcher::Sketch::getGeometrySize ( void  ) const

Returns the size of the Geometry.

◆ getMalformedConstraints()

const std::vector< int > & Sketcher::Sketch::getMalformedConstraints ( void  ) const

◆ getMemSize()

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.

◆ getPartiallyRedundant()

const std::vector< int > & Sketcher::Sketch::getPartiallyRedundant ( void  ) const

◆ getPoint()

◆ getPointId()

◆ getPyGeometry()

Py::Tuple Sketch::getPyGeometry ( void  ) const

get the geometry as python objects

References Arc, ArcOfEllipse, ArcOfHyperbola, ArcOfParabola, BSpline, and Geoms.

◆ getQRAlgorithm()

GCS::QRAlgorithm Sketcher::Sketch::getQRAlgorithm ( )

◆ getRecalculateInitialSolutionWhileMovingPoint()

bool Sketcher::Sketch::getRecalculateInitialSolutionWhileMovingPoint ( ) const

Sets whether the initial solution should be recalculated while dragging after a certain distance from the previous drag point for smoother dragging operation.

◆ getRedundant()

const std::vector< int > & Sketcher::Sketch::getRedundant ( void  ) const

◆ getSolverExtension()

std::shared_ptr< SolverGeometryExtension > Sketch::getSolverExtension ( int  geoId) const

References solverExtensions.

◆ getSolverPrecision()

double Sketcher::Sketch::getSolverPrecision ( )

get standard (aka fine) solver precision

Referenced by Sketcher::SketchObject::isPointOnCurve().

◆ getSolveTime()

float Sketcher::Sketch::getSolveTime ( ) const

◆ hasConflicts()

◆ hasMalformedConstraints()

bool Sketcher::Sketch::hasMalformedConstraints ( void  ) const

◆ hasPartialRedundancies()

bool Sketcher::Sketch::hasPartialRedundancies ( void  ) const

◆ hasRedundancies()

bool Sketcher::Sketch::hasRedundancies ( void  ) const

◆ initBSplinePieceMove()

◆ initMove()

◆ limitBSplineMove()

int Sketcher::Sketch::limitBSplineMove ( int  geoId,
PointPos  pos,
const Base::Vector3d firstPoint 
)

Limits a b-spline drag to the segment around firstPoint.

◆ movePoint()

int Sketch::movePoint ( int  geoId,
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

References Arc, ArcOfEllipse, ArcOfHyperbola, ArcOfParabola, BSpline, BSplines, Sketcher::end, Geoms, hasConflicts(), initMove(), InitParameters, initToPoint, isInitMove, Sketcher::mid, MoveParameters, moveStep, Sketcher::none, GCS::BSpline::poles, RecalculateInitialSolutionWhileMovingPoint, solve(), Sketcher::start, Base::Vector3< _Precision >::x, and Base::Vector3< _Precision >::y.

Referenced by Sketcher::SketchObject::movePoint(), and Sketcher::SketchObject::moveTemporaryPoint().

◆ resetInitMove()

void Sketch::resetInitMove ( )

Resets the initialization of a point or curve drag.

References isInitMove.

Referenced by Sketcher::SketchObject::movePoint(), and Sketcher::SketchObject::solve().

◆ resetSolver()

◆ Restore()

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 = reader.getAttributeAsFloat("valueX");
_cVec.y = reader.getAttributeAsFloat("valueY");
_cVec.z = reader.getAttributeAsFloat("valueZ");
}

Implements Base::Persistence.

◆ Save()

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 indentation, 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.

See also
Base::Writer

Implements Base::Persistence.

◆ setConvergence()

void Sketcher::Sketch::setConvergence ( double  conv)

◆ setConvergenceRedundant()

void Sketcher::Sketch::setConvergenceRedundant ( double  conv)

◆ setDatum()

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!

◆ setDebugMode()

void Sketcher::Sketch::setDebugMode ( GCS::DebugMode  mode)

◆ setDL_tolf()

void Sketcher::Sketch::setDL_tolf ( double  val)

References GCS::System::DL_tolf.

◆ setDL_tolfRedundant()

void Sketcher::Sketch::setDL_tolfRedundant ( double  val)

◆ setDL_tolg()

void Sketcher::Sketch::setDL_tolg ( double  val)

References GCS::System::DL_tolg.

◆ setDL_tolgRedundant()

void Sketcher::Sketch::setDL_tolgRedundant ( double  val)

◆ setDL_tolx()

void Sketcher::Sketch::setDL_tolx ( double  val)

References GCS::System::DL_tolx.

◆ setDL_tolxRedundant()

void Sketcher::Sketch::setDL_tolxRedundant ( double  val)

◆ setDogLegGaussStep()

void Sketcher::Sketch::setDogLegGaussStep ( GCS::DogLegGaussStep  mode)

◆ setLM_eps()

void Sketcher::Sketch::setLM_eps ( double  val)

References GCS::System::LM_eps.

◆ setLM_eps1()

void Sketcher::Sketch::setLM_eps1 ( double  val)

References GCS::System::LM_eps1.

◆ setLM_eps1Redundant()

void Sketcher::Sketch::setLM_eps1Redundant ( double  val)

◆ setLM_epsRedundant()

void Sketcher::Sketch::setLM_epsRedundant ( double  val)

◆ setLM_tau()

void Sketcher::Sketch::setLM_tau ( double  val)

References GCS::System::LM_tau.

◆ setLM_tauRedundant()

void Sketcher::Sketch::setLM_tauRedundant ( double  val)

◆ setMaxIter()

void Sketcher::Sketch::setMaxIter ( int  maxiter)

References GCS::System::maxIter.

◆ setMaxIterRedundant()

void Sketcher::Sketch::setMaxIterRedundant ( int  maxiter)

◆ setQRAlgorithm()

void Sketcher::Sketch::setQRAlgorithm ( GCS::QRAlgorithm  alg)

◆ setQRPivotThreshold()

void Sketcher::Sketch::setQRPivotThreshold ( double  val)

◆ setRecalculateInitialSolutionWhileMovingPoint()

void Sketcher::Sketch::setRecalculateInitialSolutionWhileMovingPoint ( bool  recalculateInitialSolutionWhileMovingPoint)

◆ setSketchSizeMultiplier()

void Sketcher::Sketch::setSketchSizeMultiplier ( bool  mult)

◆ setSketchSizeMultiplierRedundant()

void Sketcher::Sketch::setSketchSizeMultiplierRedundant ( bool  mult)

◆ setUpSketch()

int Sketch::setUpSketch ( const std::vector< Part::Geometry * > &  GeoList,
const std::vector< Constraint * > &  ConstraintList,
int  extGeoCount = 0 
)

set the sketch up with geoms and constraints

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

References addConstraints(), addGeometry(), clear(), Conflicting, Base::Console(), debugMode, GCS::System::declareDrivenParams(), GCS::System::declareUnknowns(), defaultSolverRedundant, Base::TimeInfo::diffTime(), GCS::System::dofsNumber(), DrivenParameters, GCSsys, Geoms, GCS::System::getConflicting(), GCS::System::getDependentParams(), GCS::System::getDependentParamsGroups(), GCS::System::getPartiallyRedundant(), GCS::System::getRedundant(), GCS::System::initSolution(), GCS::IterationLevel, Base::ConsoleSingleton::Log(), GCS::Minimal, param2geoelement, Parameters, PartiallyRedundant, pDependentParametersList, and Redundant.

Referenced by Sketcher::SketchObject::diagnoseAdditionalConstraints(), Sketcher::SketchObject::movePoint(), Sketcher::SketchObject::setUpSketch(), and Sketcher::SketchObject::solve().

◆ solve()

◆ toShape()

TopoShape Sketch::toShape ( void  ) const

return the actual geometry of the sketch a TopoShape

References Geoms, and Sketcher::GeometryFacade::getFacade().

Referenced by Sketcher::SketchObject::execute(), and Sketcher::SketchObject::restoreFinished().

◆ updateExtension()

void Sketch::updateExtension ( int  geoId,
std::unique_ptr< Part::GeometryExtension > &&  ext 
)

Member Data Documentation

◆ Arcs

◆ ArcsOfEllipse

◆ ArcsOfHyperbola

◆ ArcsOfParabola

std::vector<GCS::ArcOfParabola> Sketcher::Sketch::ArcsOfParabola
protected

◆ BSplines

◆ Circles

◆ Conflicting

std::vector<int> Sketcher::Sketch::Conflicting
protected

Referenced by clear(), resetSolver(), and setUpSketch().

◆ ConstraintsCounter

◆ Constrs

std::vector<ConstrDef> Sketcher::Sketch::Constrs
protected

Referenced by addConstraint(), and clear().

◆ debugMode

GCS::DebugMode Sketcher::Sketch::debugMode
protected

Referenced by setUpSketch(), and solve().

◆ defaultSolver

GCS::Algorithm Sketcher::Sketch::defaultSolver

◆ defaultSolverRedundant

GCS::Algorithm Sketcher::Sketch::defaultSolverRedundant

Referenced by resetSolver(), and setUpSketch().

◆ DrivenParameters

std::vector<double*> Sketcher::Sketch::DrivenParameters
protected

◆ Ellipses

◆ FixParameters

std::vector<double*> Sketcher::Sketch::FixParameters
protected

◆ GCSsys

◆ Geoms

◆ InitParameters

std::vector<double> Sketcher::Sketch::InitParameters
protected

◆ initToPoint

Base::Vector3d Sketcher::Sketch::initToPoint
protected

Referenced by movePoint().

◆ isFine

bool Sketcher::Sketch::isFine
protected

Referenced by initBSplinePieceMove(), and initMove().

◆ isInitMove

bool Sketcher::Sketch::isInitMove
protected

◆ Lines

◆ MalformedConstraints

std::vector<int> Sketcher::Sketch::MalformedConstraints
protected

Referenced by addConstraints(), and clear().

◆ MoveParameters

std::vector<double> Sketcher::Sketch::MoveParameters
protected

◆ moveStep

double Sketcher::Sketch::moveStep
protected

Referenced by movePoint().

◆ param2geoelement

std::map<double *, std::tuple<int, Sketcher::PointPos, int> > Sketcher::Sketch::param2geoelement
protected

◆ Parameters

◆ PartiallyRedundant

std::vector<int> Sketcher::Sketch::PartiallyRedundant
protected

Referenced by clear(), resetSolver(), and setUpSketch().

◆ pDependencyGroups

std::vector< std::set < std::pair< int, Sketcher::PointPos> > > Sketcher::Sketch::pDependencyGroups
protected

Referenced by clear(), and getDependencyGroup().

◆ pDependentParametersList

std::vector<double *> Sketcher::Sketch::pDependentParametersList
protected

Referenced by resetSolver(), and setUpSketch().

◆ Points

std::vector<GCS::Point> Sketcher::Sketch::Points
protected

◆ RecalculateInitialSolutionWhileMovingPoint

bool Sketcher::Sketch::RecalculateInitialSolutionWhileMovingPoint
protected

Referenced by movePoint().

◆ Redundant

std::vector<int> Sketcher::Sketch::Redundant
protected

Referenced by clear(), resetSolver(), and setUpSketch().

◆ resolveAfterGeometryUpdated

bool Sketcher::Sketch::resolveAfterGeometryUpdated
protected

Referenced by addGeometry(), and clear().

◆ solverExtensions

std::vector<std::shared_ptr<SolverGeometryExtension> > Sketcher::Sketch::solverExtensions
protected

Referenced by clear(), and getSolverExtension().

◆ SolveTime

float Sketcher::Sketch::SolveTime
protected

Referenced by solve().


The documentation for this class was generated from the following files: