Sketcher: Bug fixes: inability to create links to external geometry

=================================================================

First bug: Inability to create links to external geometry as described here:
http://forum.freecadweb.org/download/file.php?id=16668

Second bug: FC crashes on changing the support after having imported external geometry as described here:
http://forum.freecadweb.org/viewtopic.php?f=10&t=12380

and solving this ticket:
http://www.freecadweb.org/tracker/view.php?id=2225

Solution to first bug:

If for some reason a sketch ends up having a list of external geometries (property) that can not be recreated (rebuilt),
they remain latent, do not show the external elements in the elements widget or in the screen and prevent adding the
elements again.

In cases where the saved file contains invalid external geometry links (which will give raise to a handled exception that would prevent external geometry creation),
this condition gets detected during restore and the invalid links are deleted before external geometry creation, so as to allow the rest of external links to be recreated.

Solution to second bug:

It is also related to invalid external links (the link was existing, but upon change on the support, it is possible that an external edge is no longer valid, reduction of edges in support).
This situation is detected upon entering into edit mode, and the invalid ones are deleted.

Note that there is still the possibility for the user to remap an invalid sketch BEFORE editing, if the remapping is successful, it may not be necessary to delete links (all depends on the
specific case).
This commit is contained in:
Abdullah Tahiri
2015-09-08 20:08:47 +02:00
committed by wmayer
parent 98bcd12640
commit 3e5b0bd2f7
3 changed files with 104 additions and 1 deletions

View File

@@ -4223,6 +4223,10 @@ bool ViewProviderSketch::setEdit(int ModNum)
// The false parameter indicates that the geometry of the SketchObject shall not be updateData
// so as not to trigger an onChanged that would set the document as modified and trigger a recompute
// if we just close the sketch without touching anything.
if(getSketchObject()->Support.getValue())
if (!getSketchObject()->evaluateSupport())
getSketchObject()->validateExternalLinks();
getSketchObject()->solve(false);
UpdateSolverInformation();
draw(false);