[PythonCAD] Working on undo/redo stuff

blanding at localnet.com blanding at localnet.com
Tue Jan 13 16:15:20 EST 2004

> Adding an undo/redo ability for things like changing an entities color
> or linetype is straightforward, but things get more complex when
> entities are deleted, and that is where I am getting bogged down. I

In my CoCreate 3D CAD, undo/redo only applies to model geometry changes,
not to things such as color. If you were to follow a similar approach in
2D, you would ignore things like line type and color, but only keep
track of things like stretching, filleting, etc.

> haven't figured a good way to store the undo/redo stuff so that it is
> not tied to the existance of a particular object. By this I mean the
> id() of the object, as the entities may/will get deleted during some
> action, and then new entities will be created in the undo operation, so
> the undo history of the old entity is now lost.

I'm thinking if you delete an object, just store its parameters in the
undo stack so that it can be recreated if needed. Maybe in a dxf style
format or something like that.

--Doug Blanding

More information about the PythonCAD mailing list