2024-07-17 10:46 AM - last edited on 2024-09-18 03:41 PM by Doreena Deng
Hi all,
I’m aware that Built-In Properties are no longer accessible through the Archicad SDK.
Unfortunately, this means that making an Add-On compatible with all language version is now drastically more difficult!
Previously for example the property “ElementID” was available in the Property Group “GeneralElemProperties” and to my knowledge this was the same across all Archicad language versions. If we want to change or access this property now, we have to know it’s name and group name for all languages. I wasn't able to find a list for such translations yet. I'm afraid I'll have to download all Language versions and produce the list myself.
Does anybody already have such a list of translations for properties like Element ID?
If there's no easy workaround, please @Akos Somorjai consider reintroducing a way to access such properties independent of the AC language version!
Best,
Bernd
Solved! Go to Solution.
2024-07-17 11:34 AM - edited 2024-07-17 11:35 AM
Hi Bernd,
The future-proof way of identifying built-in properties is to use their guids. You can hard-code the guid in your code, just as you hard-coded the name earlier. To get the list of available built-in properties with their guids you can use this code:
void DumpAllBuiltInProperties ()
{
GS::Array<API_PropertyGroup> groups;
ACAPI_Property_GetPropertyGroups (groups);
for (const API_PropertyGroup& group : groups) {
GS::Array<API_PropertyDefinition> definitions;
ACAPI_Property_GetPropertyDefinitions (group.guid, definitions);
for (const API_PropertyDefinition& definition : definitions) {
if (definition.definitionType != API_PropertyStaticBuiltInDefinitionType) {
continue;
}
GS::UniString report =
group.name + "\t" +
definition.name + "\t" +
APIGuidToString (definition.guid);
ACAPI_WriteReport (report, false);
}
}
}
2024-07-17 11:34 AM - edited 2024-07-17 11:35 AM
Hi Bernd,
The future-proof way of identifying built-in properties is to use their guids. You can hard-code the guid in your code, just as you hard-coded the name earlier. To get the list of available built-in properties with their guids you can use this code:
void DumpAllBuiltInProperties ()
{
GS::Array<API_PropertyGroup> groups;
ACAPI_Property_GetPropertyGroups (groups);
for (const API_PropertyGroup& group : groups) {
GS::Array<API_PropertyDefinition> definitions;
ACAPI_Property_GetPropertyDefinitions (group.guid, definitions);
for (const API_PropertyDefinition& definition : definitions) {
if (definition.definitionType != API_PropertyStaticBuiltInDefinitionType) {
continue;
}
GS::UniString report =
group.name + "\t" +
definition.name + "\t" +
APIGuidToString (definition.guid);
ACAPI_WriteReport (report, false);
}
}
}
2024-07-17 12:20 PM
Thanks Viktor!
That does indeed work across languages (tested with AC28 INT/GER/ITA - Tech Preview).
I had the wrong assumption, that different property names would automatically lead to different GUIDs and that's why I've relied on the Fundamental BuiltIn property in the past. Might be that built-in properties are special regarding that. Thanks a lot for clearing it up 🙂
For reference: The 'Element ID' Property has the following GUID: 7E221F33-829B-4FBC-A670-E74DABCE6289
2024-07-17 12:21 PM - edited 2024-07-17 12:27 PM
I totally support Bernd on this. Addon developers are a significant part of Archicad 's evolment and users' workflow.
Their work should be more productive and creative and so the SDK must also aim on this.
Edit: Glad that the instant solution by @Viktor Kovacs cleared things up.
2024-07-17 12:22 PM
Yes, built-in property guids are stable across Archicad versions and languages. 🙂
2024-07-17 12:25 PM
Thanks @Botonis for always having my back!
Fortunately, the way Viktor showed is a very easy and better alternative to do the thing I tried to do 😀