I believe there is a simple solution to the following dilemma. Any insights/solutions would be greatly appreciated!
I have several Python AddIns that edit features in versioned SDE feature classes. I want to be able to run these AddIns from ArcMap within an ongoing editing session, and to have the ability to undo/redo these edits using ArcMap’s Undo/Redo buttons. My hope was to leverage comtypes in an AddIn to gain access to the ongoing ArcMap editing session (this works as expected), and that the AddIn edits would appear on the undo stack as long as I explicitly coded for start and stop edit operations (undo isn't working). What else do I need to do to make addin edits undoable? Do I need to fetch the existing Operation Stack and work with that?
This is a rough outline of the editing steps in the Addin, but I can provide the actual code and more detailed explanation if necessary:
Other observations: The addin edits are permanent even if I don’t save my edits. However, I did notice that if I make an edit manually and then run the AddIn, hitting the Undo button undoes the manual edit and the addin edit disappears as well.
I have several Python AddIns that edit features in versioned SDE feature classes. I want to be able to run these AddIns from ArcMap within an ongoing editing session, and to have the ability to undo/redo these edits using ArcMap’s Undo/Redo buttons. My hope was to leverage comtypes in an AddIn to gain access to the ongoing ArcMap editing session (this works as expected), and that the AddIn edits would appear on the undo stack as long as I explicitly coded for start and stop edit operations (undo isn't working). What else do I need to do to make addin edits undoable? Do I need to fetch the existing Operation Stack and work with that?
This is a rough outline of the editing steps in the Addin, but I can provide the actual code and more detailed explanation if necessary:
Code:
edit = getIWorkspaceEditUsingComtypes() #(this function returns IWorkspaceEdit successfully)
edit.StartEditOperation
… #(python code creating a feature using a Python Insert Cursor)
edit.StopEditOperation