[PythonCAD] Working on undo/redo stuff

Art Haas ahaas at airmail.net
Tue Jan 13 18:16:19 EST 2004


On Tue, Jan 13, 2004 at 04:15:20PM -0500, blanding at localnet.com wrote:
> >
> > 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.

I want to keep track of things like color changes or linetype changes. I
thought ME-10 did that as well, in addition to keeping track of geometry
changes like splitting, stretching, and moving.

> 
> > 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.
> 

That may be how things end up being coded, but instead of just pounding
away at the keyboard I want to try and figure out if there is a better
way of solving this problem. There might not be, or things may reach a
point where any solution, even a possibly sub-optimal one,  is better
than no solution at all. I've been digging into Gnumeric's undo stuff
today (a _great_ program - I am in awe of Jody Goldberg and the Gnumeric
developers!), and it is starting to make a little sense.

Art
-- 
Man once surrendering his reason, has no remaining guard against absurdities
the most monstrous, and like a ship without rudder, is the sport of every wind.

-Thomas Jefferson to James Smith, 1822



More information about the PythonCAD mailing list