<?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 Re: Getting a API_Guid from Library part in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Getting-a-API-Guid-from-Library-part/m-p/266972#M5009</link>
    <description>Hum...i answer to my own question &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_smile.gif" style="display : inline;" /&gt;&lt;BR /&gt;

&lt;PRE&gt;GS::UniString s = libpart.ownUnID;
GS::Guid gs_guid(s);
API_Guid ag  = GSGuid2APIGuid (gs_guid);&lt;/PRE&gt;

It seem's to work but i'm not sure it's the best method.</description>
    <pubDate>Thu, 10 Mar 2016 15:48:08 GMT</pubDate>
    <dc:creator>gehairing</dc:creator>
    <dc:date>2016-03-10T15:48:08Z</dc:date>
    <item>
      <title>Getting a API_Guid from Library part</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Getting-a-API-Guid-from-Library-part/m-p/266971#M5008</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;Hello the Forum &lt;IMG style="display: inline;" src="https://community.graphisoft.com/legacyfs/online/emojis/icon_smile.gif" border="0" /&gt;&lt;BR /&gt;&lt;BR /&gt;What is the most clean method for getting an API_Guid from a Library part (API_LibPart) ?&lt;BR /&gt;&lt;BR /&gt;I need to get &amp;amp; set IFC Data of a Library part.&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;/DIV&gt;</description>
      <pubDate>Thu, 13 Jul 2023 12:22:32 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Getting-a-API-Guid-from-Library-part/m-p/266971#M5008</guid>
      <dc:creator>gehairing</dc:creator>
      <dc:date>2023-07-13T12:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a API_Guid from Library part</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Getting-a-API-Guid-from-Library-part/m-p/266972#M5009</link>
      <description>Hum...i answer to my own question &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_smile.gif" style="display : inline;" /&gt;&lt;BR /&gt;

&lt;PRE&gt;GS::UniString s = libpart.ownUnID;
GS::Guid gs_guid(s);
API_Guid ag  = GSGuid2APIGuid (gs_guid);&lt;/PRE&gt;

It seem's to work but i'm not sure it's the best method.</description>
      <pubDate>Thu, 10 Mar 2016 15:48:08 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Getting-a-API-Guid-from-Library-part/m-p/266972#M5009</guid>
      <dc:creator>gehairing</dc:creator>
      <dc:date>2016-03-10T15:48:08Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a API_Guid from Library part</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Getting-a-API-Guid-from-Library-part/m-p/266973#M5010</link>
      <description>Error : It doesn't work &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_sad.gif" style="display : inline;" /&gt;</description>
      <pubDate>Thu, 10 Mar 2016 16:13:15 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Getting-a-API-Guid-from-Library-part/m-p/266973#M5010</guid>
      <dc:creator>gehairing</dc:creator>
      <dc:date>2016-03-10T16:13:15Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a API_Guid from Library part</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Getting-a-API-Guid-from-Library-part/m-p/266974#M5011</link>
      <description>I have made a test function.&lt;BR /&gt;
&lt;BR /&gt;
The functions gets the selected element in the model and get his API_Guid.&lt;BR /&gt;
It also tries to get the GUID from the library part (if an library part is selected of course).&lt;BR /&gt;
&lt;BR /&gt;
When I compare the Guid's...there are different.&lt;BR /&gt;
Probably i am not understanding how all this works.&lt;BR /&gt;
&lt;BR /&gt;

&lt;PRE&gt;	// Scan all selected objects in AC
	API_SelectionInfo selectionInfo; 
	API_Neig **selNeigs;
	err = ACAPI_Selection_Get (&amp;amp;selectionInfo, &amp;amp;selNeigs, false); 
	if (err == NoError) 
	{ 
		// If we have selected elements
		if (selectionInfo.typeID != API_SelEmpty) 
		{ 
			UInt32 ii, nSel; 
			nSel = BMGetHandleSize ((GSHandle) selNeigs) / sizeof (API_Neig); 
			for (ii = 0; ii &amp;lt; nSel &amp;amp;&amp;amp; err == NoError; ii++) 
			{ 
				// Get selected element
				API_Element  element;
				BNZeroMemory (&amp;amp;element, sizeof (API_Element));
				element.header.guid  = (*selNeigs)[ii].guid;
				err = ACAPI_Element_Get(&amp;amp;element);
				if(err == NoError)
				{
					// Is it a library part
					API_LibPart libpart;
					BNZeroMemory (&amp;amp;libpart, sizeof (libpart));
					libpart.index = element.object.libInd;
					err = ACAPI_LibPart_Get (&amp;amp;libpart);
					if (err == NoError) 
					{
						// Yes it's a library part

						// Get elements guid
						API_Guid good_ag = element.header.guid;
							

						
// Get Guids from the library part and NOT from selected element
						GS::UniString s = libpart.ownUnID;
						GS::Guid gs_guid(s);
						API_Guid bad_ag  = GSGuid2APIGuid (gs_guid);

						GS::UniString s1 = libpart.parentUnID;
						GS::Guid gs_guid1(s1);
						API_Guid bad_ag1  = GSGuid2APIGuid (gs_guid1);

						DumpIFCProperties(libpart, good_ag);
&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Mar 2016 18:09:04 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Getting-a-API-Guid-from-Library-part/m-p/266974#M5011</guid>
      <dc:creator>gehairing</dc:creator>
      <dc:date>2016-03-10T18:09:04Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a API_Guid from Library part</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Getting-a-API-Guid-from-Library-part/m-p/266975#M5012</link>
      <description>&lt;BLOCKQUOTE&gt;gehairing wrote:&lt;BR /&gt;I have made a test function.&lt;BR /&gt;
&lt;BR /&gt;
The functions gets the selected element in the model and get his API_Guid.&lt;BR /&gt;
It also tries to get the GUID from the library part (if an library part is selected of course).&lt;BR /&gt;
&lt;BR /&gt;
When I compare the Guid's...there are different.&lt;BR /&gt;
Probably i am not understanding how all this works.&lt;BR /&gt;
&lt;BR /&gt;

&lt;PRE&gt;	// Scan all selected objects in AC
	API_SelectionInfo selectionInfo; 
	API_Neig **selNeigs;
	err = ACAPI_Selection_Get (&amp;amp;selectionInfo, &amp;amp;selNeigs, false); 
	if (err == NoError) 
	{ 
		// If we have selected elements
		if (selectionInfo.typeID != API_SelEmpty) 
		{ 
			UInt32 ii, nSel; 
			nSel = BMGetHandleSize ((GSHandle) selNeigs) / sizeof (API_Neig); 
			for (ii = 0; ii &amp;lt; nSel &amp;amp;&amp;amp; err == NoError; ii++) 
			{ 
				// Get selected element
				API_Element  element;
				BNZeroMemory (&amp;amp;element, sizeof (API_Element));
				element.header.guid  = (*selNeigs)[ii].guid;
				err = ACAPI_Element_Get(&amp;amp;element);
				if(err == NoError)
				{
					// Is it a library part
					API_LibPart libpart;
					BNZeroMemory (&amp;amp;libpart, sizeof (libpart));
					libpart.index = element.object.libInd;
					err = ACAPI_LibPart_Get (&amp;amp;libpart);
					if (err == NoError) 
					{
						// Yes it's a library part

						// Get elements guid
						API_Guid good_ag = element.header.guid;
							

						
// Get Guids from the library part and NOT from selected element
						GS::UniString s = libpart.ownUnID;
						GS::Guid gs_guid(s);
						API_Guid bad_ag  = GSGuid2APIGuid (gs_guid);

						GS::UniString s1 = libpart.parentUnID;
						GS::Guid gs_guid1(s1);
						API_Guid bad_ag1  = GSGuid2APIGuid (gs_guid1);

						DumpIFCProperties(libpart, good_ag);
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;

Hi,&lt;BR /&gt;
&lt;BR /&gt;
The major difference between library parts and objects in the ARCHICAD API domain is that library parts refer to gsm files (in the embedded library, in an other lcf (library container file)), whereas the objects are placed instances of library parts.&lt;BR /&gt;
&lt;BR /&gt;
I reckon you already have the GUID you need without going indirectly to the library part. The (*selNeigs)[ii].guid contains the GUID of the element (object) placed onto the floor plan; you should get the actual values of the IFC properties from there. After ACAPI_Element_Get please also check if the element.header.typeID is of any of the libpart-based elements (API_ObjectID, API_LampID), otherwise the element.object.libInd doesn't contain valid information.&lt;BR /&gt;
&lt;BR /&gt;
Best, Ákos</description>
      <pubDate>Fri, 18 Mar 2016 17:53:29 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Getting-a-API-Guid-from-Library-part/m-p/266975#M5012</guid>
      <dc:creator>Akos Somorjai</dc:creator>
      <dc:date>2016-03-18T17:53:29Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a API_Guid from Library part</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Getting-a-API-Guid-from-Library-part/m-p/266976#M5013</link>
      <description>Thank you for the clarification &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_smile.gif" style="display : inline;" /&gt;</description>
      <pubDate>Mon, 21 Mar 2016 07:26:08 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Getting-a-API-Guid-from-Library-part/m-p/266976#M5013</guid>
      <dc:creator>gehairing</dc:creator>
      <dc:date>2016-03-21T07:26:08Z</dc:date>
    </item>
  </channel>
</rss>

