1

I cannot write a script using ArcPy (Click to toggle selectable).

To make a layer unavailable for sampling!

I just need to create a tool to automate several processes, one of them is the ability to automatically turn off the sample multiple layers on the map! To do this manually! It turns out I have a database with all the layers, I need to when starting a new mxd, clicking on a script or a tool to fully customize my card as I need))

enter image description here

This script does not work, maybe someone else will?

import arcpy names = "[R_01_001]" mxd = arcpy.mapping.MapDocument("current") df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] layers = arcpy.mapping.ListLayers(mxd) for layer in layers: if layer.name in names: unselectable_objs=True print unselectable_objs arcpy.RefreshTOC() arcpy.RefreshActiveView()

This script does not work

import bpyunselectable_objs = [] for obj in bpy.data.objects: if obj.hide_select == true: unselectable_objs.append(obj) obj.hide_select = falseprint(unselectable_objs)


1
  • You seem to be trying to morph your question into a new one. If you have another question then please ask it as a new one. If you do then please explain where you obtained the code that you preface with "This script does not work" because it seems to be trying to reference objects from somewhere other than ArcPy.
    – PolyGeo
    Commented Aug 4, 2015 at 5:52

1 Answer 1

1

To do what you describe will, I think, need you to code using ArcObjects instead of ArcPy (or arcpy.mapping) because you appear to be wanting to customize the ArcMap application.

From Who is arcpy.mapping for? Why was it built?:

Arcpy.mapping is not a replacement for ArcObjects but rather an alternative for the different scenarios it supports. ArcObjects is still necessary for finer-grain development and application customization, whereas arcpy.mapping is intended for automating the contents of existing map documents and layer files.

5
  • I just need to create a tool to automate several processes, one of them is the ability to automatically turn off the sample multiple layers on the map! To do this manually! It turns out I have a database with all the layers, I need to when starting a new mxd, clicking on a script or a tool to fully customize my card as I need)) Commented Aug 4, 2015 at 4:09
  • Comments are not designed for presenting code snippets. If you have a follow up question then the way to ask it is as a new question. That will give you access to the code formatting button {}.
    – PolyGeo
    Commented Aug 4, 2015 at 4:15
  • Selectable is not exposed to arcpy. I think it would be worthy of an improvement request as that's something that would be fairly commonly controlled. The interface you'll need is IFeatureLayer.Selectable help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/… which isn't too hard to control but there's a big learning curve just to get there. Commented Aug 4, 2015 at 5:52
  • 1
    @MichaelMiles-Stimson It would be nice to be able to control Selectability from ArcPy but I think it might take a lot for that to happen so late in the development cycle of ArcMap. If an ArcGIS Idea gets written up by anybody then I think they should target ArcGIS Pro instead.
    – PolyGeo
    Commented Aug 4, 2015 at 5:57
  • Agreed @PolyGeo, the ArcGis Pro product line is still fledgling and doesn't have mountains of existing scripts. However, historically, implementations of python have been more flexible... remember gp = arcgisscripting.create()? I don't think a fundamental change like gp => arcpy is going to happen again soon though. Commented Aug 4, 2015 at 22:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.