diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index f0f6ee2af3..6cf5298bfb 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -3366,6 +3366,9 @@ int SketchObject::exposeInternalGeometry(int GeoId) std::vector controlpoints(bsp->countPoles()); std::vector controlpointgeoids(bsp->countPoles()); + std::vector knotpoints(bsp->countKnots()); + std::vector knotgeoids(bsp->countKnots()); + bool isfirstweightconstrained = false; std::vector::iterator itb; @@ -3375,6 +3378,11 @@ int SketchObject::exposeInternalGeometry(int GeoId) (*it)=-1; (*itb)=false; } + + for(it=knotgeoids.begin(), itb=knotpoints.begin(); it!=knotgeoids.end() && itb!=knotpoints.end(); ++it, ++itb) { + (*it)=-1; + (*itb)=false; + } const std::vector< Sketcher::Constraint * > &vals = Constraints.getValues(); @@ -3388,6 +3396,9 @@ int SketchObject::exposeInternalGeometry(int GeoId) controlpoints[(*it)->InternalAlignmentIndex] = true; controlpointgeoids[(*it)->InternalAlignmentIndex] = (*it)->First; break; + case Sketcher::BSplineKnotPoint: + knotpoints[(*it)->InternalAlignmentIndex] = true; + knotgeoids[(*it)->InternalAlignmentIndex] = (*it)->First; default: return -1; } @@ -3411,6 +3422,7 @@ int SketchObject::exposeInternalGeometry(int GeoId) std::vector icon; std::vector poles = bsp->getPoles(); + std::vector knots = bsp->getKnots(); double distance_p0_p1 = (poles[1]-poles[0]).Length(); // for visual purposes only @@ -3454,6 +3466,37 @@ int SketchObject::exposeInternalGeometry(int GeoId) incrgeo++; } } + + index=0; + + for(it=knotgeoids.begin(), itb=knotpoints.begin(); it!=knotgeoids.end() && itb!=knotpoints.end(); ++it, ++itb, index++) { + + if(!(*itb)) // if knot point not existing + { + Part::GeomPoint *kp = new Part::GeomPoint(); + + kp->setPoint(bsp->pointAtParameter(knots[index])); + + // a construction point, for now on, is a point that is not handled by the solver and does not contribute to the dofs + // This is done so as to avoid having to add another data member to GeomPoint that is specific for the sketcher. + kp->Construction=true; + + igeo.push_back(kp); + + Sketcher::Constraint *newConstr = new Sketcher::Constraint(); + newConstr->Type = Sketcher::InternalAlignment; + newConstr->AlignmentType = Sketcher::BSplineKnotPoint; + newConstr->First = currentgeoid+incrgeo+1; + newConstr->FirstPos = Sketcher::mid; + newConstr->Second = GeoId; + newConstr->InternalAlignmentIndex = index; + + icon.push_back(newConstr); + + incrgeo++; + } + } + Q_UNUSED(isfirstweightconstrained); // constraint the first weight to allow for seamless weight modification and proper visualization