<?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 [SOLVED] Get Project name in Add-On in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Get-Project-name-in-Add-On/m-p/258808#M5532</link>
    <description>&lt;DIV class="actalk-migrated-content"&gt;Hi&lt;BR /&gt;&lt;BR /&gt;How can I get Project Name or file name in ArchiCAD Add-On?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;Lukasz&lt;/DIV&gt;</description>
    <pubDate>Tue, 01 Aug 2023 11:26:43 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-08-01T11:26:43Z</dc:date>
    <item>
      <title>[SOLVED] Get Project name in Add-On</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Get-Project-name-in-Add-On/m-p/258808#M5532</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;Hi&lt;BR /&gt;&lt;BR /&gt;How can I get Project Name or file name in ArchiCAD Add-On?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;Lukasz&lt;/DIV&gt;</description>
      <pubDate>Tue, 01 Aug 2023 11:26:43 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Get-Project-name-in-Add-On/m-p/258808#M5532</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-08-01T11:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: Get Project name in Add-On</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Get-Project-name-in-Add-On/m-p/258809#M5533</link>
      <description>Hi Lukasz, &lt;BR /&gt;
 &lt;BR /&gt;
You can get informations about the project with the ACAPI_Environment (APIEnv_ProjectID, ...) method call.
&lt;PRE&gt;API_ProjectInfo		projectInfo; 
GSErrCode			err = ACAPI_Environment (APIEnv_ProjectID, &amp;amp;projectInfo, NULL); 
if (err != NoError) { 
	ErrorBeep ("APIEnv_ProjectID", err); 
	return; 
} 
 
if (projectInfo.untitled) { 
	WriteReport ("Project file has not been saved yet"); 
} else { 
	IO::Path		projectPath; 
	IO::Name		projectName; 
 
	if (!projectInfo.teamwork) { 
		projectInfo.location-&amp;gt;ToPath (&amp;amp;projectPath); 
		WriteReport ("Solo Project location: %s", (const char *) projectPath); 
		projectInfo.location-&amp;gt;GetLastLocalName (&amp;amp;projectName); 
		WriteReport ("Project Name: %s", (const char *) projectName.ToCStr ()); 
	} else { 
		projectInfo.location_team-&amp;gt;ToPath (&amp;amp;projectPath); 
		WriteReport ("Shared Project: %s", (const char *) projectPath); 
		projectInfo.location_team-&amp;gt;GetLastLocalName (&amp;amp;projectName); 
		WriteReport ("Project Name: %s", (const char *) projectName.ToCStr ()); 
	} 
 
	if (projectInfo.location != NULL) 
		delete projectInfo.location; 
	if (projectInfo.location_team != NULL) 
		delete projectInfo.location_team; 
}&lt;/PRE&gt;
Regards, &lt;BR /&gt;
Tibor</description>
      <pubDate>Tue, 07 Apr 2015 14:08:51 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Get-Project-name-in-Add-On/m-p/258809#M5533</guid>
      <dc:creator>Tibor Lorantfy</dc:creator>
      <dc:date>2015-04-07T14:08:51Z</dc:date>
    </item>
    <item>
      <title>Re: [SOLVED] Get Project name in Add-On</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Get-Project-name-in-Add-On/m-p/258810#M5534</link>
      <description>Thanks for your help. It is working &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_smile.gif" style="display : inline;" /&gt;&lt;BR /&gt;
&lt;BR /&gt;
Best Regards&lt;BR /&gt;
Lukasz</description>
      <pubDate>Mon, 13 Apr 2015 20:23:25 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Get-Project-name-in-Add-On/m-p/258810#M5534</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-04-13T20:23:25Z</dc:date>
    </item>
    <item>
      <title>Re: [SOLVED] Get Project name in Add-On</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Get-Project-name-in-Add-On/m-p/258811#M5535</link>
      <description>Hello Tibor,&lt;BR /&gt;
First of all i'm new here, i've been tinkering around with archicad API for a few days now (so keep in mind i'm still a noob).&lt;BR /&gt;
&lt;BR /&gt;
I've been trying to get the project's name, as shown in the picture below, the value testtest.&lt;BR /&gt;
&lt;A href="https://drive.google.com/file/d/11gLYinCXFZuUj9C-o8uiFcHBRlnv9aod/view?usp=sharing" target="_blank"&gt;&lt;/A&gt;&lt;S&gt;&lt;A href="https://drive.google.com/file/d/11gLYinCXFZuUj9C-o8uiFcHBRlnv9aod/view?usp=sharing" target="_blank"&gt;&lt;/A&gt;&lt;A href="&amp;lt;/s&amp;gt;&amp;lt;LINK_TEXT text=&amp;quot;https://drive.google.com/file/d/11gLYin ... sp=sharing&amp;quot;&amp;gt;https://drive.google.com/file/d/11gLYinCXFZuUj9C-o8uiFcHBRlnv9aod/view?usp=sharing&amp;lt;/LINK_TEXT&amp;gt;&amp;lt;e&amp;gt;"&gt;&lt;/A&gt;&lt;/S&gt;&lt;LINK_TEXT text="https://drive.google.com/file/d/11gLYin ... sp=sharing"&gt;https://drive.google.com/file/d/11gLYinCXFZuUj9C-o8uiFcHBRlnv9aod/view?usp=sharing&lt;/LINK_TEXT&gt;&lt;E&gt;&lt;/E&gt;&lt;BR /&gt;
I set this value (testtest) manually, and saved the file since, closed it, opened it again, value was still there.&lt;BR /&gt;
When i try to access it from the addon i'm coding (dev kit 21), i keep getting (null).&lt;BR /&gt;
Here's how i'm attempting to do this:
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;API_ProjectInfo		projectInfo;
GSErrCode			err = ACAPI_Environment(APIEnv_ProjectID,  &amp;amp;projectInfo, NULL);
			
if (err != NoError) {
	ErrorBeep("APIEnv_ProjectID", err);
	return;
}
if (projectInfo.untitled) {
	WriteReport("Project file has not been saved yet");
}
else {
	DBPrintf("\n\nprojectname = %s \n\n", projectInfo.projectName);
}&lt;/PRE&gt;

When reading this page: &lt;A href="http://archicadapi.graphisoft.com/documentation/api_projectinfo" target="_blank"&gt;&lt;LINK_TEXT text="http://archicadapi.graphisoft.com/docum ... rojectinfo"&gt;http://archicadapi.graphisoft.com/documentation/api_projectinfo&lt;/LINK_TEXT&gt;&lt;/A&gt;&lt;BR /&gt;
I can't see what i'm doing wrong...&lt;BR /&gt;
&lt;BR /&gt;
Any help or insights would be much appreciated&lt;BR /&gt;
Wacim</description>
      <pubDate>Wed, 17 Oct 2018 15:48:51 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Get-Project-name-in-Add-On/m-p/258811#M5535</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-10-17T15:48:51Z</dc:date>
    </item>
    <item>
      <title>Re: [SOLVED] Get Project name in Add-On</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Get-Project-name-in-Add-On/m-p/258812#M5536</link>
      <description>Hi Wacim!&lt;BR /&gt;
&lt;BR /&gt;
Well done, it's nice from a beginner!&lt;BR /&gt;
The projectName field of the API_ProjectInfo structure is a pointer to a GS::UniString object, which means you can get the "const char*" string from it the following way:
&lt;PRE&gt;projectInfo.projectName-&amp;gt;ToCStr()-&amp;gt;Get()&lt;/PRE&gt;

So instead of this:
&lt;BLOCKQUOTE&gt;wacim wrote:&lt;BR /&gt;
Here's how i'm attempting to do this:
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;API_ProjectInfo		projectInfo;
...
	DBPrintf("\n\nprojectname = %s \n\n", projectInfo.projectName);
&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;

Use this:
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;API_ProjectInfo     projectInfo;
...
    DBPrintf("\n\nprojectname = %s \n\n", projectInfo.projectName-&amp;gt;ToCStr()-&amp;gt;Get());
&lt;/PRE&gt;

I hope this helps.&lt;BR /&gt;
Regards,&lt;BR /&gt;
Tibor</description>
      <pubDate>Tue, 23 Oct 2018 18:42:25 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Get-Project-name-in-Add-On/m-p/258812#M5536</guid>
      <dc:creator>Tibor Lorantfy</dc:creator>
      <dc:date>2018-10-23T18:42:25Z</dc:date>
    </item>
    <item>
      <title>Re: [SOLVED] Get Project name in Add-On</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Get-Project-name-in-Add-On/m-p/258813#M5537</link>
      <description>Thanks again Tibor  &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_biggrin.gif" style="display : inline;" /&gt; &lt;BR /&gt;
I finally achieved this with APIAny_GetAutoTextKeysID&lt;BR /&gt;
great example given here:&lt;BR /&gt;
&lt;A href="http://archicadapi.graphisoft.com/documentation/apiany_getautotextkeysid" target="_blank"&gt;&lt;/A&gt;&lt;S&gt;&lt;A href="http://archicadapi.graphisoft.com/documentation/apiany_getautotextkeysid" target="_blank"&gt;&lt;/A&gt;&lt;A href="&amp;lt;/s&amp;gt;&amp;lt;LINK_TEXT text=&amp;quot;http://archicadapi.graphisoft.com/docum ... textkeysid&amp;quot;&amp;gt;http://archicadapi.graphisoft.com/documentation/apiany_getautotextkeysid&amp;lt;/LINK_TEXT&amp;gt;&amp;lt;e&amp;gt;"&gt;&lt;/A&gt;&lt;/S&gt;&lt;LINK_TEXT text="http://archicadapi.graphisoft.com/docum ... textkeysid"&gt;http://archicadapi.graphisoft.com/documentation/apiany_getautotextkeysid&lt;/LINK_TEXT&gt;&lt;E&gt;&lt;/E&gt;</description>
      <pubDate>Fri, 26 Oct 2018 13:30:02 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Get-Project-name-in-Add-On/m-p/258813#M5537</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-10-26T13:30:02Z</dc:date>
    </item>
  </channel>
</rss>

