diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index b502eee50..3416d25a9 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -557,7 +557,7 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) } this->Constraints.setValues(newVals); - + movePoint(GeoId, end, point1); movePoint(newGeoId, start, point2); @@ -661,9 +661,9 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) std::vector< Part::Geometry * > newVals(geomlist); newVals[GeoId] = geoNew; Geometry.setValues(newVals); - delete geoNew; - + rebuildVertexIndex(); + // go through all constraints and replace the point (GeoId,end) with (newGeoId,end) /*const std::vector &constraints = this->Constraints.getValues(); std::vector newVals(constraints); @@ -676,7 +676,7 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) constraints[i]->Second = newGeoId; } */ - + // constrain the trimming points on the corresponding geometries Sketcher::Constraint *newConstr = new Sketcher::Constraint(); newConstr->Type = Sketcher::PointOnObject; @@ -756,7 +756,7 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) Constraint *constNew = newVals[i]->clone(); constNew->First = newGeoId; newVals[i] = constNew; - + } else if (constraints[i]->Second == GeoId && constraints[i]->SecondPos == end) { diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index d23aa1335..678c77d61 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -1969,23 +1969,23 @@ Restart: Base::Vector3d constrPos2 = midpos2 + (norm2 * scale * 2.5); constrPos2 = seekConstraintPosition(constrPos2, dir2, scale * 2.5, edit->constrGroup->getChild(i)); - // Translate the Icon based on calculated position - Base::Vector3d relPos1 = constrPos1 - midpos1 ; // Relative Position of Icons to Midpoint1 - Base::Vector3d relPos2 = constrPos2 - midpos2 ; // Relative Position of Icons to Midpoint2 + // Translate the Icon based on calculated position + Base::Vector3d relPos1 = constrPos1 - midpos1 ; // Relative Position of Icons to Midpoint1 + Base::Vector3d relPos2 = constrPos2 - midpos2 ; // Relative Position of Icons to Midpoint2 - relPos1 = relPos1 / scale; - relPos2 = relPos2 / scale; + relPos1 = relPos1 / scale; + relPos2 = relPos2 / scale; - dynamic_cast(sep->getChild(1))->abPos = SbVec3f(midpos1.x, midpos1.y, zConstr); //Absolute Reference + dynamic_cast(sep->getChild(1))->abPos = SbVec3f(midpos1.x, midpos1.y, zConstr); //Absolute Reference - //Reference Position that is scaled according to zoom - dynamic_cast(sep->getChild(1))->translation = SbVec3f(relPos1.x, relPos1.y, 0); + //Reference Position that is scaled according to zoom + dynamic_cast(sep->getChild(1))->translation = SbVec3f(relPos1.x, relPos1.y, 0); - Base::Vector3d secondPos = midpos2 - midpos1; - dynamic_cast(sep->getChild(3))->abPos = SbVec3f(secondPos.x, secondPos.y, zConstr); //Absolute Reference + Base::Vector3d secondPos = midpos2 - midpos1; + dynamic_cast(sep->getChild(3))->abPos = SbVec3f(secondPos.x, secondPos.y, zConstr); //Absolute Reference - //Reference Position that is scaled according to zoom - dynamic_cast(sep->getChild(3))->translation = SbVec3f(relPos2.x -relPos1.x, relPos2.y -relPos1.y, 0); + //Reference Position that is scaled according to zoom + dynamic_cast(sep->getChild(3))->translation = SbVec3f(relPos2.x -relPos1.x, relPos2.y -relPos1.y, 0); break; }