2

There is a problem in my arcgis add-in when I try to create layer from selected features of 'fc' layer, add-in button creates layer from all features of 'fc' layer not only selected features. When i try to do this process in arcmap python window, it works for both Make Feature layer management and copy features management. But in add-in it doesn't work for both analyses.

Here is my code:

class ButtonClass17(object):
"""Implementation for PPPpoint_addin.button_2 (Button)"""
fc = r"C:\New_Geodatabase.gdb\test"
def __init__(self):
    self.enabled = True
    self.checked = False
def onClick(self):
    arcpy.MakeFeatureLayer_management(fc,'kapi3')
2

You should be creating a feature layer from a Layer in the Table Of Contents, not from a geodatabase feature class.

  1. Get access to the layer and then get the selected features.
  2. Use the objectids you get in the step 1 to form the where clause for the Make Feature Layer tool.

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.