Sketcher: Add FullyConstrained read-only output property

========================================================

This property stores whether a Sketch has 0 DoF or not upon solve.

It is serialised to disk, enabling a recently loaded project to have an accurate
populated property even before the first solve() call.
This commit is contained in:
Abdullah Tahiri
2021-01-03 16:55:07 +01:00
committed by abdullahtahiriyo
parent f9143750ab
commit 035bea5082
2 changed files with 3 additions and 0 deletions

View File

@@ -110,6 +110,7 @@ SketchObject::SketchObject()
ADD_PROPERTY_TYPE(Geometry, (0) ,"Sketch",(App::PropertyType)(App::Prop_None),"Sketch geometry");
ADD_PROPERTY_TYPE(Constraints, (0) ,"Sketch",(App::PropertyType)(App::Prop_None),"Sketch constraints");
ADD_PROPERTY_TYPE(ExternalGeometry,(0,0),"Sketch",(App::PropertyType)(App::Prop_None),"Sketch external geometry");
ADD_PROPERTY_TYPE(FullyConstrained, (false),"Sketch",(App::PropertyType)(App::Prop_Output|App::Prop_ReadOnly |App::Prop_Hidden),"Sketch is fully constrained");
Geometry.setOrderRelevant(true);
@@ -251,6 +252,7 @@ int SketchObject::solve(bool updateGeoAfterSolving/*=true*/)
lastDoF = solvedSketch.setUpSketch(getCompleteGeometry(), Constraints.getValues(),
getExternalGeometryCount());
FullyConstrained.setValue(lastDoF == 0);
// At this point we have the solver information about conflicting/redundant/over-constrained, but the sketch is NOT solved.
// Some examples:
// Redundant: a vertical line, a horizontal line and an angle constraint of 90 degrees between the two lines

View File

@@ -67,6 +67,7 @@ public:
Part ::PropertyGeometryList Geometry;
Sketcher::PropertyConstraintList Constraints;
App ::PropertyLinkSubList ExternalGeometry;
App ::PropertyBool FullyConstrained;
/** @name methods override Feature */
//@{
short mustExecute() const override;