<?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: How to get all instance of a Object in C++? in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-all-instance-of-a-Object-in-C/m-p/570899#M8722</link>
    <description>&lt;P&gt;Hi!&lt;BR /&gt;&lt;BR /&gt;Here's some sample code. I haven't tested it but it should be very close to what you need:&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;GSErrCode IterateThroughListLibPartsOnCurrentFloor ()
{
	API_LibPart libPart{};

	CHCopyC ("{GUID OF YOUR LIBPART HERE}-{00000000-0000-0000-0000-000000000000}",
		libPart.ownUnID);

	GSErrCode err = ACAPI_LibPart_Search (&amp;amp;libPart, false);
	if (err != NoError) { return err; }

	if (libPart.location != nullptr) {
		delete libPart.location;
		libPart.location = nullptr;
	}

	GS::Array&amp;lt;API_Guid&amp;gt; objectList;
	err = ACAPI_Element_GetElemList (API_ObjectID, &amp;amp;objectList, APIFilt_OnActFloor);
	if (err != NoError) { return err; }

	for (const auto objectGuid : objectList) {
		API_Element objectElem{};
		objectElem.header.guid = objectGuid;
		err = ACAPI_Element_Get (&amp;amp;objectElem);
		if (err != NoError) { return err; }

		if (libPart.index == objectElem.object.libInd) {
			// Here you have a placed object element from the library part
		}
	}


	return err;
}
&lt;/LI-CODE&gt;</description>
    <pubDate>Sun, 15 Oct 2023 21:58:51 GMT</pubDate>
    <dc:creator>BerndSchwarzenbacher</dc:creator>
    <dc:date>2023-10-15T21:58:51Z</dc:date>
    <item>
      <title>How to get all instance of a Object in C++?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-all-instance-of-a-Object-in-C/m-p/570870#M8717</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;
&lt;P&gt;I want to get all&amp;nbsp;API_ObjectID of a&amp;nbsp;API_LibPart in active floor.&amp;nbsp;Do you know any way? Can you tell me?&lt;/P&gt;
&lt;P&gt;Thank you very much.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2024 12:27:30 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-all-instance-of-a-Object-in-C/m-p/570870#M8717</guid>
      <dc:creator>Tran Thanh Lo</dc:creator>
      <dc:date>2024-09-16T12:27:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to get all instance of a Object in C++?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-all-instance-of-a-Object-in-C/m-p/570899#M8722</link>
      <description>&lt;P&gt;Hi!&lt;BR /&gt;&lt;BR /&gt;Here's some sample code. I haven't tested it but it should be very close to what you need:&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;GSErrCode IterateThroughListLibPartsOnCurrentFloor ()
{
	API_LibPart libPart{};

	CHCopyC ("{GUID OF YOUR LIBPART HERE}-{00000000-0000-0000-0000-000000000000}",
		libPart.ownUnID);

	GSErrCode err = ACAPI_LibPart_Search (&amp;amp;libPart, false);
	if (err != NoError) { return err; }

	if (libPart.location != nullptr) {
		delete libPart.location;
		libPart.location = nullptr;
	}

	GS::Array&amp;lt;API_Guid&amp;gt; objectList;
	err = ACAPI_Element_GetElemList (API_ObjectID, &amp;amp;objectList, APIFilt_OnActFloor);
	if (err != NoError) { return err; }

	for (const auto objectGuid : objectList) {
		API_Element objectElem{};
		objectElem.header.guid = objectGuid;
		err = ACAPI_Element_Get (&amp;amp;objectElem);
		if (err != NoError) { return err; }

		if (libPart.index == objectElem.object.libInd) {
			// Here you have a placed object element from the library part
		}
	}


	return err;
}
&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 15 Oct 2023 21:58:51 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-all-instance-of-a-Object-in-C/m-p/570899#M8722</guid>
      <dc:creator>BerndSchwarzenbacher</dc:creator>
      <dc:date>2023-10-15T21:58:51Z</dc:date>
    </item>
  </channel>
</rss>

