Select to view content in your preferred language

IsSelectable property of subtype layers

146
4
2 weeks ago
JürgenBiendara
Regular Contributor

Hello,

I have already asked the same question in the ArcGIS Pro group but have not received any response yet. Since the problem is related to the Subtype Group Layers, which were developed specifically for the Utility Network, I hope someone here can help me.

I want to use Esri Tasks to create specific workflows in the Utility Network for a customer. In doing so, I set the visbility and selectability of the layers in individual task steps. At the end of the task, I want to reset the layer settings to the state they were in at the beginning of the task.

Not only is this very tedious given the large number of subtype layers, but I also don't know the initial state of my TOC in detail. So, I need two functions—one that notes the layer settings at the beginning of the task (e.g., in a CSV file) and one that restores these settings at the end of the task based on the CSV file.

I tried to solve this problem with arcpy but failed. Apparently, the subtype layers do not have an isSelectable property. So, this may only work via the SDK. But since I am not a developer, I am stuck.

The developers (?) of Utility Network have created the Utility Network Add-In with the “Layer Info” function. This function does exactly what I need: it writes the layer settings to a CSV file. However, I am not allowed to install the add-in in the customer environment.

I wonder if I am the only one experiencing this issue, and also if there might be a simpler solution than the SDK solution. Or perhaps someone else has already solved this problem? I would appreciate any assistance.

Best regards,
Jürgen

0 Kudos
4 Replies
RobertKrisher
Esri Regular Contributor

You can get/set the selectability of the layer using the CIM definition of the layer. This works with subtype layers, but not subtype group layers.

layer = activeMap.listLayers("System Valve")[0]
layer_def = layer.getDefinition("V3")
layer_def.selectable
True

0 Kudos
JürgenBiendara
Regular Contributor

Thanks for your feedback, Robert. However, I actually need a solution that also works with Subtype Group Layers.

0 Kudos
RobertKrisher
Esri Regular Contributor

@JürgenBiendara subtype group layers are not selectable for the same reason that group layers aren't selectable, they are just group layers. If you want to toggle the selectability of a subtype group layer you'll need to iterate through all of its child layer and toggle their selectability (which can be accomplished using ArcPy).

0 Kudos
JürgenBiendara
Regular Contributor

Hi Robert,

I couldn't get it to work with ArcPy, but I must admit that I'm not very familiar with ArcPy. In fact, I sought help from AI. However, after several attempts and a lengthy discussion, they said that it wouldn't work with ArcPy, only with the SDK.

I had hoped that someone else had already looked into this and found/had a solution ready. I'll have to see if I can get support from one of our developers.

Best regards, Jürgen

0 Kudos