cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
2024 Technology Preview Program

2024 Technology Preview Program:
Master powerful new features and shape the latest BIM-enabled innovations

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

How to set the Height of an Object through code

kency
Enthusiast

Hello,

 

Have someone come across a use to set the height of an Object from code. Have added the screenshot of the field which I meant .

kency_1-1720420936504.png

There are fields in API_ObjectType for setting the X and Y values but not for the height.

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Solution

No you don't have to edit the library object itself. You have to change the parameters value for a specific object (which has reference to the relevant library object). The parameters for a specific object are part of the Element Memo of that object.
This way you can change single instances.

Bernd Schwarzenbacher - Archicad Add-On Developer - Get Add-Ons & Archicad Tips on my Website: Archi-XT.com

View solution in original post

Solution

It depends on what you want to achieve. Editing the library part is rarely needed. Usually placed instances need to be updated.

You can use the ACAPI_Element_Get and ACAPI_Element_GetMemo functions to retrieve parameters.

In the API_ElementMemo structure there is the "params" array, that need to be updated.

If you install the devkit there should be an examples folder which uses these structures quite a lot. There is the Element_Test sample, and for example the Element_Modify_ChangeParameters.cpp in the project. There you can find ways to iterate through the parameters of an object instance.

View solution in original post

6 REPLIES 6

Hi Kency, I think you need to change the ZZYZX parameter of the object. But don't have time to confirm right now.

Bernd Schwarzenbacher - Archicad Add-On Developer - Get Add-Ons & Archicad Tips on my Website: Archi-XT.com

Yep A, B, ZZYZX sets the dimensions of an object. ZZYZX is the height.

(But in case of a door for example A, B defines the hole in the wall.)

kency
Enthusiast

To edit the ZZYZX value, we would need to update the library object right? Will editing that affect the all the object instances or just a single instance?

Solution

No you don't have to edit the library object itself. You have to change the parameters value for a specific object (which has reference to the relevant library object). The parameters for a specific object are part of the Element Memo of that object.
This way you can change single instances.

Bernd Schwarzenbacher - Archicad Add-On Developer - Get Add-Ons & Archicad Tips on my Website: Archi-XT.com
Solution

It depends on what you want to achieve. Editing the library part is rarely needed. Usually placed instances need to be updated.

You can use the ACAPI_Element_Get and ACAPI_Element_GetMemo functions to retrieve parameters.

In the API_ElementMemo structure there is the "params" array, that need to be updated.

If you install the devkit there should be an examples folder which uses these structures quite a lot. There is the Element_Test sample, and for example the Element_Modify_ChangeParameters.cpp in the project. There you can find ways to iterate through the parameters of an object instance.

kency
Enthusiast

Thank you this worked.