New answers tagged

0

As pointed out by @Ali here, while self.Destory() does not work, the issue can be solved by making sure that a new instance of self.Dialog is created each time the tool is run. The following if/then statement causes the creation of the dialog to be bypassed if it already exists: if self.dlg is None: self.dlg = TestDialog() else: self.dlg.Show(...


0

I think you are correct regarding the script only changing the UI. This is because the dlg attribute of your ToolClass2 is always pointing to the same instance of the TestDialog UI class. When you first run the tool, the TestDialog instance is created and your Add-in works as intended. Next time, since self.dlg is not None, your else clause just shows the ...


1

As per my comment, why not just use a combobox for the layer list within the AddIn itself? Here is an example of how I have done this before in a Python AddIn: class LayerList(object): """Implementation for ClipAndShip_addin.combobox (ComboBox)""" def __init__(self): self.items = [] self.editable = True self.enabled = True ...


0

I figured it out. The first mistake I made was appending the newList to a self.items in the setVersion object. That just adds the entire list in as one item. Instead do this: self.items = button2.nameList The other mistake I made was trying to get items to update in the onSelChange function. The list needs to be updated in a different function. I don't ...


2

While not answering the specific question, I try to aim at the functionality the OP is seeking. I often use these different selection methods myself, and for convenience I have added a dropdown list to my toolbar (and rearranged some of the other buttons): If this is not enough for you, I'd suggest using the built-in system for creating keyboard ...


1

Yo can do selection by both attribute using arcpy.SelectLayerByAttribute_management and location using arcpy.SelectLayerByLocation_management, but you cannot do selection directly from feature, you should create a temporary layer using arcpy.MakeFeatureLayer_management before doing a selection. Here is snippet code from the above help: # Import system ...


2

arcpy.SelectLayerByAttribute_management and arcpy.SelectLAyerByLocation management both have the optional parameter Selection Type. The value must be one of the following strings: "NEW_SELECTION" "ADD_TO_SELECTION" "REMOVE_FROM_SELECTION" "SUBSET_SELECTION" "SWITCH_SELECTION" "CLEAR_SELECTION"


0

Setting the selection method is an option on the Select Layer By Attributes tool. However, I am not sure that a Python AddIn will offer the advantage you seek here.



Top 50 recent answers are included