We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

Archicad Python API
About automating tasks in Archicad using the Python API.

GetLayerCombinationAttributes, how do I fetch the layer attributes specific of the combination?

_c_
Enthusiast

Hello,

 

GetLayerCombinationAttributes returns a list of Combinations each with

  • guid
  • name
  • list of layers' guid in the document

How can we fetch the status of the layers specific of each combination?

Running GetLayerAttributes on the list of layers just return the ACTIVE combination's layer status.

I am certainly missing something:

 

from archicad import ACConnection
conn = ACConnection.connect()
assert conn
acc = conn.commands

layCombList = acc.GetLayerCombinationAttributes(acc.GetAttributesByType("LayerCombination"))
# LayerCombinationAttributeWrapper {'layerCombinationAttribute': {
#   'attributeId': {'guid': '4B57CB36-174B-1D4A-B757-1E5C57754EB5'}, 
#   'name': '31 Beispiel GR Exposé', 
#   'layerAttributeIds': [{'attributeId': {'guid': '3980C7AB-067C-4A46-ABE5-F74AF487F348'}}, ... list of layer guids

for comb in layCombList:
    print(f"{comb.layerCombinationAttribute.attributeId.guid}\t{comb.layerCombinationAttribute.name}")
    
    layList = comb.layerCombinationAttribute.layerAttributeIds # list of layer IDs
    layAttrs = acc.GetLayerAttributes(layList)

print(layAttrs[0]) 

# below the attributes of ARCHICAD layer in the ACTIVE layer combination!!!
# how do I fetch the attributes according to the layer combination?

# LayerAttributeWrapper {'layerAttribute': {
#   'attributeId': {'guid': '3980C7AB-067C-4A46-ABE5-F74AF487F348'}, 
#   'name': 'Archicad-Ebene', 'intersectionGroupNr': 1, 
#   'isLocked': False, 
#   'isHidden': False, 
#   'isWireframe': False}}

 

_c_
4 REPLIES 4
poco2013
Mentor

You are not clear in what you are asking for? Or perhaps, it is just me.

 

Do you want the layer attributes for the layers within the active layer combination or the layer attributes for layers within a specific layer combination? Your script already shows that info.

 

The Python API does not know which layer combination is the active one -- AFAIK

Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27
_c_
Enthusiast

Hello Gerry, 

 

a layer combination stores different status sets for each layer guid.

ARCHICAD layer, for example, could be visible in one combination and invisible in another.

 

GetLayerCombinationAttributes just returns the list of names plus the list of layers in the document by guid (which is weird, since this repeats identical for each layer combination).

 

There is no way that I can see to fetch the particular status of each layer in a combination.

In the API there would be API_LayerStat: https://archicadapi.graphisoft.com/documentation/api_layerstat

 

I would have expected GetLayerCombinationAttributes to return:

  • name
  • intersectionGroupNr
  • isLocked
  • isHidden
  • isWireframe

Do you see a method to fetch these?

_c_

I am still puzzled because the last line in your code does exactly that.

As I Understand: All layers belong to all combinations. The combination layer then sets the attributes for the layers within it (all of them) using the 'update' command. The GetLayerCombinationAttributes() command returns all attributes for a Combination including the the layer guids. The layer status for each layer  can be retrieved using the guid for that layer. To retrieve a particular layer you would need to retrieve all of the layers and filter for the particular layer name you want.

The problem is that GetLayerAttributes() only returns the current set of attributes for the layer, as set, not what would be set if a particular combination is used. This become even more confusing if a custom set is used.

 

As mentioned, only the C++API can address this issue.

Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27
_c_
Enthusiast

Thank you, so again this can't be done.

To resume this puzzling issue: GetLayerCombinationAttributes just returns a list of combination names, no more.

 

As information it is really very limited.

I hoped to be able at least to store the status of each layer within each combination as text file or excel for easier comparison.

 

 

 

 

_c_

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!