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

How to set the same property for all elements in a project?

luna
Contributor

Hi

 

I want to create an identical attribute for all elements in the project to set a custom ID of my company.

 

I learn how to add a String attribute to a selected element through the Property_Test example. But only elements can be selected, and an attribute can be set to a certain type of element. If I want to set the same attribute to other types of elements, an error message will be generated. It is APIERR_NAMEALREADYUSED. I learned that this was because I set the same property name. For example, if I select a wall, I set a custom ID for all the walls, but if I select the door and set the custom ID, I get the error.

 

I want to set the same property custom ID to all the elements in the project without having to select a particular element, please give me some help.

 

🙂

Newbie Allen

2 REPLIES 2
Marc H
Advisor

If you are asking how to embed a company ID code into each element for some sort of tracking purpose, I’ll leave that to others.  If you are looking to use standardized alpha/numeric codes to standardize different elements and objects: have you tried creating a property group using the Property Manager?  I’ve set this up on projects to identified pre-set specs (mostly F&E, but can apply to elements) to coordinate with other team members.  Within the property group you have the option to add all manner of properties related to each other under that group.

 

 

“The best thing about the future is that it comes one day at a time.” - Abraham Lincoln

AC27 USA on 16” 2019 MBP (2.4GHz i9 8-Core, 32GB DDR4, AMD Radeon Pro 5500M 8G GDDR5, 500GB SSD, T3s, Trackpad use) running Sonoma OS + extended w/ (2) 32" ASUS ProArt PAU32C (4K) Monitors

Hi, Marc


Thanks for your suggestion, I have implemented my idea through ACAPI_ElementList_AddProperty.


I'm working on the next problem. 

I'll come back and ask questions if it hasn't worked out for a while.  🙂