<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Unused layer combinations in Archicad Python API</title>
    <link>https://community.graphisoft.com/t5/Archicad-Python-API/Unused-layer-combinations/m-p/661077#M1081</link>
    <description>&lt;P&gt;Hello Piotr,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The &lt;A href="https://github.com/ENZYME-APD/tapir-archicad-automation/releases/tag/1.1.4" target="_blank" rel="noopener"&gt;1.1.4. relese&lt;/A&gt; of the &lt;A href="https://github.com/ENZYME-APD/tapir-archicad-automation" target="_self"&gt;Tapir archicad addon&lt;/A&gt; has just intruduced the&amp;nbsp;&lt;SPAN&gt;GetViewSettings command that returns the name of the associated layer combination for each NavigatorItemId. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;There seams to be something off with the&lt;A href="https://enzyme-apd.github.io/tapir-archicad-automation/archicad-addon/" target="_self"&gt; documentation&lt;/A&gt; for this command, so I'll paste the schema from the source here:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;   {
                "name": "GetViewSettings",
                "version": "1.1.4",
                "description": "Gets the view settings of navigator items",
                "inputScheme": {
        "type": "object",
        "properties": {
            "navigatorItemIds": {
                "$ref": "#/NavigatorItemIds"
            }
        },
        "additionalProperties": false,
        "required": [
            "navigatorItemIds"
        ]
    },
                "outputScheme": {
    "type": "object",
    "properties": {
        "viewSettings": {
            "type": "array",
            "item": {
                "type": "object",
                "description": "The settings of a navigator view or an error.",
                "oneOf": [
                    {
                        "$ref": "#/ViewSettings"
                    },
                    {
                        "$ref": "#/ErrorItem"
                    }
                ]
            }
        }
    },
    "additionalProperties": false,
    "required": [
        "viewSettings"
    ]
}
            }
 "ViewSettings": {
        "type": "object",
        "description": "The settings of a navigator view",
        "properties": {
            "modelViewOptions": {
                "type": "string",
                "description": "The name of the model view options. If empty, the view has custom model view options."
            },
            "layerCombination": {
                "type": "string",
                "description": "The name of the layer combination. If empty, the view has custom layer combination."
            }
        },
        "additionalProperties": false,
        "required": []
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I think the official JSON commands should cover the rest (API.GetNavigatorItemTree can get you the NavigatorId-s of all views)&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 29 Apr 2025 19:29:11 GMT</pubDate>
    <dc:creator>SzamosiMate</dc:creator>
    <dc:date>2025-04-29T19:29:11Z</dc:date>
    <item>
      <title>Unused layer combinations</title>
      <link>https://community.graphisoft.com/t5/Archicad-Python-API/Unused-layer-combinations/m-p/660821#M1080</link>
      <description>&lt;P&gt;Hi All&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to find unused layer combinations?&amp;nbsp;&lt;BR /&gt;How can I check which layer combo is used for View Map item?&lt;BR /&gt;I don't see any command I could use.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Mon, 28 Apr 2025 08:51:34 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-Python-API/Unused-layer-combinations/m-p/660821#M1080</guid>
      <dc:creator>Piotr Walerysiak</dc:creator>
      <dc:date>2025-04-28T08:51:34Z</dc:date>
    </item>
    <item>
      <title>Re: Unused layer combinations</title>
      <link>https://community.graphisoft.com/t5/Archicad-Python-API/Unused-layer-combinations/m-p/661077#M1081</link>
      <description>&lt;P&gt;Hello Piotr,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The &lt;A href="https://github.com/ENZYME-APD/tapir-archicad-automation/releases/tag/1.1.4" target="_blank" rel="noopener"&gt;1.1.4. relese&lt;/A&gt; of the &lt;A href="https://github.com/ENZYME-APD/tapir-archicad-automation" target="_self"&gt;Tapir archicad addon&lt;/A&gt; has just intruduced the&amp;nbsp;&lt;SPAN&gt;GetViewSettings command that returns the name of the associated layer combination for each NavigatorItemId. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;There seams to be something off with the&lt;A href="https://enzyme-apd.github.io/tapir-archicad-automation/archicad-addon/" target="_self"&gt; documentation&lt;/A&gt; for this command, so I'll paste the schema from the source here:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;   {
                "name": "GetViewSettings",
                "version": "1.1.4",
                "description": "Gets the view settings of navigator items",
                "inputScheme": {
        "type": "object",
        "properties": {
            "navigatorItemIds": {
                "$ref": "#/NavigatorItemIds"
            }
        },
        "additionalProperties": false,
        "required": [
            "navigatorItemIds"
        ]
    },
                "outputScheme": {
    "type": "object",
    "properties": {
        "viewSettings": {
            "type": "array",
            "item": {
                "type": "object",
                "description": "The settings of a navigator view or an error.",
                "oneOf": [
                    {
                        "$ref": "#/ViewSettings"
                    },
                    {
                        "$ref": "#/ErrorItem"
                    }
                ]
            }
        }
    },
    "additionalProperties": false,
    "required": [
        "viewSettings"
    ]
}
            }
 "ViewSettings": {
        "type": "object",
        "description": "The settings of a navigator view",
        "properties": {
            "modelViewOptions": {
                "type": "string",
                "description": "The name of the model view options. If empty, the view has custom model view options."
            },
            "layerCombination": {
                "type": "string",
                "description": "The name of the layer combination. If empty, the view has custom layer combination."
            }
        },
        "additionalProperties": false,
        "required": []
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I think the official JSON commands should cover the rest (API.GetNavigatorItemTree can get you the NavigatorId-s of all views)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Apr 2025 19:29:11 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-Python-API/Unused-layer-combinations/m-p/661077#M1081</guid>
      <dc:creator>SzamosiMate</dc:creator>
      <dc:date>2025-04-29T19:29:11Z</dc:date>
    </item>
    <item>
      <title>Re: Unused layer combinations</title>
      <link>https://community.graphisoft.com/t5/Archicad-Python-API/Unused-layer-combinations/m-p/661083#M1082</link>
      <description>&lt;P data-unlink="true"&gt;Thank you&amp;nbsp;&lt;SPAN class=""&gt;SzamosiMate, that looks promising. I'll check it next week.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Apr 2025 21:24:09 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-Python-API/Unused-layer-combinations/m-p/661083#M1082</guid>
      <dc:creator>Piotr Walerysiak</dc:creator>
      <dc:date>2025-04-29T21:24:09Z</dc:date>
    </item>
    <item>
      <title>Re: Unused layer combinations</title>
      <link>https://community.graphisoft.com/t5/Archicad-Python-API/Unused-layer-combinations/m-p/662739#M1084</link>
      <description>&lt;P&gt;Thank you again — &lt;SPAN&gt;GetViewSettings command&lt;/SPAN&gt; worked well. Also, thanks to every Tapir contributor.&lt;/P&gt;&lt;P&gt;Do you think it's possible to check whether a layer is visible in the view when using a custom layer combo?&lt;/P&gt;</description>
      <pubDate>Fri, 16 May 2025 16:11:30 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-Python-API/Unused-layer-combinations/m-p/662739#M1084</guid>
      <dc:creator>Piotr Walerysiak</dc:creator>
      <dc:date>2025-05-16T16:11:30Z</dc:date>
    </item>
    <item>
      <title>Re: Unused layer combinations</title>
      <link>https://community.graphisoft.com/t5/Archicad-Python-API/Unused-layer-combinations/m-p/662763#M1085</link>
      <description>&lt;P&gt;&lt;a href="https://community.graphisoft.com/t5/user/viewprofilepage/user-id/31170"&gt;@Piotr Walerysiak&lt;/a&gt;&amp;nbsp;Have this worked for you?&lt;/P&gt;</description>
      <pubDate>Sat, 17 May 2025 05:51:43 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-Python-API/Unused-layer-combinations/m-p/662763#M1085</guid>
      <dc:creator>Botonis</dc:creator>
      <dc:date>2025-05-17T05:51:43Z</dc:date>
    </item>
    <item>
      <title>Re: Unused layer combinations</title>
      <link>https://community.graphisoft.com/t5/Archicad-Python-API/Unused-layer-combinations/m-p/662769#M1086</link>
      <description>&lt;P&gt;Currently&amp;nbsp;&lt;SPAN&gt;GetViewSettings does not return this information, but it is avalible from the C++ API, so it should not be too difficult to change the command to include this informaton.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If you'd like to use it in a workflow, please ask for it on the Tapir Discord, or open an Issue on Github. (&lt;A href="https://github.com/ENZYME-APD/tapir-archicad-automation" target="_blank"&gt;https://github.com/ENZYME-APD/tapir-archicad-automation&lt;/A&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thinking about it, w&lt;/SPAN&gt;&lt;SPAN&gt;ith this, and a possible future CreateLayerCombinations Command you could scan all views, and for all "custom" views find the corresponding layer combination and set it for the view, or if none exist create one in a separate folder that the user can check and decide what to do with it. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;That seams like a wortwhile thing&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 17 May 2025 11:29:56 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-Python-API/Unused-layer-combinations/m-p/662769#M1086</guid>
      <dc:creator>SzamosiMate</dc:creator>
      <dc:date>2025-05-17T11:29:56Z</dc:date>
    </item>
    <item>
      <title>Re: Unused layer combinations</title>
      <link>https://community.graphisoft.com/t5/Archicad-Python-API/Unused-layer-combinations/m-p/662820#M1090</link>
      <description>&lt;P&gt;Yes, that worked. Here's my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from archicad import ACConnection

conn = ACConnection.connect()
assert conn

acc = conn.commands
act = conn.types
acu = conn.utilities

response = acc.ExecuteAddOnCommand (act.AddOnCommandId ('TapirCommand', 'GetAddOnVersion'))
print (f'Tapir {response}')


########## GetLayerCombinationList ##########

layerComboAttr = acc.GetLayerCombinationAttributes(acc.GetAttributesByType("LayerCombination"))

layerComboNameList = [layercombolists.layerCombinationAttribute.name for layercombolists in layerComboAttr]



######## Get ViewMapTree and ViewGuids ########

def isViewNavigatorItem(item : act.NavigatorItem):
    return item.type != None and item.type != 'FolderItem'

viewMapTree = acc.GetNavigatorItemTree(act.NavigatorTreeId('ViewMap'))
viewmap = acu.FindInNavigatorItemTree(viewMapTree.rootItem, isViewNavigatorItem)

viewGuids = [{'navigatorItemId': viewmaps.navigatorItemId.to_dict()} for viewmaps in viewmap]


######### ViewLayerCombinationList #########

### Get View Settings (Tapir command)
viewSettings = acc.ExecuteAddOnCommand(
   act.AddOnCommandId('TapirCommand', 'GetViewSettings'),
        {"navigatorItemIds": viewGuids }
    )
viewSettings = viewSettings.get('viewSettings')

allViewSettingsLayerComboNameList = []
for viewSetting in viewSettings:
    if viewSetting.get('layerCombination') != None:
        allViewSettingsLayerComboNameList.append(viewSetting.get('layerCombination'))


### Filter ViewLayerCombinationNames
usedLayerComboList = []
for usedLayerCombo in allViewSettingsLayerComboNameList:
    if not usedLayerCombo in usedLayerComboList:
        usedLayerComboList.append(usedLayerCombo)


######### UnusedLayerCombinationList #########

unusedLayerComboList = []
for layerCombo in layerComboNameList:
    if not layerCombo in usedLayerComboList:
        unusedLayerComboList.append(layerCombo)
unusedLayerComboList.sort()


unusedLayerComboListStr = ""
for unusedLayerCombo in unusedLayerComboList:
    unusedLayerComboListStr += f'{unusedLayerCombo}\n'

print(f'\nUnused Layer Combinations:\n{unusedLayerComboListStr}')&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 19 May 2025 08:24:46 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-Python-API/Unused-layer-combinations/m-p/662820#M1090</guid>
      <dc:creator>Piotr Walerysiak</dc:creator>
      <dc:date>2025-05-19T08:24:46Z</dc:date>
    </item>
  </channel>
</rss>

