#include <SketchAnalysis.h>
Classes | |
struct | Edge_EqualTo |
struct | Edge_Less |
struct | EdgeIds |
struct | Vertex_EqualTo |
struct | Vertex_Less |
struct | VertexID_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::Vector3d > | getOpenVertices (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< ConstraintIds > | lineequalityConstraints |
std::vector< ConstraintIds > | radiusequalityConstraints |
Sketcher::SketchObject * | sketch |
std::vector< ConstraintIds > | vertexConstraints |
std::vector< ConstraintIds > | verthorizConstraints |
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 | ( | ) |
void SketchAnalysis::analyseMissingPointOnPointCoincident | ( | double | angleprecision = M_PI/8 | ) |
Point on Point constraint simple routine Analyse step (see constructor)
References checkHorizontal(), checkVertical(), Part::GeomCurve::closestParameter(), Base::Console(), Part::GeomCurve::firstDerivativeAtParameter(), Base::Persistence::getClassTypeId(), Part::GeomLineSegment::getEndPoint(), Sketcher::SketchObject::getGeometry(), Part::GeomLineSegment::getStartPoint(), Base::Vector3< _Precision >::Normalize(), Sketcher::Perpendicular, sketch, Sketcher::Tangent, vertexConstraints, and Base::ConsoleSingleton::Warning().
Referenced by Sketcher::SketchObject::analyseMissingPointOnPointCoincident(), and autoconstraint().
int SketchAnalysis::autoconstraint | ( | double | precision = Precision::Confusion() * 1000 , |
double | angleprecision = M_PI/8 , |
||
bool | includeconstruction = true |
||
) |
Fully automated multi-constraint autoconstraining.
It DELETES all the constraints currently present in the Sketcher. The reason is that it makes assumptions to avoid redundancies.
It applies coincidents - vertical/horizontal constraints and equality constraints.
References analyseMissingPointOnPointCoincident(), Sketcher::SketchObject::autoRemoveRedundants(), Base::Console(), Sketcher::SketchObject::deleteAllConstraints(), detectMissingEqualityConstraints(), detectMissingPointOnPointConstraints(), detectMissingVerticalHorizontalConstraints(), App::DocumentObject::getDocument(), Base::ConsoleSingleton::Log(), makeMissingEquality(), makeMissingPointOnPointCoincident(), makeMissingVerticalHorizontal(), draftutils.translate::QT_TRANSLATE_NOOP, sketch, and solvesketch().
Referenced by Sketcher::SketchObject::autoConstraint().
|
protected |
References Base::Vector3< _Precision >::x, and Base::Vector3< _Precision >::y.
Referenced by analyseMissingPointOnPointCoincident(), and detectMissingVerticalHorizontalConstraints().
|
protected |
References Base::Vector3< _Precision >::x, and Base::Vector3< _Precision >::y.
Referenced by analyseMissingPointOnPointCoincident(), and detectMissingVerticalHorizontalConstraints().
int SketchAnalysis::detectDegeneratedGeometries | ( | double | tolerance | ) |
Detect degenerated geometries.
References Base::Persistence::getClassTypeId(), Sketcher::GeometryFacade::getFacade(), Part::GeomCurve::getFirstParameter(), Sketcher::SketchObject::getInternalGeometry(), Part::GeomCurve::getLastParameter(), Part::GeomCurve::length(), sketch, and draftutils.utils::tolerance().
int SketchAnalysis::detectMissingEqualityConstraints | ( | double | precision | ) |
Equality constraints simple routine Detect step (see constructor)
References Sketcher::SketchObject::Constraints, Sketcher::Equal, Sketcher::ConstraintIds::First, Sketcher::SketchAnalysis::EdgeIds::GeoId, Base::Persistence::getClassTypeId(), Part::GeomLineSegment::getEndPoint(), Sketcher::SketchObject::getInternalGeometry(), Part::GeomCircle::getRadius(), Part::GeomArcOfCircle::getRadius(), Part::GeomLineSegment::getStartPoint(), Sketcher::PropertyConstraintList::getValues(), lineequalityConstraints, Sketcher::none, radiusequalityConstraints, sketch, and Sketcher::ConstraintIds::Type.
Referenced by autoconstraint(), and Sketcher::SketchObject::detectMissingEqualityConstraints().
int SketchAnalysis::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.
References Sketcher::Coincident, Sketcher::SketchObject::Constraints, Sketcher::end, Sketcher::SketchAnalysis::VertexIds::GeoId, Base::Persistence::getClassTypeId(), Part::GeomBoundedCurve::getEndPoint(), Part::GeomLineSegment::getEndPoint(), Part::GeomArcOfConic::getEndPoint(), Sketcher::GeometryFacade::getFacade(), Sketcher::SketchObject::getInternalGeometry(), Part::GeomBoundedCurve::getStartPoint(), Part::GeomLineSegment::getStartPoint(), Part::GeomArcOfConic::getStartPoint(), Sketcher::PropertyConstraintList::getValues(), Sketcher::Perpendicular, sketch, Sketcher::start, Sketcher::Tangent, Sketcher::ConstraintIds::Type, draftgeoutils.general::v1(), and vertexConstraints.
Referenced by autoconstraint(), and Sketcher::SketchObject::detectMissingPointOnPointConstraints().
int SketchAnalysis::detectMissingVerticalHorizontalConstraints | ( | double | angleprecision = M_PI/8 | ) |
Vertical/Horizontal constraints simple routine Detect step (see constructor)
References checkHorizontal(), checkVertical(), Base::Persistence::getClassTypeId(), Part::GeomLineSegment::getEndPoint(), Sketcher::SketchObject::getInternalGeometry(), Part::GeomLineSegment::getStartPoint(), Sketcher::Horizontal, Sketcher::none, sketch, Sketcher::ConstraintIds::v, verthorizConstraints, and Sketcher::Vertical.
Referenced by autoconstraint(), and Sketcher::SketchObject::detectMissingVerticalHorizontalConstraints().
std::vector< ConstraintIds > & Sketcher::SketchAnalysis::getMissingLineEqualityConstraints | ( | void | ) |
Equality constraints simple routine Get step for line segments (see constructor)
Referenced by Sketcher::SketchObject::getMissingLineEqualityConstraints().
std::vector< ConstraintIds > & Sketcher::SketchAnalysis::getMissingPointOnPointConstraints | ( | void | ) |
Point on Point constraint simple routine Get step (see constructor)
Referenced by Sketcher::SketchObject::getMissingPointOnPointConstraints().
std::vector< ConstraintIds > & Sketcher::SketchAnalysis::getMissingRadiusConstraints | ( | void | ) |
Equality constraints simple routine Get step for radii (see constructor)
Referenced by Sketcher::SketchObject::getMissingRadiusConstraints().
std::vector< ConstraintIds > & Sketcher::SketchAnalysis::getMissingVerticalHorizontalConstraints | ( | void | ) |
Vertical/Horizontal constraints simple routine Get step (see constructor)
Referenced by Sketcher::SketchObject::getMissingVerticalHorizontalConstraints().
std::vector< Base::Vector3d > SketchAnalysis::getOpenVertices | ( | void | ) | const |
void SketchAnalysis::makeMissingEquality | ( | bool | onebyone = true | ) |
Equality constraints simple routine Make step (see constructor)
References Sketcher::SketchObject::addConstraint(), Sketcher::SketchObject::addConstraints(), Sketcher::SketchObject::autoRemoveRedundants(), lineequalityConstraints, draftutils.translate::QT_TRANSLATE_NOOP, radiusequalityConstraints, sketch, and solvesketch().
Referenced by autoconstraint(), and Sketcher::SketchObject::makeMissingEquality().
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(), and Sketcher::SketchObject::makeMissingPointOnPointCoincident().
void SketchAnalysis::makeMissingVerticalHorizontal | ( | bool | onebyone = false | ) |
Vertical/Horizontal constraints simple routine Make step (see constructor)
References Sketcher::SketchObject::addConstraint(), Sketcher::SketchObject::addConstraints(), Sketcher::SketchObject::autoRemoveRedundants(), draftutils.translate::QT_TRANSLATE_NOOP, sketch, solvesketch(), and verthorizConstraints.
Referenced by autoconstraint(), and Sketcher::SketchObject::makeMissingVerticalHorizontal().
int SketchAnalysis::removeDegeneratedGeometries | ( | double | tolerance | ) |
Remove degenerated geometries.
References Sketcher::SketchObject::delGeometry(), Base::Persistence::getClassTypeId(), Sketcher::GeometryFacade::getFacade(), Part::GeomCurve::getFirstParameter(), Sketcher::SketchObject::getInternalGeometry(), Part::GeomCurve::getLastParameter(), Part::GeomCurve::length(), sketch, and draftutils.utils::tolerance().
void Sketcher::SketchAnalysis::setMissingLineEqualityConstraints | ( | std::vector< ConstraintIds > & | cl | ) |
Equality constraints simple routine Set step for line segments (see constructor)
Referenced by Sketcher::SketchObject::setMissingLineEqualityConstraints().
void Sketcher::SketchAnalysis::setMissingPointOnPointConstraints | ( | std::vector< ConstraintIds > & | cl | ) |
Vertical/Horizontal constraints simple routine Set step (see constructor)
Referenced by Sketcher::SketchObject::setMissingPointOnPointConstraints().
void Sketcher::SketchAnalysis::setMissingRadiusConstraints | ( | std::vector< ConstraintIds > & | cl | ) |
Equality constraints simple routine Set step for radii (see constructor)
Referenced by Sketcher::SketchObject::setMissingRadiusConstraints().
void Sketcher::SketchAnalysis::setMissingVerticalHorizontalConstraints | ( | std::vector< ConstraintIds > & | cl | ) |
Vertical/Horizontal constraints simple routine Set step (see constructor)
Referenced by Sketcher::SketchObject::setMissingVerticalHorizontalConstraints().
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().
|
protected |
Referenced by detectMissingEqualityConstraints(), and makeMissingEquality().
|
protected |
Referenced by detectMissingEqualityConstraints(), and makeMissingEquality().
|
protected |
Referenced by Mod.PartDesign.WizardShaft.ShaftFeature.ShaftFeature::addSegment(), analyseMissingPointOnPointCoincident(), autoconstraint(), detectDegeneratedGeometries(), detectMissingEqualityConstraints(), detectMissingPointOnPointConstraints(), detectMissingVerticalHorizontalConstraints(), getOpenVertices(), makeMissingEquality(), makeMissingPointOnPointCoincident(), makeMissingVerticalHorizontal(), removeDegeneratedGeometries(), solvesketch(), and Mod.PartDesign.WizardShaft.ShaftFeature.ShaftFeature::updateSegment().
|
protected |
|
protected |
Referenced by detectMissingVerticalHorizontalConstraints(), and makeMissingVerticalHorizontal().