View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000421 | FreeCAD | Bug | public | 2011-08-21 14:04 | 2011-08-31 09:35 |
Reporter | mrlukeparry | Assigned To | |||
Priority | normal | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | trunk | ||||
Fixed in Version | 0.12 | ||||
Summary | 0000421: Sketcher Module: Undo command after creating geometry with constraints e.g. polyline / rectange crashes | ||||
Description | I 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 | . | ||||
Tags | No tags attached. | ||||
FreeCAD Information | |||||
|
Can you post some python code that demonstrates the problem, please? |
|
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 App.ActiveDocument.Sketch.addGeometry(Part.Line(App.Vector(-81.788582,23.914791,0),App.Vector(3.730702,23.914791,0))) App.ActiveDocument.Sketch.addGeometry(Part.Line(App.Vector(3.730702,23.914791,0),App.Vector(3.730702,-21.045017,0))) App.ActiveDocument.Sketch.addGeometry(Part.Line(App.Vector(3.730702,-21.045017,0),App.Vector(-81.788582,-21.045017,0))) App.ActiveDocument.Sketch.addGeometry(Part.Line(App.Vector(-81.788582,-21.045017,0),App.Vector(-81.788582,23.914791,0))) App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Coincident',0,2,1,1)) App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Coincident',1,2,2,1)) App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Coincident',2,2,3,1)) App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Coincident',3,2,0,1)) App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Horizontal',0)) App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Horizontal',2)) App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Vertical',1)) App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Vertical',3)) Perform undo operation and it crashes. Case 2: C++ calls: Gui::Command::openCommand("Add Line"); App.ActiveDocument.Sketch.addGeometry(Part.Line(App.Vector(-81.788582,23.914791,0),App.Vector(3.730702,23.914791,0))) C++ calls: Gui::Command::openCommand("Add Constraint"); App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Vertical',5)) C++ calls: Gui::Command::openCommand("Add Constraint"); App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Distance',5,52.421224)) 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 |
|
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... |
|
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. |
|
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 |
|
fixed with 4801 Preserving the undo/redo sequence of properties in a object |
|
Thats neat, we fixed it from both ends! ;) A double fix ;))) |
|
Fixed. |
|
Set again to "Closed" to make it disappear from the todo list |
Date Modified | Username | Field | Change |
---|---|---|---|
2011-08-21 14:04 | mrlukeparry | New Issue | |
2011-08-21 17:06 |
|
Status | new => assigned |
2011-08-21 17:06 |
|
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 |
|
Note Added: 0000998 | |
2011-08-25 07:34 |
|
Status | closed => resolved |
2011-08-25 08:24 | wmayer | Status | resolved => closed |
2011-08-25 18:04 |
|
Note Added: 0001003 | |
2011-08-31 09:26 |
|
Note Added: 0001025 | |
2011-08-31 09:26 |
|
Status | closed => resolved |
2011-08-31 09:35 | wmayer | Note Added: 0001026 | |
2011-08-31 09:35 | wmayer | Status | resolved => closed |