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.

How to change the GSHandle array/selection parameter in value of a GDL object?

4livesdragon
Contributor

Hi, 

I'm just getting started with Archicad API development. 

I want to change the GSHandle array parameter in a value of a GDL object.

I have already used code like (*memo.params)[param_index].value.real = 5 to change the numerical parameters

and used code like 

GS::UniString teststr = Object_Name;
GS::ucscpy((*memo.params)[param_index].value.uStr, teststr.ToUStr());

to change the string parameters.

Now, I want to change the selection parameter. For example, for this parameter, this object has two choice "yes" and "no", I want to change it to "yes", how can I do this?

Thank you very much!

2 REPLIES 2

Hi,

Often such choices parameters are implemented in GDL via two different arrays.
One for the textual descriptions of the options and one with numerical representations (think enums in C++).

Do you have access to the GDL code of the object? If you find the VALUES{2}  keyword for the selection parameters, then this would suggest that the choice is implemented as I've described.

So my approach would be to change the underlying numerical representation and then to make sure that the parameter script is run.
I didn't need it for a while so I'm not sure about the details but I think APIAny_​OpenParametersID and the related functions would take care of that.

 

Hope that helps,
Bernd

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

Thank you very much!

This is excactly what I did, go to the GDL code and find the selection parameter and then change it the same way as the numerical parameters.

Thank you again!