<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Getting Error with CHCopyC in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Getting-Error-with-CHCopyC/m-p/369133#M1684</link>
    <description>&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to edit the names of layouts and I encountered some strange behaviour.&lt;/P&gt;
&lt;P&gt;I copied the code from&amp;nbsp;&lt;A href="https://archicadapi.graphisoft.com/documentation/apidb_modifydatabaseid" target="_blank" rel="noopener"&gt;https://archicadapi.graphisoft.com/documentation/apidb_modifydatabaseid&lt;/A&gt;&amp;nbsp;and I get the following error:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CHcopyC error.png" style="width: 400px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/33932iF8A0AEF5F6A4FE98/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CHcopyC error.png" alt="CHcopyC error.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;It is the exact same code (initiliazing and zeroing lines are not in the screenshot).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wanted to use CHcopyC to change the values of dbInfo.ref and dbInfo.name, but it doesnt work.&lt;/P&gt;
&lt;P&gt;So I tried a work around:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;std::string nm{ "Nachname" };
GS::UniString orgnm{ dbi.name };
for (GS::USize i = 0; i &amp;lt; orgnm.GetLength(); i++)
{
  dbi.name[i] = NULL;
}
for (int i = 0; i &amp;lt; nm.length(); i++)
{
  dbi.name[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 &amp;lt; orgvm.GetLength(); i++)
{
  dbi.ref[i] = NULL;
}
for (int i = 0; i &amp;lt; vm.length(); i++)
{
  dbi.ref[i] = vm[i];
}&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;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&amp;nbsp;ACAPI_Database(APIDb_ModifyDatabaseID, &amp;amp;dbi, nullptr); it keeps its old name in ArchiCAD).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So&lt;/P&gt;
&lt;P&gt;1) How do I get CHopyC running?&lt;/P&gt;
&lt;P&gt;2) What am I doing wrong when editing ref?From&amp;nbsp;&lt;A href="https://archicadapi.graphisoft.com/documentation/api_windowinfo" target="_blank" rel="noopener"&gt;https://archicadapi.graphisoft.com/documentation/api_windowinfo&lt;/A&gt;&amp;nbsp;I should be able to edit ref.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks and Kind Regards&lt;/P&gt;
&lt;P&gt;Dayiz&lt;/P&gt;</description>
    <pubDate>Tue, 31 Jan 2023 18:01:49 GMT</pubDate>
    <dc:creator>Dayiz</dc:creator>
    <dc:date>2023-01-31T18:01:49Z</dc:date>
    <item>
      <title>Getting Error with CHCopyC</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Getting-Error-with-CHCopyC/m-p/369133#M1684</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to edit the names of layouts and I encountered some strange behaviour.&lt;/P&gt;
&lt;P&gt;I copied the code from&amp;nbsp;&lt;A href="https://archicadapi.graphisoft.com/documentation/apidb_modifydatabaseid" target="_blank" rel="noopener"&gt;https://archicadapi.graphisoft.com/documentation/apidb_modifydatabaseid&lt;/A&gt;&amp;nbsp;and I get the following error:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CHcopyC error.png" style="width: 400px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/33932iF8A0AEF5F6A4FE98/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CHcopyC error.png" alt="CHcopyC error.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;It is the exact same code (initiliazing and zeroing lines are not in the screenshot).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wanted to use CHcopyC to change the values of dbInfo.ref and dbInfo.name, but it doesnt work.&lt;/P&gt;
&lt;P&gt;So I tried a work around:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;std::string nm{ "Nachname" };
GS::UniString orgnm{ dbi.name };
for (GS::USize i = 0; i &amp;lt; orgnm.GetLength(); i++)
{
  dbi.name[i] = NULL;
}
for (int i = 0; i &amp;lt; nm.length(); i++)
{
  dbi.name[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 &amp;lt; orgvm.GetLength(); i++)
{
  dbi.ref[i] = NULL;
}
for (int i = 0; i &amp;lt; vm.length(); i++)
{
  dbi.ref[i] = vm[i];
}&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;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&amp;nbsp;ACAPI_Database(APIDb_ModifyDatabaseID, &amp;amp;dbi, nullptr); it keeps its old name in ArchiCAD).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So&lt;/P&gt;
&lt;P&gt;1) How do I get CHopyC running?&lt;/P&gt;
&lt;P&gt;2) What am I doing wrong when editing ref?From&amp;nbsp;&lt;A href="https://archicadapi.graphisoft.com/documentation/api_windowinfo" target="_blank" rel="noopener"&gt;https://archicadapi.graphisoft.com/documentation/api_windowinfo&lt;/A&gt;&amp;nbsp;I should be able to edit ref.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks and Kind Regards&lt;/P&gt;
&lt;P&gt;Dayiz&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2023 18:01:49 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Getting-Error-with-CHCopyC/m-p/369133#M1684</guid>
      <dc:creator>Dayiz</dc:creator>
      <dc:date>2023-01-31T18:01:49Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Error with CHopyC</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Getting-Error-with-CHCopyC/m-p/369148#M1685</link>
      <description>&lt;P&gt;The documentation is outdated, use ucscpy instead of CHCopyC.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;GS::ucscpy (dbInfo.name, L("My Cool Database Name"));&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2023 20:09:52 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Getting-Error-with-CHCopyC/m-p/369148#M1685</guid>
      <dc:creator>kovacsv</dc:creator>
      <dc:date>2023-01-30T20:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Error with CHopyC</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Getting-Error-with-CHCopyC/m-p/369203#M1686</link>
      <description>&lt;P&gt;Thank you again for your help!&lt;/P&gt;&lt;P&gt;I tried it out and it works for dbInfo.name, but not for dbInfo.ref&lt;/P&gt;&lt;P&gt;And since the doc is outdatet, how am I supposed to find out that CHcopyC is depracted and that I should use&amp;nbsp; GS::ucscpy instead?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2023 10:36:09 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Getting-Error-with-CHCopyC/m-p/369203#M1686</guid>
      <dc:creator>Dayiz</dc:creator>
      <dc:date>2023-01-31T10:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Error with CHCopyC</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Getting-Error-with-CHCopyC/m-p/369362#M1687</link>
      <description>&lt;P&gt;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.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2023 11:26:38 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Getting-Error-with-CHCopyC/m-p/369362#M1687</guid>
      <dc:creator>kovacsv</dc:creator>
      <dc:date>2023-02-01T11:26:38Z</dc:date>
    </item>
  </channel>
</rss>

