From ffe2ecaa4acda32944d1b8f6d3b360c0b9a8ac6f Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Sat, 21 Nov 2020 07:30:58 +0100 Subject: [PATCH] Sketcher: Sketch solver interface using geometry state extension for BSpline knot checks ======================================================================================== Until this commit, B-Spline knots were stored, and checked at solver level as sketch points GeomPoints having the construction status set to true. This behaviour is removed to eventually enable normal non-construction points to define the shape out of edit mode. This commit leverages the new mechanism for the solver interface. --- src/Mod/Sketcher/App/Sketch.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/Mod/Sketcher/App/Sketch.cpp b/src/Mod/Sketcher/App/Sketch.cpp index f36f1e4d25..cb22c78d9e 100644 --- a/src/Mod/Sketcher/App/Sketch.cpp +++ b/src/Mod/Sketcher/App/Sketch.cpp @@ -58,6 +58,8 @@ #include "Sketch.h" #include "Constraint.h" +#include "GeometryFacade.h" + using namespace Sketcher; using namespace Base; using namespace Part; @@ -320,12 +322,13 @@ int Sketch::addGeometry(const Part::Geometry *geo, bool fixed) { if (geo->getTypeId() == GeomPoint::getClassTypeId()) { // add a point const GeomPoint *point = static_cast(geo); + auto pointf = GeometryFacade::getFacade(point); // create the definition struct for that geom - if( point->getConstruction() == false ) { - return addPoint(*point, fixed); + if( pointf->getInternalType() == InternalType::BSplineKnotPoint ) { + return addPoint(*point, true); } else { - return addPoint(*point, true); + return addPoint(*point, fixed); } } else if (geo->getTypeId() == GeomLineSegment::getClassTypeId()) { // add a line const GeomLineSegment *lineSeg = static_cast(geo); @@ -2898,8 +2901,9 @@ bool Sketch::updateGeometry() try { if (it->type == Point) { GeomPoint *point = static_cast(it->geo); + auto pointf = GeometryFacade::getFacade(point); - if(!point->getConstruction()) { + if(!(pointf->getInternalType() == InternalType::BSplineKnotPoint)) { point->setPoint(Vector3d(*Points[it->startPointId].x, *Points[it->startPointId].y, 0.0) @@ -3051,7 +3055,9 @@ bool Sketch::updateGeometry() if (Geoms[*it5].type == Point) { GeomPoint *point = static_cast(Geoms[*it5].geo); - if(point->getConstruction()) { + auto pointf = GeometryFacade::getFacade(point); + + if(pointf->getInternalType() == InternalType::BSplineKnotPoint) { point->setPoint(bsp->pointAtParameter(knots[index])); } }