From f1cf2fca4431748502f51d407144dcce59498b28 Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Sun, 19 Feb 2017 21:37:35 +0100 Subject: [PATCH] Sketcher: Expose Internal Geometry for BSplines =============================================== This commit changes the behaviour of expose internal geometry for bsplines and makes it converge with the implementation for other complex forms. This functionality now does not introduce constraints (the DoF is not affected by its execution). BSplines, when created, are still created as polynomic. However, exposing previously deleted or otherwise hidden (increase of degree) poles does not constraint them. why? While a priori the old behaviour is advantageous for the user in many situations, it severely breaks NURBS-ized shapes and gets in the way of bsplines after increasing the degree of the bspline. --- src/Mod/Sketcher/App/SketchObject.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 686270c783..09083b35e6 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -3438,14 +3438,14 @@ int SketchObject::ExposeInternalGeometry(int GeoId) if(it != controlpointgeoids.begin()) { // if pole-weight newly created make it equal to first weight by default - Sketcher::Constraint *newConstr2 = new Sketcher::Constraint(); + /*Sketcher::Constraint *newConstr2 = new Sketcher::Constraint(); newConstr2->Type = Sketcher::Equal; newConstr2->First = currentgeoid+incrgeo+1; newConstr2->FirstPos = Sketcher::none; newConstr2->Second = controlpointgeoids[0]; newConstr2->SecondPos = Sketcher::none; - icon.push_back(newConstr2); + icon.push_back(newConstr2);*/ } else { controlpointgeoids[0] = currentgeoid+incrgeo+1; @@ -3456,7 +3456,7 @@ int SketchObject::ExposeInternalGeometry(int GeoId) } // constraint the first weight to allow for seamless weight modification and proper visualization - if(!isfirstweightconstrained) { + /*if(!isfirstweightconstrained) { Sketcher::Constraint *newConstr = new Sketcher::Constraint(); newConstr->Type = Sketcher::Radius; @@ -3466,7 +3466,7 @@ int SketchObject::ExposeInternalGeometry(int GeoId) icon.push_back(newConstr); - } + }*/ this->addGeometry(igeo,true); this->addConstraints(icon); @@ -3781,7 +3781,14 @@ bool SketchObject::ConvertToNURBS(int GeoId) Part::GeomBSplineCurve* bspline; try { - bspline = geo1->toNurbs(geo1->getFirstParameter(), geo1->getLastParameter()); + bspline = geo1->toNurbs(geo1->getFirstParameter(), geo1->getLastParameter()); + + if(geo1->isDerivedFrom(Part::GeomArcOfConic::getClassTypeId())){ + const Part::GeomArcOfConic * geoaoc = static_cast(geo1); + + if(geoaoc->isReversed()) + bspline->Reverse(); + } } catch (const Base::Exception& e) { Base::Console().Error("%s\n", e.what());