[PythonCAD] Working on undo/redo stuff
Rafael Villar Burke
pachiburke at terra.es
Wed Jan 14 18:41:57 EST 2004
El mar, 13-01-2004 a las 19:48, Art Haas escribió:
> Hi.
> 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
> 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. One solution to this
> problem is to not delete the entity so the history of that object is
> still useable, but this could lead to significant increases of memory
> usage. If a better solution does not present itself than this may be the
> approach taken. Time will tell.
Perhaps if the objects deleted still exist in memory (possibly cached in
disk at least till a certain number or undo/redo steps is surpassed) but
are somehow marked not to be renderable or selectable.
Most CAD programs have a "purge" command just to remove those objects
that are no longer used, but are still in the drawing database.
In AutoCAD, for instance, when you delete a block (a group of objects or
a sort of named selection), it still remains in the drawing database,
and you can reinsert it using its name again, unless you purge the
drawing.
Maybe if erased elements reside in a different base tree (as if they
were proper drawings themselves) and have an "erasable" attribute that
convert them into 'cacheable' parts of the drawing, things can get
easier...
Art, thank you so much for your superb work.
--
Pachi
pachiburke en terra.es
More information about the PythonCAD
mailing list