View Issue Details

IDProjectCategoryView StatusLast Update
0000421FreeCADBugpublic2011-08-31 09:35
Reportermrlukeparry Assigned ToJriegel 
Status closedResolutionfixed 
Product Versiontrunk 
Fixed in Version0.12 
Summary0000421: Sketcher Module: Undo command after creating geometry with constraints e.g. polyline / rectange crashes
DescriptionI am having the same problem with the fillet tool I'm developing when creating multiple constraints under one doCommand.

Constraints are added using sketchobject::addConstraint() via python interface during an App::openCommand. This will modify the Constraints Property of SketchObject and new constraints are correct. This is expected behaviour.

Using an undo operation the sketcher will crash. Further investigation found that the previous Constraints Property List given to the sketcher is invalid, causing assert when solving constraints with invalid geoId references

I've found that this doesn't apply to adding Constraints individually. For example create a lineSegment and add two constraints. Delete the line segement. Performing undo it will correctly work.

I believe that the problem is something to do with the doCommand. It doesn't store undo history correctly for sketchobjects's constraints property.

Logari has seen this behaviour too.

Additional Information.
TagsNo tags attached.
FreeCAD Information



2011-08-23 06:25

administrator   ~0000989

Can you post some python code that demonstrates the problem, please?


2011-08-23 08:42

developer   ~0000991

Sure this is what Sketcher GUI does. It should be repeatable if you use the sketcher GUI. Hopefully that helps explain the problem better.

Case 1:

C++ calls: Gui::Command::openCommand("Add rectangle");

Following python commands are called using Gui::Command::doCommand(...) all in one body


Perform undo operation and it crashes.

Case 2:

C++ calls: Gui::Command::openCommand("Add Line");

C++ calls: Gui::Command::openCommand("Add Constraint");

C++ calls: Gui::Command::openCommand("Add Constraint");

C++ calls: Gui::Command::openCommand("Delete Geometry");
App.ActiveDocument.Sketch.delGeometry(5) (5 is geoId of line)

Perform undo operation and both line and constraints are correctly added


2011-08-23 16:38

viewer   ~0000994

I have digged into this problem. Its basically that the undo
restore first the Contraint property and then the geometry property.
but after restoring Constraint the Sketch solver in the ViewProvider
is updated and then has constraints without the geometry.

Im on the way to harden the sketcher for that...


2011-08-25 06:19

administrator   ~0000996

The problem is the following:
When creating the rectangle the geometry list property gets filled with some line segments and the constraint list property with the coincident and horizontal/vertical constraints.

Now when doing an undo (while sketcher is still in edit mode) it first restores the geometry list property, i.e. the empty list, we get the case that we have an empty geometry list but a non-empty constraint list. This scenario is currently not well handled.


2011-08-25 06:54

administrator   ~0000997

I made some changes to ViewProviderSketch::draw() and Sketch::setUpSketch(). When having the case of empty geometry list and non-empty constraint list we simply ignore the latter.

Fixed in r4800


2011-08-25 07:34

administrator   ~0000998

fixed with 4801

Preserving the undo/redo sequence of properties in a object


2011-08-25 18:04

administrator   ~0001003

Thats neat, we fixed it from both ends! ;) A double fix ;)))


2011-08-31 09:26

administrator   ~0001025



2011-08-31 09:35

administrator   ~0001026

Set again to "Closed" to make it disappear from the todo list

Issue History

Date Modified Username Field Change
2011-08-21 14:04 mrlukeparry New Issue
2011-08-21 17:06 Jriegel Status new => assigned
2011-08-21 17:06 Jriegel Assigned To => Jriegel
2011-08-23 06:25 wmayer Note Added: 0000989
2011-08-23 08:42 mrlukeparry Note Added: 0000991
2011-08-23 16:38 unauthenticated Note Added: 0000994
2011-08-25 06:19 wmayer Note Added: 0000996
2011-08-25 06:54 wmayer Note Added: 0000997
2011-08-25 06:54 wmayer Status assigned => closed
2011-08-25 06:54 wmayer Resolution open => fixed
2011-08-25 06:54 wmayer Fixed in Version => 0.12
2011-08-25 07:34 Jriegel Note Added: 0000998
2011-08-25 07:34 Jriegel Status closed => resolved
2011-08-25 08:24 wmayer Status resolved => closed
2011-08-25 18:04 Jriegel Note Added: 0001003
2011-08-31 09:26 Jriegel Note Added: 0001025
2011-08-31 09:26 Jriegel Status closed => resolved
2011-08-31 09:35 wmayer Note Added: 0001026
2011-08-31 09:35 wmayer Status resolved => closed