I'm trying to add an Undo method to my program to correct errors made by the user in the construction of the 3D object, should I create a sort of log of the operations performed in order to possibly cancel them?
Currently it does not have a log of the operations performed
How best to make Undo?
Moderator: andrew
Forum rules
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
-
- Full Member
- Posts: 81
- Joined: Fri Apr 17, 2015 6:40 am
- Location: http://creativitainformaticart.altervista.org
How best to make Undo?
- Attachments
-
- Redo.svg
- (1.25 KiB) Downloaded 462 times
-
- Undo.svg
- (1.24 KiB) Downloaded 454 times
-
- OrthogonalProjections.js
- (107.15 KiB) Downloaded 451 times
-
- OrthogonalProjections.ui
- (16.8 KiB) Downloaded 462 times
Re: How best to make Undo?
If you are using operations (e.g. RAddObjectsOperation), undo / redo is automatically built in.
-
- Full Member
- Posts: 81
- Joined: Fri Apr 17, 2015 6:40 am
- Location: http://creativitainformaticart.altervista.org
Re: How best to make Undo?
Thank you
I had used 3 starting at line 1837
in in line 1800
to cancel the 3 graphic representations in orthogonal projections of a 3D vertex
you mean in this sense?
But I don't think that the operations can operate on the multidimensional array that I made in which I save the 3D data, or am I wrong? (for example see line 1816)
A ... another thing how can I get the name of the path and the dwg / dxf file the user is working on? I thought of making a nearby file with the same name in which to save the data of the 3D entities under construction
I had used 3
Code: Select all
op = new RModifyObjectsOperation ();
in
Code: Select all
OrthogonalProjections.prototype.slotUndo = function () {
to cancel the 3 graphic representations in orthogonal projections of a 3D vertex
you mean in this sense?
But I don't think that the operations can operate on the multidimensional array that I made in which I save the 3D data, or am I wrong? (for example see line 1816)
A ... another thing how can I get the name of the path and the dwg / dxf file the user is working on? I thought of making a nearby file with the same name in which to save the data of the 3D entities under construction
Re: How best to make Undo?
Operations keep track of the changes they make on a document. These changes can be undone / redone. If you change things other than the document, that is not covered.pietro_72_ wrote: ↑Tue Feb 11, 2020 12:06 amBut I don't think that the operations can operate on the multidimensional array that I made in which I save the 3D data, or am I wrong? (for example see line 1816)
doc.getFileName()A ... another thing how can I get the name of the path and the dwg / dxf file the user is working on? I thought of making a nearby file with the same name in which to save the data of the 3D entities under construction
-
- Full Member
- Posts: 81
- Joined: Fri Apr 17, 2015 6:40 am
- Location: http://creativitainformaticart.altervista.org
Re: How best to make Undo?
OK thanks