Sunday, 29 April 2018

arcgis 10.0 - Creating shortcut (button) for "Make this the only selectable layer" in Python 2.6?


I'm trying to create a script in Python 2.6 to make a button or a keyboard shortcut for "Make This The Only Selectable Layer". I came across the following VBA scripts on the net, but the problem is it's not working in ArcGIS 10. Can anyone help me with a Python script to do that?


Public Sub MakeLayerSelectable_Click()

Dim pMxDocument As IMxDocument
Dim pMap As IMap
Dim pEnumLayer As IEnumLayer
Dim pLayer As ILayer

Dim pId As New UID
Dim pFLayer As IFeatureLayer

Set pMxDocument = Application.Document
Set pMap = pMxDocument.FocusMap
pId = "{6CA416B1-E160-11D2-9F4E-00C04F6BC78E}"
Set pEnumLayer = pMap.Layers(pId, True)
pEnumLayer.Reset
Set pLayer = pEnumLayer.Next
Do While Not pLayer Is Nothing

If TypeOf pLayer Is IFeatureLayer Then
Set pFLayer = pLayer
pFLayer.Selectable = False
End If
Set pLayer = pEnumLayer.Next
Loop

Set pLayer = pMxDocument.SelectedLayer

If TypeOf pLayer Is IFeatureLayer Then

Set pFLayer = pLayer
pFLayer.Selectable = True
End If

End Sub


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...