Got a minute? We appreciate your feedback:

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

Type conversion GS::Unistring to GS::uchar_t[]

Not applicable
Hey everyone,

i need to set a GDL param value from my addon and i struggle to define my new value with the correct type.

UInt32 totalParams = BMGetHandleSize((GSConstHandle)memo.params) / sizeof(API_AddParType);
for (int i=0; i<totalParams ;i++){
   GS::UniString pname = ((*memo.params).name);
   if (pname=="search name"){
      GS::UniString old_value = (*memo.params).value.uStr;
      (*memo.params).value.uStr = "???????";   // how to set this
As i understand (*memo.params).value.uStr gives me an array of GS::uchar_t values. How is the correct constructor for something like this
GS::uchar_t my_chars[5] = ???; 
or can i convert a GS::Unistring to an uchar_t array? uchart_t seemes to be just a Utf16Char but i lack the understanding of those types. Any help would be aprreciated.

Thanks in advance!

(*memo.params).value.uStr = "???????"; will not work but i found the example in the docs for APIAny_​OpenParametersID so i will use that. The question of the type conversion still reamains.

Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
One example from the Element_Test example Add-On:
const GS::UniString tmpUStr ("TestName");
GS::ucscpy ((*memo.params)[ii].value.uStr, tmpUStr.ToUStr ());

Not applicable
As allways, thank you very much Tibor! It's sometimes hard to find the things you are looking for in the examples so thank you for pointing that out as well.

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!