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

Archicad C++ API
About Archicad add-on development using the C++ API.

Property Definition Element list

poco2013
Mentor
Knowing the definition guid, can one obtain a list of all elements (guidlist) which have that particular property definition assigned to it?

I know that I can get a list of all elements for a particular element type, then iterate through the list to obtain the definitions for each element and then to see which element has the referenced definition linked to it.

I would like to reverse the process to directly obtain the elements linked to a particular definition.

Looked at classification, element & property test examples and no help or perhaps I didn't know what I was looking at/
.
Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27
2 REPLIES 2
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
poco2013 wrote:
Knowing the definition guid, can one obtain a list of all elements (guidlist) which have that particular property definition assigned to it?
A property definition is available for specific classifications. So if a property definition is set as available for a given classification, then all the elements which has the given classification will have that property.
So the question is wrong, the properties are not assigned to elements explicitly!

The 'availability' member of the API_PropertyDefinition structure defines the GUIDs of the classifications.
So you need a function which returns all the elements with the given classifications. As far as I know there is no simple way to do that.
ACAPI_Element_GetClassificationItems function returns the classifications of an element, but I recommend you to use the ACAPI_Element_IsPropertyDefinitionAvailable function.
poco2013
Mentor
Tibor wrote:
So you need a function which returns all the elements with the given classifications. As far as I know there is no simple way to do that.
Thanks for the refinement. But that still brings us back to the same problem. That there is no direct link from a specific definition to its linked elements.

The reason I made the inquiry is that in area analysis, one needs to gather all area elements pertinent to the analysis and marked as such. The easiest way to do that is to attach a property defining the usage of the element as in: 'conditioned space', 'terrain', 'setback'. 'impermeable surface', 'room area', 'unbuildable. This can be done, somewhat with zones, but zones are not always appropriate.

The indirect approach is really not intuitive and would increase execution times , but since this analysis is not done very often, usually at the end of a project, I suppose it's acceptable -- but not agreeable?
Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27