#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 { ,
  Point = 1, Line = 2, Arc = 3, Circle = 4,
  Ellipse = 5, ArcOfEllipse = 6, ArcOfHyperbola = 7, ArcOfParabola = 8,
  BSpline = 9
}
 

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)
 
void clear (void)
 delete all geometry and constraints, leave an empty sketch More...
 
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)
 
int getGeometrySize (void) const
 Returns the size of the Geometry. More...
 
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...
 
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 ()
 
const std::vector< int > & getRedundant (void) const
 
double getSolverPrecision ()
 get standard (aka fine) solver precision More...
 
bool hasConflicts (void) const
 
bool hasDependentParameters (int geoId, PointPos pos) const
 retrieves whether a geometry has dependent parameters or not More...
 
bool hasRedundancies (void) const
 
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 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 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...
 
 ~Sketch ()
 
- Public Member Functions inherited from Base::Persistence
void dumpToStream (std::ostream &stream, int compression)
 
virtual Base::Type getTypeId (void) const
 
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 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...
 
virtual PyObjectgetPyObject (void)
 This method returns the Python wrapper for a C++ object. More...
 
bool isDerivedFrom (const Type type) const
 
virtual void setPyObject (PyObject *)
 
virtual ~BaseClass ()
 Destruction. More...
 

Public Attributes

GCS::Algorithm defaultSolver
 
GCS::Algorithm defaultSolverRedundant
 
bool RecalculateInitialSolutionWhileMovingPoint
 
float SolveTime
 

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< int > Conflicting
 
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< double > MoveParameters
 
double moveStep
 
std::vector< double * > Parameters
 
std::vector< double * > pconstraintplistOut
 
std::vector< GCS::PointPoints
 
std::vector< int > Redundant
 

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 (void)
 
static Type getClassTypeId (void)
 
static void init (void)
 
- 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()

Sketch::~Sketch ( )

Member Function Documentation

◆ addAngleAtPointConstraint()

int Sketch::addAngleAtPointConstraint ( int  geoId1,
PointPos  pos1,
int  geoId2,
PointPos  pos2,
int  geoId3,
PointPos  pos3,
double *  value,
ConstraintType  cTyp,
bool  driving = true 
)

◆ 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.

◆ 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.

◆ 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.

◆ 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()

◆ addConstraints() [1/2]

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

constraints

add all constraints in the list

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

◆ 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 Sketcher::Block, Base::Console(), and Base::ConsoleSingleton::Error().

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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::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.

◆ 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::Point::y.

◆ addEllipse()

◆ addEqualConstraint()

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

add an equal length or radius constraints between two lines or between circles and arcs

References Base::Console(), and Base::ConsoleSingleton::Warning().

◆ addGeometry() [1/3]

int Sketch::addGeometry ( const Part::Geometry geo,
bool  fixed = false 
)

◆ addGeometry() [2/3]

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

add unspecified geometry

◆ 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

◆ addHorizontalConstraint() [1/2]

int Sketch::addHorizontalConstraint ( int  geoId)

add a horizontal constraint to a geometry

◆ addHorizontalConstraint() [2/2]

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

◆ addInternalAlignmentBSplineControlPoint()

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

References Sketcher::mid.

◆ 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

◆ addInternalAlignmentEllipseMinorDiameter()

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

◆ addInternalAlignmentHyperbolaFocus()

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

◆ addInternalAlignmentHyperbolaMajorDiameter()

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

add InternalAlignmentHyperbolaMajorRadius to a line and a hyperbola

◆ 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

◆ addLineSegment()

◆ addParallelConstraint()

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

add a parallel constraint between two lines

◆ addPerpendicularConstraint()

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

add a perpendicular constraint between two lines

References Base::Console(), and Base::ConsoleSingleton::Warning().

◆ addPoint()

◆ addPointCoincidentConstraint()

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

add a coincident constraint to two points of two geometries

◆ addPointOnObjectConstraint()

int Sketch::addPointOnObjectConstraint ( int  geoId1,
PointPos  pos1,
int  geoId2,
bool  driving = true 
)

add a point on line constraint

Referenced by addAngleAtPointConstraint(), and Sketcher::SketchObject::isPointOnCurve().

◆ 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.

◆ 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 Base::Console(), and Base::ConsoleSingleton::Error().

◆ 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

◆ 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

◆ addTangentConstraint()

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

add a tangency constraint between two geometries

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

◆ addVerticalConstraint() [1/2]

int Sketch::addVerticalConstraint ( int  geoId)

add a vertical constraint to a geometry

◆ 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 
)

References GCS::Point::x.

◆ clear()

void Sketch::clear ( void  )

delete all geometry and constraints, leave an empty sketch

◆ extractGeometry()

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

returns the actual geometry

◆ 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, Sketcher::Constraint::GeoUndef, and Sketcher::InternalAlignment.

◆ getConflicting()

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

◆ getDebugMode()

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

◆ getGeometrySize()

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

Returns the size of the Geometry.

◆ 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.

◆ getPoint()

Base::Vector3d Sketch::getPoint ( int  geoId,
PointPos  pos 
) const

retrieves a point

◆ getPointId()

int Sketch::getPointId ( int  geoId,
PointPos  pos 
) const

retrieves the index of a point

References Sketcher::end, Sketcher::mid, Sketcher::none, and Sketcher::start.

◆ getPyGeometry()

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

get the geometry as python objects

◆ getQRAlgorithm()

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

◆ getRedundant()

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

◆ getSolverPrecision()

double Sketcher::Sketch::getSolverPrecision ( )

get standard (aka fine) solver precision

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

◆ hasConflicts()

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

◆ hasDependentParameters()

bool Sketch::hasDependentParameters ( int  geoId,
PointPos  pos 
) const

retrieves whether a geometry has dependent parameters or not

References Sketcher::end, Sketcher::mid, Sketcher::none, and Sketcher::start.

◆ hasRedundancies()

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

◆ initMove()

int Sketch::initMove ( int  geoId,
PointPos  pos,
bool  fine = true 
)

initializes a point (or curve) drag by setting the current sketch status as a reference

References Sketcher::mid, Sketcher::none, GCS::BSpline::poles, Sketcher::start, GCS::Point::x, and GCS::Point::y.

◆ 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 Sketcher::mid, Sketcher::none, GCS::BSpline::poles, Base::Vector3< _Precision >::x, and Base::Vector3< _Precision >::y.

◆ resetInitMove()

void Sketch::resetInitMove ( )

Resets the initialization of a point or curve drag.

◆ resetSolver()

int Sketch::resetSolver ( )

resets the solver

◆ 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)

◆ setDL_tolfRedundant()

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

◆ setDL_tolg()

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

◆ setDL_tolgRedundant()

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

◆ setDL_tolx()

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

◆ 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)

◆ setLM_eps1()

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

◆ 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)

◆ setLM_tauRedundant()

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

◆ setMaxIter()

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

◆ setMaxIterRedundant()

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

◆ setQRAlgorithm()

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

◆ setQRPivotThreshold()

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

◆ 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 Base::Console(), Base::TimeInfo::diffTime(), GCS::IterationLevel, Base::ConsoleSingleton::Log(), and GCS::Minimal.

◆ solve()

◆ toShape()

TopoShape Sketch::toShape ( void  ) const

return the actual geometry of the sketch a TopoShape

Member Data Documentation

◆ Arcs

std::vector<GCS::Arc> Sketcher::Sketch::Arcs
protected

◆ ArcsOfEllipse

std::vector<GCS::ArcOfEllipse> Sketcher::Sketch::ArcsOfEllipse
protected

◆ ArcsOfHyperbola

std::vector<GCS::ArcOfHyperbola> Sketcher::Sketch::ArcsOfHyperbola
protected

◆ ArcsOfParabola

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

◆ BSplines

std::vector<GCS::BSpline> Sketcher::Sketch::BSplines
protected

◆ Circles

std::vector<GCS::Circle> Sketcher::Sketch::Circles
protected

◆ Conflicting

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

◆ ConstraintsCounter

int Sketcher::Sketch::ConstraintsCounter
protected

◆ Constrs

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

◆ debugMode

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

◆ defaultSolver

GCS::Algorithm Sketcher::Sketch::defaultSolver

◆ defaultSolverRedundant

GCS::Algorithm Sketcher::Sketch::defaultSolverRedundant

◆ DrivenParameters

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

◆ Ellipses

std::vector<GCS::Ellipse> Sketcher::Sketch::Ellipses
protected

◆ FixParameters

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

◆ GCSsys

GCS::System Sketcher::Sketch::GCSsys
protected

◆ Geoms

std::vector<GeoDef> Sketcher::Sketch::Geoms
protected

◆ InitParameters

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

◆ initToPoint

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

◆ isFine

bool Sketcher::Sketch::isFine
protected

◆ isInitMove

bool Sketcher::Sketch::isInitMove
protected

◆ Lines

std::vector<GCS::Line> Sketcher::Sketch::Lines
protected

◆ MoveParameters

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

◆ moveStep

double Sketcher::Sketch::moveStep
protected

◆ Parameters

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

◆ pconstraintplistOut

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

◆ Points

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

◆ RecalculateInitialSolutionWhileMovingPoint

bool Sketcher::Sketch::RecalculateInitialSolutionWhileMovingPoint

◆ Redundant

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

◆ SolveTime

float Sketcher::Sketch::SolveTime

The documentation for this class was generated from the following files:
  • src/Mod/Sketcher/App/Sketch.h
  • src/Mod/Sketcher/App/Sketch.cpp
double getAttributeAsFloat(const char *AttrName) const
return the named attribute as a double floating point (does type checking)
Definition: Reader.cpp:159
void readElement(const char *ElementName=0)
read until a start element is found (<name>) or start-end element (<name/>) (with special name if giv...
Definition: Reader.cpp:241
The XML reader class This is an important helper class for the store and retrieval system of objects ...
Definition: Reader.h:117