<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Python Addins with comtypes/ArcObjects and Undo/Redo in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-addins-with-comtypes-arcobjects-and-undo/m-p/61552#M4907</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm interested in the rest of your code, having lately been trying to employ comtypes - I'm rusty with ArcObjects, specifically the editor objects and a little troubled with your statement "The addin edits are permanent even if I don�??t save my edits."&amp;nbsp; It appears the comtypes part is functional, but seems maybe without 1st explicitly targeting a version (as in your manual edits), maybe your code is somehow 'bypassing' the stack??&amp;nbsp; I'd need to see the rest of your code.&amp;nbsp; Undo should otherwise work if you can 'point' to a specific part of the stack (since you were able to do it with the undo button in part of your experimentation).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;....this is curious and could be relevant to you, over on Stack Exchange:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://gis.stackexchange.com/questions/3072/how-do-i-get-the-current-undo-and-redo-item-in-arcmap-operation-stack"&gt;http://gis.stackexchange.com/questions/3072/how-do-i-get-the-current-undo-and-redo-item-in-arcmap-operation-stack&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Wayne&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 13 Nov 2013 20:05:52 GMT</pubDate>
    <dc:creator>T__WayneWhitley</dc:creator>
    <dc:date>2013-11-13T20:05:52Z</dc:date>
    <item>
      <title>Python Addins with comtypes/ArcObjects and Undo/Redo</title>
      <link>https://community.esri.com/t5/python-questions/python-addins-with-comtypes-arcobjects-and-undo/m-p/61551#M4906</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I believe there is a simple solution to the following dilemma.&amp;nbsp; Any insights/solutions would be greatly appreciated!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have several Python AddIns that edit features in versioned SDE feature classes.&amp;nbsp; 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.&amp;nbsp;&amp;nbsp; 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).&amp;nbsp; What else do I need to do to make addin edits undoable?&amp;nbsp; Do I need to fetch the existing Operation Stack and work with that?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;edit = getIWorkspaceEditUsingComtypes()&amp;nbsp;&amp;nbsp; #(this function returns IWorkspaceEdit successfully)
edit.StartEditOperation&amp;nbsp; 
??? #(python code creating a feature using a Python Insert Cursor)
edit.StopEditOperation
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;SPAN&gt;Other observations:&amp;nbsp; The addin edits are permanent even if I don???t save my edits.&amp;nbsp; 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.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Nov 2013 18:23:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-addins-with-comtypes-arcobjects-and-undo/m-p/61551#M4906</guid>
      <dc:creator>KerryAlley</dc:creator>
      <dc:date>2013-11-13T18:23:46Z</dc:date>
    </item>
    <item>
      <title>Re: Python Addins with comtypes/ArcObjects and Undo/Redo</title>
      <link>https://community.esri.com/t5/python-questions/python-addins-with-comtypes-arcobjects-and-undo/m-p/61552#M4907</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm interested in the rest of your code, having lately been trying to employ comtypes - I'm rusty with ArcObjects, specifically the editor objects and a little troubled with your statement "The addin edits are permanent even if I don�??t save my edits."&amp;nbsp; It appears the comtypes part is functional, but seems maybe without 1st explicitly targeting a version (as in your manual edits), maybe your code is somehow 'bypassing' the stack??&amp;nbsp; I'd need to see the rest of your code.&amp;nbsp; Undo should otherwise work if you can 'point' to a specific part of the stack (since you were able to do it with the undo button in part of your experimentation).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;....this is curious and could be relevant to you, over on Stack Exchange:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://gis.stackexchange.com/questions/3072/how-do-i-get-the-current-undo-and-redo-item-in-arcmap-operation-stack"&gt;http://gis.stackexchange.com/questions/3072/how-do-i-get-the-current-undo-and-redo-item-in-arcmap-operation-stack&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Wayne&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Nov 2013 20:05:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-addins-with-comtypes-arcobjects-and-undo/m-p/61552#M4907</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2013-11-13T20:05:52Z</dc:date>
    </item>
    <item>
      <title>Re: Python Addins with comtypes/ArcObjects and Undo/Redo</title>
      <link>https://community.esri.com/t5/python-questions/python-addins-with-comtypes-arcobjects-and-undo/m-p/61553#M4908</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That was a helpful link Wayne, especially if I end up having to write code to put edit operations on the operation stack!&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I assume that my issue reflects my shallow understanding of ArcObjects, but I guess there might actually be an unexpected consequence of using the Python addin framework.&amp;nbsp; If I remove all references to the Editor from the addin, it returns errors when run outside of an editing session (expected when editing SDE data).&amp;nbsp; However, if run from within an ongoing edit session, it runs as expected except that the features are not undoable and are permanent (ending without saving is futile).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I forgot to mention that this particular addin has two buttons, one to select a feature, the other to create features.&amp;nbsp; The undo button will actually select, in reverse order, the features that had been selected using that addin button (and usually an adjacent feature as well for good measure, for who knows what reason). The redo button reverses the sequence of selected features, but without including any adjacent features.&amp;nbsp;&amp;nbsp;&amp;nbsp; Another stack puzzle. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp; And further evidence that Python addins have a weird way of interacting with operation stacks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've pasted my addin script below.&amp;nbsp; I've also pasted the function "Snippets.ArcMap_GetIworkspaceEdit()" that I call from the addin.&amp;nbsp; That function is a very slightly modified version of the Mark Cederholm's function "Snippets.ArcMap_GetEditWorkspace()" from his Snippets.py script available from &lt;/SPAN&gt;&lt;A href="http://www.pierssen.com/arcgis/misc.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;this page&lt;/A&gt;&lt;SPAN&gt;.&amp;nbsp; My function calls other functions from Mark's Snippets.py as well.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Addin Script:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;#ShieldToolComtypes_addin.py
#KAlley 2013_11_11
#VT Agency of Transportation
#
#Based on ShieldTool_addin.py (KAlley 2013-03-12)
#In this script, lines of code relevent to using arcpy.da.Editor are commented out

import arcpy, time, os, sys, math
sys.path.append("V:\Projects\Shared\kalley\PythonScripts")
import comtypes, Snippets
import pythonaddins

class SelectRoadArcClass(object):
&amp;nbsp;&amp;nbsp;&amp;nbsp; """Implementation for TwoInputsAddin_addin_B.tool (Tool)"""
&amp;nbsp;&amp;nbsp;&amp;nbsp; def __init__(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.enabled = True
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.shape = "NONE" # Can set to "Line", "Circle" or "Rectangle" for interactive shape drawing and to activate the onLine/Polygon/Circle event sinks.

&amp;nbsp;&amp;nbsp;&amp;nbsp; def onMouseDownMap(self, x, y, button, shift):
 #start_time = time.time() #only used to compare run-times of different versions of the script
 arcpy.env.overwriteOutput = True
 
 path = r'V:\Projects\Shared\kalley\ToolDevelopment\ShieldToolComtypes\Install'
 print "Comtypes Version of the Shield Tool AddIn"

 #rdsmall_dataSource = r"GDB_HMS.HMSADMIN.rdsmall_arc"
 rdsmall_dataSource = r"GDB_HMSDev.HMSADMIN.rdsmall_arc_kalley"

 mxd = arcpy.mapping.MapDocument('current')
 for lyr in arcpy.mapping.ListLayers(mxd):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.supports("dataSource"):
&amp;nbsp; if str(lyr.dataSource).endswith(rdsmall_dataSource):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rdsmall_lyr = lyr

 point = arcpy.Point()
 point.X = x
 point.Y = y
 pointGeometry = arcpy.PointGeometry(point)
 arcpy.SelectLayerByLocation_management(rdsmall_lyr, "WITHIN_A_DISTANCE", pointGeometry, "40 Meters", "NEW_SELECTION")
 #print time.time() - start_time, "seconds"


class CreateShieldClass(object):
&amp;nbsp;&amp;nbsp;&amp;nbsp; """Implementation for TwoInputsAddin_addin_A.tool (Tool)"""
&amp;nbsp;&amp;nbsp;&amp;nbsp; def __init__(self):
 self.enabled = True
 self.cursor = 3
 self.shape = "LINE" # Can set to "Line", "Circle" or "Rectangle" for interactive shape drawing and to activate the onLine/Polygon/Circle event sinks.
&amp;nbsp;&amp;nbsp;&amp;nbsp; def onLine(self, line_geometry):
 start_time = time.time() #only used to compare rough run-times of different versions of the script
 arcpy.env.overwriteOutput = True
 
 #Hard-wiring the exact feature classes that will be edited with shield tool:
 ##VTrans Data:
 ##shield_points_dataSource = r"GDB_HMS.HMSADMIN.hms_shields_points"
 ##shield_arcs_dataSource = r"GDB_HMS.HMSADMIN.hms_shields_arcs"
 ##rdsmall_dataSource = r"GDB_HMS.HMSADMIN.rdsmall_arc"
 #Development Sandbox copy of VTrans data:
 shield_points_dataSource = r"GDB_HMSDev.HMSADMIN.hms_shields_points_kalley"
 shield_arcs_dataSource = r"GDB_HMSDev.HMSADMIN.hms_shields_arcs_kalley"
 rdsmall_dataSource = r"GDB_HMSDev.HMSADMIN.rdsmall_arc_kalley"

 #mxd = arcpy.mapping.MapDocument(r"K:\ToolDevelopment\ToolDevelopmentSDE.mxd") #for testing script independently of add-in
 mxd = arcpy.mapping.MapDocument('current')

 #for new shields to appear in current mxd, this script must refer to layers in the current mxd
 lyrs = arcpy.mapping.ListLayers(mxd)
 for lyr in arcpy.mapping.ListLayers(mxd):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.supports("dataSource"):
&amp;nbsp; if str(lyr.dataSource).endswith(shield_points_dataSource):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; shield_points_lyr = lyr
&amp;nbsp; if str(lyr.dataSource).endswith(shield_arcs_dataSource):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; shield_arcs_lyr = lyr
&amp;nbsp; if str(lyr.dataSource).endswith(rdsmall_dataSource):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rdsmall_lyr = lyr
 if not (shield_points_lyr and shield_arcs_lyr and rdsmall_lyr):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Shield Not Created..."
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Must have at least 3 layers in this mxd: shield points, shield arcs, and rdsmall"

 #only allow shield creation if a single road arc is selected
 num_road_arcs = int(arcpy.GetCount_management(rdsmall_lyr).getOutput(0))
 if num_road_arcs == 1:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ##Code used if using arcpy.da.Editor
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ##workspace = rdsmall_lyr.workspacePath&amp;nbsp; #for&amp;nbsp; .gdb *and* SDE connection (refers to .sde file in DatabaseConnections)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ##arcpy.env.workspace = workspace
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ##edit_py = arcpy.da.Editor(workspace)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ##edit_py.startEditing() #with undo, multiuser mode
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Code used if accessing preexisting editing session with comtypes/ArcObjects
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; edit = Snippets.ArcMap_GetIWorkspaceEdit(bStandalone=False) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if edit is None:
&amp;nbsp; print "Must be in an editing session to use this tool"
&amp;nbsp; return
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #identify maximum SHI_GRP_ID value currently used in shields
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; max_id = sorted(arcpy.da.SearchCursor(shield_points_lyr.dataSource, "SHI_GRP_ID"), reverse = 1)[0][0]

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #collect selected road arc attributes
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rdsmall_values = sorted(arcpy.da.SearchCursor(rdsmall_lyr, ["UA", "FAID_S", "CTCODE", "RTNUMBER", "AOTCLASS"]))

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #initialize the new line as the input line_geometry (will change if fix_length == True)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new_line = line_geometry
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #create shield point and populate attributes
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new_points_Cur = arcpy.da.InsertCursor(shield_points_lyr, ["SHAPE@XY", "UA", "FAID_S", "CTCODE", "RTNO", "AOTCLASS", "SHI_GRP_ID", "ISVISIBLE", "SUBINSET"])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; test = (new_line.firstPoint,) + tuple(rdsmall_values) + (max_id + 1,)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; test_tuple = ((test[0].X, test[0].Y), test[1][0], test[1][1], str(test[1][2]), str(test[1][3]), test[1][4], test[2], 1, "N")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ##edit_py.startOperation()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; edit.StartEditOperation
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new_points_Cur.insertRow(test_tuple)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ##edit_py.startOperation()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; edit.StopEditOperation
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del new_points_Cur

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #create shield arc and populate SHI_GRP_ID
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new_arc_Cur = arcpy.da.InsertCursor(shield_arcs_lyr.dataSource, ["SHAPE@", "SHI_GRP_ID"])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ##edit_py.startOperation()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; edit.StartEditOperation
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new_arc_Cur.insertRow([new_line, max_id + 1])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ##edit_py.stopOperation()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; edit.StopEditOperation
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del new_arc_Cur

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ##edit_py.stopEditing(True) #save changes
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByAttribute_management(rdsmall_lyr, "CLEAR_SELECTION")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshActiveView()
 else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Shield Not Created..."
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Must select a single arc from rdsmall"
 #print time.time() - start_time, "seconds"
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;function Snippets.ArcMap_GetIWorkspaceEdit:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;def ArcMap_GetIWorkspaceEdit(bStandalone=False):

&amp;nbsp;&amp;nbsp;&amp;nbsp; GetDesktopModules()
&amp;nbsp;&amp;nbsp;&amp;nbsp; if bStandalone:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; InitStandalone()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pApp = GetApp()
&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pApp = GetCurrentApp()
&amp;nbsp;&amp;nbsp;&amp;nbsp; GetModule("esriEditor.olb")
&amp;nbsp;&amp;nbsp;&amp;nbsp; import comtypes.gen.esriSystem as esriSystem
&amp;nbsp;&amp;nbsp;&amp;nbsp; import comtypes.gen.esriEditor as esriEditor
&amp;nbsp;&amp;nbsp;&amp;nbsp; import comtypes.gen.esriGeoDatabase as esriGeoDatabase
&amp;nbsp;&amp;nbsp;&amp;nbsp; pID = NewObj(esriSystem.UID, esriSystem.IUID)
&amp;nbsp;&amp;nbsp;&amp;nbsp; pID.Value = CLSID(esriEditor.Editor)
&amp;nbsp;&amp;nbsp;&amp;nbsp; pExt = pApp.FindExtensionByCLSID(pID)
&amp;nbsp;&amp;nbsp;&amp;nbsp; pEditor = CType(pExt, esriEditor.IEditor)
&amp;nbsp;&amp;nbsp;&amp;nbsp; if pEditor.EditState == esriEditor.esriStateEditing:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pWS = pEditor.EditWorkspace
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pWSE = CType(pWS, esriGeoDatabase.IWorkspaceEdit)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pDS = CType(pWS, esriGeoDatabase.IDataset)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Workspace name: " + pDS.BrowseName
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Workspace category: " + pDS.Category
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return pWSE
&amp;nbsp;&amp;nbsp;&amp;nbsp; return
 &lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:20:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-addins-with-comtypes-arcobjects-and-undo/m-p/61553#M4908</guid>
      <dc:creator>KerryAlley</dc:creator>
      <dc:date>2021-12-10T22:20:07Z</dc:date>
    </item>
    <item>
      <title>Re: Python Addins with comtypes/ArcObjects and Undo/Redo</title>
      <link>https://community.esri.com/t5/python-questions/python-addins-with-comtypes-arcobjects-and-undo/m-p/61554#M4909</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I've been stubbornly chipping away at this issue so I have more information, and a more specific question:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regardless of whether I attempt to start edit operations via IEditor or IWorkspaceEdit2, the attempts are not successful (because IWorkspaceEdit2.InEditOperation returns "False").&amp;nbsp; I would really like to know why "IEditor.StartOperation" doesn't seem to work, and what I need to do differently.&amp;nbsp; Any suggestions?&amp;nbsp; I'm pretty sure I correctly referenced IEditor, because IEditor.EditState is "esriStateEditing", and I get the correct value from IEditor.EditWorkspace.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Since I'm creating an "editing customization" for ArcMap, it seems that I should be using IEditor rather than IWorkspaceEdit2 (according to this &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/index.html#/Managing_edit_sessions_and_edit_operations/000100000340000000/"&gt;help page&lt;/A&gt;&lt;SPAN&gt; and this &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/index.html#/ArcGIS_for_Desktop_editing_for_developers/0001000000pt000000/"&gt;help page&lt;/A&gt;&lt;SPAN&gt;).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Because I'm editing SDE feature classes (initiated from the Editor toolbar menu in ArcMap), successful edit operations should automatically be placed on the operation stack, and workspace and versions don't have to be specified in code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Working with ArcObjects sure is humbling!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kerry&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Nov 2013 19:19:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-addins-with-comtypes-arcobjects-and-undo/m-p/61554#M4909</guid>
      <dc:creator>KerryAlley</dc:creator>
      <dc:date>2013-11-15T19:19:30Z</dc:date>
    </item>
    <item>
      <title>Re: Python Addins with comtypes/ArcObjects and Undo/Redo</title>
      <link>https://community.esri.com/t5/python-questions/python-addins-with-comtypes-arcobjects-and-undo/m-p/61555#M4910</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Have you ever resolved this?&amp;nbsp; We too are building a Python add-in for a custom edit experience within ArcMap.&amp;nbsp; We want to leverage as much OOTB functionality in ArcMap as possible, including the edit session and undo/redo capabilities.&amp;nbsp; Any more info since this post?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Feb 2014 13:43:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-addins-with-comtypes-arcobjects-and-undo/m-p/61555#M4910</guid>
      <dc:creator>DavidHollema</dc:creator>
      <dc:date>2014-02-27T13:43:19Z</dc:date>
    </item>
    <item>
      <title>Re: Python Addins with comtypes/ArcObjects and Undo/Redo</title>
      <link>https://community.esri.com/t5/python-questions/python-addins-with-comtypes-arcobjects-and-undo/m-p/61556#M4911</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Alas, I gave up and rewrote the addins in VB.NET.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Although the VB.NET addins run significantly faster than the Python addins, I am still eager to find a Python solution to the problem.&amp;nbsp; I'll be at the Esri Developer's Summit in a couple weeks, and will seek out the Comtypes and ArcObjects gurus to pick their brains for a solution.&amp;nbsp; I'll also be checking to see if/when the ongoing editing capability will be added to the Python Addin framework.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kerry&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Feb 2014 17:11:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-addins-with-comtypes-arcobjects-and-undo/m-p/61556#M4911</guid>
      <dc:creator>KerryAlley</dc:creator>
      <dc:date>2014-02-27T17:11:22Z</dc:date>
    </item>
  </channel>
</rss>

