#include <SketchAnalysis.h>

Classes

struct  Edge_EqualTo
 
struct  Edge_Less
 
struct  EdgeIds
 
struct  Vertex_EqualTo
 
struct  Vertex_Less
 
struct  VertexIds
 

Public Member Functions

void analyseMissingPointOnPointCoincident (double angleprecision=M_PI/8)
 Point on Point constraint simple routine Analyse step (see constructor) More...
 
int autoconstraint (double precision=Precision::Confusion() *1000, double angleprecision=M_PI/8, bool includeconstruction=true)
 Fully automated multi-constraint autoconstraining. More...
 
int detectDegeneratedGeometries (double tolerance)
 Detect degenerated geometries. More...
 
int detectMissingEqualityConstraints (double precision)
 Equality constraints simple routine Detect step (see constructor) More...
 
int detectMissingPointOnPointConstraints (double precision=Precision::Confusion() *1000, bool includeconstruction=true)
 Point on Point constraint simple routine Detect step (see constructor) Detect detects only coincident constraints, Analyse converts coincident to endpoint perpendicular/tangent where appropriate. More...
 
int detectMissingVerticalHorizontalConstraints (double angleprecision=M_PI/8)
 Vertical/Horizontal constraints simple routine Detect step (see constructor) More...
 
std::vector< ConstraintIds > & getMissingLineEqualityConstraints (void)
 Equality constraints simple routine Get step for line segments (see constructor) More...
 
std::vector< ConstraintIds > & getMissingPointOnPointConstraints (void)
 Point on Point constraint simple routine Get step (see constructor) More...
 
std::vector< ConstraintIds > & getMissingRadiusConstraints (void)
 Equality constraints simple routine Get step for radii (see constructor) More...
 
std::vector< ConstraintIds > & getMissingVerticalHorizontalConstraints (void)
 Vertical/Horizontal constraints simple routine Get step (see constructor) More...
 
std::vector< Base::Vector3dgetOpenVertices (void) const
 
void makeMissingEquality (bool onebyone=true)
 Equality constraints simple routine Make step (see constructor) More...
 
void makeMissingPointOnPointCoincident (bool onebyone=false)
 Point on Point constraint simple routine Make step (see constructor) if onebyone, then the sketch is solved after each individual constraint addition and any redundancy removed. More...
 
void makeMissingVerticalHorizontal (bool onebyone=false)
 Vertical/Horizontal constraints simple routine Make step (see constructor) More...
 
int removeDegeneratedGeometries (double tolerance)
 Remove degenerated geometries. More...
 
void setMissingLineEqualityConstraints (std::vector< ConstraintIds > &cl)
 Equality constraints simple routine Set step for line segments (see constructor) More...
 
void setMissingPointOnPointConstraints (std::vector< ConstraintIds > &cl)
 Vertical/Horizontal constraints simple routine Set step (see constructor) More...
 
void setMissingRadiusConstraints (std::vector< ConstraintIds > &cl)
 Equality constraints simple routine Set step for radii (see constructor) More...
 
void setMissingVerticalHorizontalConstraints (std::vector< ConstraintIds > &cl)
 Vertical/Horizontal constraints simple routine Set step (see constructor) More...
 
 SketchAnalysis (Sketcher::SketchObject *Obj)
 Creates an instance of the SketchAnalysis object, taking as parameter a pointer to an SketchObject. More...
 
void solvesketch (int &status, int &dofs, bool updategeo)
 solves the sketch and retrieves the error status, and the degrees of freedom. More...
 
 ~SketchAnalysis ()
 

Protected Member Functions

bool checkHorizontal (Base::Vector3d dir, double angleprecision)
 
bool checkVertical (Base::Vector3d dir, double angleprecision)
 

Protected Attributes

std::vector< ConstraintIdslineequalityConstraints
 
std::vector< ConstraintIdsradiusequalityConstraints
 
Sketcher::SketchObjectsketch
 
std::vector< ConstraintIdsvertexConstraints
 
std::vector< ConstraintIdsverthorizConstraints
 

Constructor & Destructor Documentation

◆ SketchAnalysis()

SketchAnalysis::SketchAnalysis ( Sketcher::SketchObject Obj)

Creates an instance of the SketchAnalysis object, taking as parameter a pointer to an SketchObject.

There is a first type of routines, simple routines, which work in the following order: Detect - (Analyse) - [Get] - [Set] - Make

The Detect step just identifies possible missing constraints.

The Analyse, which is not available for all the routines, operates in detected constraints of the same routine, to look for alternatives. For example, a general pointonpoint detection leads to a search for coincident constraints, which can be later run via Analyse if it is intended to convert endpoint coincidence to endpoint perpendicular and tangent constraints.

The Get retrieves the result of the analysis as a vector of ConstraintIds, indicating the suggested constraints. This step is intended for enabling the user to check the result of the analysis, rather than applying it. If only applying is intended, this step is not necessary as the Make will operate on the result of the Detect - Analyse directly.

The Set changes the detected result. It modifies the SketchAnalysis object. It only modifies the SketchObject as far as the SketchAnalysis is changed. It does not apply any changes to the sketch. It is intended so as to enable the user to change the result that will be applied.

Neither the Detect, nor the Analyse, nor the Get steps modify the Sketch geometry.

Make applies the constraints stored internally in the SketchAnalysis object.

A second type of routines, complex routines, are thought for running fully automatic and they Detect, Analyse and Make. They may also apply a variaty of types of Constraints.

A third type of routines do not relate to autoconstraining at all, and include validation methods for sketches.

◆ ~SketchAnalysis()

SketchAnalysis::~SketchAnalysis ( )

Member Function Documentation

◆ analyseMissingPointOnPointCoincident()

◆ autoconstraint()

int SketchAnalysis::autoconstraint ( double  precision = Precision::Confusion() * 1000,
double  angleprecision = M_PI/8,
bool  includeconstruction = true 
)

◆ checkHorizontal()

bool SketchAnalysis::checkHorizontal ( Base::Vector3d  dir,
double  angleprecision 
)
protected

◆ checkVertical()

bool SketchAnalysis::checkVertical ( Base::Vector3d  dir,
double  angleprecision 
)
protected

◆ detectDegeneratedGeometries()

◆ detectMissingEqualityConstraints()

◆ detectMissingPointOnPointConstraints()

◆ detectMissingVerticalHorizontalConstraints()

int SketchAnalysis::detectMissingVerticalHorizontalConstraints ( double  angleprecision = M_PI/8)

◆ getMissingLineEqualityConstraints()

std::vector<ConstraintIds>& Sketcher::SketchAnalysis::getMissingLineEqualityConstraints ( void  )

Equality constraints simple routine Get step for line segments (see constructor)

◆ getMissingPointOnPointConstraints()

std::vector<ConstraintIds>& Sketcher::SketchAnalysis::getMissingPointOnPointConstraints ( void  )

Point on Point constraint simple routine Get step (see constructor)

◆ getMissingRadiusConstraints()

std::vector<ConstraintIds>& Sketcher::SketchAnalysis::getMissingRadiusConstraints ( void  )

Equality constraints simple routine Get step for radii (see constructor)

◆ getMissingVerticalHorizontalConstraints()

std::vector<ConstraintIds>& Sketcher::SketchAnalysis::getMissingVerticalHorizontalConstraints ( void  )

Vertical/Horizontal constraints simple routine Get step (see constructor)

◆ getOpenVertices()

◆ makeMissingEquality()

void SketchAnalysis::makeMissingEquality ( bool  onebyone = true)

◆ makeMissingPointOnPointCoincident()

void SketchAnalysis::makeMissingPointOnPointCoincident ( bool  onebyone = false)

Point on Point constraint simple routine Make step (see constructor) if onebyone, then the sketch is solved after each individual constraint addition and any redundancy removed.

References Sketcher::SketchObject::addConstraint(), Sketcher::SketchObject::addConstraints(), Sketcher::SketchObject::autoRemoveRedundants(), draftutils.translate::QT_TRANSLATE_NOOP, sketch, solvesketch(), and vertexConstraints.

Referenced by autoconstraint().

◆ makeMissingVerticalHorizontal()

void SketchAnalysis::makeMissingVerticalHorizontal ( bool  onebyone = false)

◆ removeDegeneratedGeometries()

◆ setMissingLineEqualityConstraints()

void Sketcher::SketchAnalysis::setMissingLineEqualityConstraints ( std::vector< ConstraintIds > &  cl)

Equality constraints simple routine Set step for line segments (see constructor)

◆ setMissingPointOnPointConstraints()

void Sketcher::SketchAnalysis::setMissingPointOnPointConstraints ( std::vector< ConstraintIds > &  cl)

Vertical/Horizontal constraints simple routine Set step (see constructor)

◆ setMissingRadiusConstraints()

void Sketcher::SketchAnalysis::setMissingRadiusConstraints ( std::vector< ConstraintIds > &  cl)

Equality constraints simple routine Set step for radii (see constructor)

◆ setMissingVerticalHorizontalConstraints()

void Sketcher::SketchAnalysis::setMissingVerticalHorizontalConstraints ( std::vector< ConstraintIds > &  cl)

Vertical/Horizontal constraints simple routine Set step (see constructor)

◆ solvesketch()

void SketchAnalysis::solvesketch ( int &  status,
int &  dofs,
bool  updategeo 
)

solves the sketch and retrieves the error status, and the degrees of freedom.

It enables to solve updating the geometry (so moving the geometry to match the constraints) or preserving the geometry.

References Sketcher::SketchObject::getLastDoF(), Sketcher::SketchObject::getLastHasConflicts(), Sketcher::SketchObject::getLastHasRedundancies(), Sketcher::SketchObject::setUpSketch(), sketch, and Sketcher::SketchObject::solve().

Referenced by autoconstraint(), makeMissingEquality(), makeMissingPointOnPointCoincident(), and makeMissingVerticalHorizontal().

Member Data Documentation

◆ lineequalityConstraints

std::vector<ConstraintIds> Sketcher::SketchAnalysis::lineequalityConstraints
protected

◆ radiusequalityConstraints

std::vector<ConstraintIds> Sketcher::SketchAnalysis::radiusequalityConstraints
protected

◆ sketch

◆ vertexConstraints

std::vector<ConstraintIds> Sketcher::SketchAnalysis::vertexConstraints
protected

◆ verthorizConstraints

std::vector<ConstraintIds> Sketcher::SketchAnalysis::verthorizConstraints
protected

The documentation for this class was generated from the following files:
  • Sources/FreeCAD/src/Mod/Sketcher/App/SketchAnalysis.h
  • Sources/FreeCAD/src/Mod/Sketcher/App/SketchAnalysis.cpp