0

Using ArcPy Add-ins, I can issue a message, but I don’t understand how to cancel or undo deleting an object. Is it possible?

class ControlUniq(object):
    """Implementation for addin1_addin.ControlUniq (Extension)"""
    def __init__(self):
        # For performance considerations, please remove all unused methods in this class.
        self.enabled = True
    def onDeleteFeature(self):
        chek=pythonaddins.MessageBox(u"Delete object?",u"Deleting...",1)
        print chek
        if chek=="OK":
            pythonaddins.MessageBox(u"The object was deleted",u"Deleting...")
        else:
            ### I don't understand how to undo operation Deleting
            ### Undo()
            pass
0

Lora, your best bet will be using the arcpy data access Editor.

http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-data-access/editor.htm

With the Editor you can start, stop, undo and redo operations.

In short it operates very similar to the editing functionality found in the standard Editor toolbar in Arcmap.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.