Skip to content

Commit

Permalink
Sketcher: Bug fix Trim
Browse files Browse the repository at this point in the history
======================

In no update mode, the last constraint was not enforced. The DoF was not properly shown.

The trim operation it is always solved at the end now if in no recompute mode.
  • Loading branch information
abdullahtahiriyo authored and wwmayer committed Jun 24, 2015
1 parent 65310f0 commit 93c836f
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 3 deletions.
41 changes: 39 additions & 2 deletions src/Mod/Sketcher/App/SketchObject.cpp
Expand Up @@ -1024,8 +1024,11 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
newConstr->FirstPos = none;
newConstr->Second = newGeoId;
addConstraint(newConstr);

delete newConstr;

if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver
solve();

return 0;
}
} else if (x1 < 0.001*length) { // drop the first intersection point
Expand Down Expand Up @@ -1070,6 +1073,10 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)

addConstraint(newConstr);
delete newConstr;

if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver
solve();

return 0;
}
else if (x1 < x0) { // trim line end
Expand All @@ -1086,6 +1093,10 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)

addConstraint(newConstr);
delete newConstr;

if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver
solve();

return 0;
}
}
Expand Down Expand Up @@ -1166,6 +1177,9 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
addConstraint(newConstr);

delete newConstr;

if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver
solve();

return 0;
}
Expand Down Expand Up @@ -1253,7 +1267,10 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
addConstraint(newConstr);

delete newConstr;


if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver
solve();

return 0;
}
} else if (geo->getTypeId() == Part::GeomArcOfCircle::getClassTypeId()) {
Expand Down Expand Up @@ -1345,6 +1362,9 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
addConstraint(newConstr);

delete newConstr;

if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver
solve();

return 0;
} else
Expand Down Expand Up @@ -1391,6 +1411,10 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)

addConstraint(newConstr);
delete newConstr;

if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver
solve();

return 0;
}
else { // trim arc end
Expand All @@ -1408,6 +1432,10 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)

addConstraint(newConstr);
delete newConstr;

if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver
solve();

return 0;
}
}
Expand Down Expand Up @@ -1511,6 +1539,9 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
addConstraint(newConstr);

delete newConstr;

if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver
solve();

return 0;
} else
Expand Down Expand Up @@ -1560,13 +1591,19 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)

addConstraint(newConstr);
delete newConstr;

if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver
solve();

return 0;
}
else { // trim arc end
delConstraintOnPoint(GeoId, end, false);
Part::GeomArcOfEllipse *aoe1 = dynamic_cast<Part::GeomArcOfEllipse*>(geomlist[GeoId]);
aoe1->setRange(startAngle, startAngle + theta1, /*emulateCCW=*/true);

if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver
solve();
return 0;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Sketcher/Gui/CommandCreateGeo.cpp
Expand Up @@ -4365,7 +4365,7 @@ class DrawSketchHandlerTrimming: public DrawSketchHandler
bool autoRecompute = hGrp->GetBool("AutoRecompute",false);

if(autoRecompute)
Gui::Command::updateActive();
Gui::Command::updateActive();
}
catch (const Base::Exception& e) {
Base::Console().Error("%s\n", e.what());
Expand Down

0 comments on commit 93c836f

Please sign in to comment.