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.

Element GUID extract from python cannot find using Find and Select

Yh1CKAEN
Contributor

Hi all,

 

I tried to extract some element GUID via python using  acc.GetElementsByType("Zone"), however the GUID generated I can't find any using find&select function within Archicad. May I know if the GUID obtained from the python script is shown somewhere in element information? Thanks.

 

excel_export.JPG

find_and_select.JPG

  

3 REPLIES 3
_c_
Enthusiast

I don't know if it is related, I am new to Archicad, but I also am observing properties' guid that aren't otherwise clear to me, their guid is nowhere to find. 

 

I can fetch all properties:

 

allPropIDs = acc.GetAllPropertyIds() # 693 props
# [PropertyIdArrayItem {'propertyId': {'guid': '4A0D773E-33FB-4CF7-98FD-561044BCB21D'}}, ...

 

 
Then I can fetch one room:

 

rooms = acc.GetElementsByType("Zone")
oneRoom = rooms[0]

 

 
But if I fetch the room's properties, I get over 400 props, which doesn't make any sense to me, does it eventually include other parameters? GDL?

 

props = acc.GetAllPropertyIdsOfElements([oneRoom]) # returns a list with 1 PropertyIdsOfElementWrapper
# [PropertyIdsOfElementWrapper {
# 'propertyIdsOfElement':
# {'elementId': {'guid': '4BFA60B2-5F49-416E-81D3-B02FA9C0BE41'},
# 'propertyIds': [{'propertyId': {'guid': '635169F9-62C9-4DD9-A64A-6E99128F1298'}}, {'propertyId': {'guid': '40D0D48E-5D5F-4E88-B44C-5EE49B21 ...

ids = props[0].propertyIdsOfElement.propertyIds # 414 props? Ehh?
# [PropertyIdArrayItem {'propertyId': {'guid': '635169F9-62C9-4DD9-A64A-6E99128F1298'}}, PropertyIdArrayItem {'propertyId': {'guid': '40D0D48E-5D5F-4E88-B44C-5EE49B21E78F'}}, ...

 

 

... and then fetch their details, I get a huge number of errors with a few valid entries:

 

dets = acc.GetDetailsOfProperties(ids) # list of PropertyDefinitionWrapper
# [ErrorItem {'error': {'code': 6702, 'message': 'Property definition not supported (property definition guid: "635169F9-62C9-4DD9-A64A-6E99128F1298")'}}, ErrorItem
print(dets)

 

 

here the output with more readability, two items as example. And BTW, is there somewhere a list of the error codes?

 

ErrorItem {'error': {'code': 6702, 'message': 'Property definition not supported (property definition guid: "8E3AFC90-5D05-4F80-B47B-A0862386F2A3")'}}, 

...

PropertyDefinitionWrapper {'propertyDefinition': {'group': {'propertyGroupId': {'guid': '1B193DB4-31FE-4DCA-93FF-3125D79B19C0'}, 'name': 'Raum'}, 'name': 'Berechnete Fläche (NRF)', 'description': '', 'isEditable': False, 'type': 'area', 'propertyId': {'guid': '9F8B3DFA-39D7-472D-A258-B988427C7EF9'}}}, 

....

 

 

And now I come to the point. If I then search for one of the error guid in the list obtained with acc.GetAllPropertyIds, I can't find this guid. 

_c_
Yh1CKAEN
Contributor

After several days I found out the real reason is the python script may not work correctly if another user(s) is using Archicad in the same machine, maybe all users share the same memory area.

_c_
Enthusiast

In my case I am alone and using a demo version.

Still, I see tons of unclear property IDs that resolve to nothing (error).

_c_