Developer forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Python - List of names of the built-in properties

dushyant
Booster
Hello
Does any know how to fetch the list of all the available built-in properties like "General_ElementID" for 'Element ID' available in the Python API?

Thanks.
1 ACCEPTED SOLUTION

Solution
poco2013
Advisor
The Property name for ElenentID is: IdAndCategoies_ElementID Built-ins use a single name with the group first , then underline then name . User properties separate the group and property name which is why they require separate functions to recall.

You can get a list of all properties by using the function GetAllPropertyNames()
Gerry

Windows 10 - Visual Studio 2019; ArchiCAD 25

View solution in original post

11 REPLIES 11

Solution
poco2013
Advisor
The Property name for ElenentID is: IdAndCategoies_ElementID Built-ins use a single name with the group first , then underline then name . User properties separate the group and property name which is why they require separate functions to recall.

You can get a list of all properties by using the function GetAllPropertyNames()
Gerry

Windows 10 - Visual Studio 2019; ArchiCAD 25

dushyant
Booster
Thanks. GetAllPropertyNames() lists all the 'BuiltIn' and even 'UserDefined' properties.

What did you mean by "User properties separate the group and property name which is why they require separate functions to recall." ?

poco2013
Advisor
There are separate functions to get the Property ID for the built-in properties vs custom user properties.
acu,GetUserDefinedPropertyId which takes a group name and property name

acu.GetBuiltinPropertId which takes only the property name.

OR

You could create separate property classes (PropertUserId) one for builtin and one for property custom. The difference types require different inputs. Then use the common function acc.GetPropertyId(PropertyUserId) for both.
Gerry

Windows 10 - Visual Studio 2019; ArchiCAD 25

dushyant
Booster
Got it, thanks!

Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Hi Guys,

There are two different types of Properties in ARCHICAD: User-Defined and Built-In.

User-Defined Properties
The User-Defined Properties are the ones you see in the Property Manager Dialog. Users can modify the name of these Properties so you can access them by the name you see on the user interface. We call this localized name. The localized name contains two strings the Group Name and the Property Name (as seen in Property Manager Dialog) and it's unique. Note, there can be two User-Defined Properties in two separate Groups with the same Property Name.

Please note, these User-Defined Properties are belong to the current project and may be not available in other projects. So if you refer to any User-Defined Property in your Python script, then it may not work with some projects.

Built-In Properties
The Built-In Properties are the ones defined by ARCHICAD. The user can't modify the name of these Properties so you can access them by their internal name. We call this non-localized name. If you use properties with non-localized names your script will be independent of the language of the ARCHICAD user interface.

Note, the non-localized names of Built-In Properties won't be changed between ARCHICAD updates and versions. So if you refer to any Built-In Properties in your Python script, then your script should work with any projects and any ARCHICAD versions.

You can find all the available Built-In Properties and currently available User-Defined Properties with the GetAllPropertyNames command.

As Python API is based on the JSON API, I recommend you to read the documentation of the JSON API:
http://archicadapi.graphisoft.com/JSONInterfaceDocumentation/#Property_Information

dushyant
Booster
Ok, thanks for the info!

Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Python script examples for listing property values:
  • By using GetBuiltInPropertyId and GetUserDefinedPropertyId utility functions to retrieve the identifiers of the properties:
    from archicad import ACConnection
    
    conn = ACConnection.connect()
    acc = conn.commands
    act = conn.types
    acu = conn.utilities
    
    zoneNumberPropertyId = acu.GetBuiltInPropertyId('Zone_ZoneNumber')
    elementIdPropertyId = acu.GetBuiltInPropertyId('General_ElementID')
    zonesTemperatureReqPropertyId = acu.GetUserDefinedPropertyId('ZONES', 'Temperature Requirement')
    propertyIds = [
    	zoneNumberPropertyId,
    	elementIdPropertyId,
    	zonesTemperatureReqPropertyId
    ]
    
    propertyValuesDictionary = acu.GetPropertyValuesDictionary(acc.GetAllElements(), propertyIds)
    for elementId, valuesDictionary in propertyValuesDictionary.items():
    	for propertyId, value in valuesDictionary.items():
    		print(f"{elementId} {propertyId} {value}")
  • By using GetPropertyIds command to batch retrieve the identifier of the properties:
    from archicad import ACConnection
    
    conn = ACConnection.connect()
    acc = conn.commands
    act = conn.types
    acu = conn.utilities
    
    propertyIds = acc.GetPropertyIds([
    	act.BuiltInPropertyUserId('Zone_ZoneNumber'),
    	act.BuiltInPropertyUserId('General_ElementID'),
    	act.UserDefinedPropertyUserId(['ZONES', 'Temperature Requirement']),
    ])
    
    propertyValuesDictionary = acu.GetPropertyValuesDictionary(acc.GetAllElements(), propertyIds)
    for elementId, valuesDictionary in propertyValuesDictionary.items():
    	for propertyId, value in valuesDictionary.items():
    		print(f"{elementId} {propertyId} {value}")
The result of the scripts above is exactly the same. But there is performance difference.
If you want to optimize your Python script for performance (run time), then you should minimize the executed commands, because each of them requires communication between ARCHICAD which has costs.
All utility functions (acu) execute one or more commands (acc) to help writing python scripts. Every GetBuiltInPropertyId and GetUserDefinedPropertyId utility functions call GetPropertyIds command once, so the first script above communicates with ARCHICAD more and runs slower (however it's not sensible in this case).

dushyant
Booster
On trying both of the codes, I get this:
    print(f"{elementId.guid} {propertyId.guid} {value}")
AttributeError: 'ElementIdArrayItem' object has no attribute 'guid'

poco2013
Advisor
Would have to see how you named ElementIdArrayItem , but assuming it is elemenId (confusing naming) , a return for guid would be elementId.elementId.guid
Gerry

Windows 10 - Visual Studio 2019; ArchiCAD 25

dushyant
Booster
poco2013 wrote:
Would have to see how you named ElementIdArrayItem , but assuming it is elemenId (confusing naming) , a return for guid would be elementId.elementId.guid
You are right, it should be: elementId.elementId.guid and propertyId.propertyId.guid
print(f"{elementId.elementId.guid} {propertyId.propertyId.guid} {value}")

Anonymous
Not applicable
Tibor wrote:
You can find all the available Built-In Properties and currently available User-Defined Properties with the GetAllPropertyNames command.
Can you help me to print the list of PropertyNames? my code is:

{
"command": "API.GetAllPropertyNames"
}

and result is:

==========

Выполнение скрипта test.py


=== Процесс завершен ===

I am trying to add to the script "excel_export.py" the list of names of objects and i can`t find the BuiltInProperty, which helps to call them.
thank you for your help and ask you to forgive me for my english:)

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!