Hey everyone!
I want to create a Python Add-In tool that will perform the following sequence of tasks:
1. Read a specific feature layer in Table of Content (let's call it X)
2. Check the version for the layer [Working on SDE only]
3. Read the selected features from the layer X
4. Copy the selected features from layer X to another layer Abandoned_X and delete them from X.
5. Search layers (say Y, Z, ...) related to layer X, copy the related features to layers Abandoned_Y, Abandoned_Z, ... and delete them from Y, Z, ...
Requirements:
I have written logic until step 5. Following are the questions:
Thank you for your time!
Solved! Go to Solution.
Hi Dan,
I was able to complete my requirement.
The below link helped me to solve my issue when I tried my add In creation freshly
Checking via ArcPy if ArcMap is in edit session? - Geographic Information Systems Stack Exchange
Thanks for your time
Jay
which proposed solution?
did it just not work? or did you get errors?
Hello Dan,
I am adding the code from the link:
Checking via ArcPy if ArcMap is in edit session? - Geographic Information Systems Stack Exchange
The part of the code I am trying to implement
class Active_Edit_Session(object):"""Implementation for NEZ_EDITS_addin.Listen_for_Edit_Session (Extension)"""def __init__(self): self.enabled = Truedef onStartEditing(self): button_3100.enabled=True def onStopEditing(self, save_changes): button_3100.enabled=Falseclass LFM_3100(object): """Implementation for LFM_3100.button_3100 (Button)""" def __init__(self): self.enabled = False self.checked = False def onClick(self): ......
This does not help me to gray out the python addin button with start of arcmap(it am not getting any error, It just simply do not work)
But I am able to gary out onces the editor is started and stoped.
Even I have tried
startup(self) function from below link
Extension class—Help | ArcGIS Desktop
where I kept
startup(self)
button. enable = False
does not work for me
Thanks for your time
Jay
you did edit the code you were trying to follow? button_3100.enabled=True obviously isn't in yours
yes edited as per my requirement
def onStartEditing(self):
button.enabled = True
def onStopEditing(self, save_changes):
button.enabled = False
I have just taken the concept.
The above logic works fine once the editor is started. The button does not gray out with the start of ArcMap.
Hi Dan,
I was able to complete my requirement.
The below link helped me to solve my issue when I tried my add In creation freshly
Checking via ArcPy if ArcMap is in edit session? - Geographic Information Systems Stack Exchange
Thanks for your time
Jay