Choose your top Archicad wishes!

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

Getting Error with CHCopyC


Hello everyone,


I'm trying to edit the names of layouts and I encountered some strange behaviour.

I copied the code from and I get the following error:

CHcopyC error.png

It is the exact same code (initiliazing and zeroing lines are not in the screenshot). 

I wanted to use CHcopyC to change the values of dbInfo.ref and, but it doesnt work.

So I tried a work around:


std::string nm{ "Nachname" };
GS::UniString orgnm{ };
for (GS::USize i = 0; i < orgnm.GetLength(); i++)
{[i] = NULL;
for (int i = 0; i < nm.length(); i++)
{[i] = nm[i];

Which works for name, but if I do the same with ref:

std::string vm{ "Vorname" };
GS::UniString orgvm{ dbi.ref };
for (GS::USize i = 0; i < orgvm.GetLength(); i++)
  dbi.ref[i] = NULL;
for (int i = 0; i < vm.length(); i++)
  dbi.ref[i] = vm[i];

it doesn't work (to be precise: i can use DG::InformationAlert to get dbi.ref after I edit it, which gives me the value i put it ("Vorname"), but when I use ACAPI_Database(APIDb_ModifyDatabaseID, &dbi, nullptr); it keeps its old name in ArchiCAD).



1) How do I get CHopyC running?

2) What am I doing wrong when editing ref?From I should be able to edit ref.


Thanks and Kind Regards



The documentation is outdated, use ucscpy instead of CHCopyC.


GS::ucscpy (, L("My Cool Database Name"));



Thank you again for your help!

I tried it out and it works for, but not for dbInfo.ref

And since the doc is outdatet, how am I supposed to find out that CHcopyC is depracted and that I should use  GS::ucscpy instead?



It's the same data type, so it's probably not about the string copy function, but something else. About the outdated documentation: I usually find samples in the Example Add-Ons provided in the DevKit, they are always compiling.