Sketcher: Improved B-Spline creation

This commit is contained in:
Abdullah Tahiri
2018-05-23 17:45:49 +02:00
committed by wmayer
parent 4805927170
commit ec6eaa509d

View File

@@ -4712,11 +4712,28 @@ public:
ConstrMethod == 0 ?"False":"True",
geometryCreationMode==Construction?"True":"False");
currentgeoid++;
// autoconstraints were added to the circles of the poles, which is ok because they must go to the
// right position, or the user will freak-out if they appear out of the autoconstrained position.
// However, autoconstrains on the first and last pole, in normal non-periodic b-splines (with appropriate endpoint knot multiplicity)
// as the ones created by this tool are intended for the b-spline endpoints, and not for the poles,
// so here we retrieve any autoconstraint on those poles' center and mangle it to the endpoint.
if (ConstrMethod == 0) {
for(auto & constr : static_cast<Sketcher::SketchObject *>(sketchgui->getObject())->Constraints.getValues()) {
if(constr->First == FirstPoleGeoId && constr->FirstPos == Sketcher::mid) {
constr->First = currentgeoid;
constr->FirstPos = Sketcher::start;
}
else if(constr->First == (FirstPoleGeoId + CurrentConstraint - 1) && constr->FirstPos == Sketcher::mid) {
constr->First = currentgeoid;
constr->FirstPos = Sketcher::end;
}
}
}
// Constraint pole circles to B-spline.
std::stringstream cstream;