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