<?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: Get/set door types in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Get-set-door-types/m-p/671349#M10513</link>
    <description>&lt;P&gt;I found a way to change the door library part:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;void __stdcall OnTagType(NativeTypeModel* selectedType)
{
	GS::Array&amp;lt;API_Guid&amp;gt; doorGuids;

	GSErrCode err = ACAPI_Element_GetElemList(API_DoorID, &amp;amp;doorGuids, APIFilt_OnActFloor);
	if (err != NoError) {
		ACAPI_WriteReport("Failed to get door elements list.", true);
		return;
	}
	else
	{
		GS::UniString message = GS::UniString::Printf("Changing %d door elements.", doorGuids.GetSize());
		ACAPI_WriteReport(message, false);
	}

	int finalCount = 0;

	for (const API_Guid&amp;amp; doorGuid : doorGuids) {
		API_Element element;
		API_ElementMemo   memo;
		GSErrCode         err;
		API_Element       mask;

		element.header.guid = doorGuid;
		// 2. Get the existing element's data
		err = ACAPI_Element_Get(&amp;amp;element);
		if (err != NoError) { /* Handle error */ }
		err = ACAPI_Element_GetMemo(element.header.guid, &amp;amp;memo, APIMemoMask_All);
		if (err != NoError) { /* Handle error */ }

		// 3. Update the library index
		element.object.libInd = selectedType-&amp;gt;id;

		// 4. Get default parameters for the new library part
		double a, b;
		Int32 parCount;
		API_AddParType** addPars = nullptr;
		err = ACAPI_LibraryPart_GetParams(selectedType-&amp;gt;id, &amp;amp;a, &amp;amp;b, &amp;amp;parCount, &amp;amp;addPars);
		if (err != NoError) { /* Handle error */ }

		// 5. Update memo params
		memo.params = addPars;

		// 6. Apply changes to the element
		ACAPI_ELEMENT_MASK_CLEAR(mask);
		ACAPI_ELEMENT_MASK_SET(mask, API_DoorType, openingBase.libInd); // Or other relevant masks
		err = ACAPI_Element_Change(&amp;amp;element, &amp;amp;mask, &amp;amp;memo, APIMemoMask_AddPars, true);
		if (err != NoError) {
			ACAPI_WriteReport(GS::UniString::Printf("Failed to change door element %s. Error: %d",
				element.header.guid, err), false);
		}
		else
		{
			finalCount++;
		}

		// 7. Dispose of handles
		ACAPI_DisposeElemMemoHdls(&amp;amp;memo);
	}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;And don't forget to put it in a&amp;nbsp;&lt;FONT color="#FF6600"&gt;ACAPI_CallUndoableCommand&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 29 Jul 2025 08:31:00 GMT</pubDate>
    <dc:creator>LeanArc</dc:creator>
    <dc:date>2025-07-29T08:31:00Z</dc:date>
    <item>
      <title>Get/set door types</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Get-set-door-types/m-p/670809#M10507</link>
      <description>&lt;P&gt;I'm starting to learn the Archicad API and could use some help getting started, as there isn't much documentation available.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Specifically, I'd like to know how to retrieve all the available door types in a project and how to assign a door type to a door.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jul 2025 04:50:15 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Get-set-door-types/m-p/670809#M10507</guid>
      <dc:creator>LeanArc</dc:creator>
      <dc:date>2025-07-24T04:50:15Z</dc:date>
    </item>
    <item>
      <title>Re: Get/set door types</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Get-set-door-types/m-p/670810#M10508</link>
      <description>&lt;P&gt;By the way, please show me how to change Door's Marker Type. Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jul 2025 04:52:03 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Get-set-door-types/m-p/670810#M10508</guid>
      <dc:creator>LeanArc</dc:creator>
      <dc:date>2025-07-24T04:52:03Z</dc:date>
    </item>
    <item>
      <title>Re: Get/set door types</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Get-set-door-types/m-p/671001#M10509</link>
      <description>&lt;P&gt;Hi! I agree that the documentation is lacking a bit. I'd suggest to start first with the "Element_Test" example coming with the SDKs. There are some example commands where door elements are accessed. Take a look at that first.&lt;BR /&gt;&lt;BR /&gt;With "changing the type" you mean changing the underlying GDL-object used right? That's quite involved. You'll have to learn to work with Library Parts and then change the associated library part in the door element. Here the "LibPart_Test" example project can give you the first pointers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To list all available door types you'll need to also iterate through all the loaded libraries and the library parts within. The "LibraryManagement_Test" example project might give you ideas.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jul 2025 07:51:21 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Get-set-door-types/m-p/671001#M10509</guid>
      <dc:creator>BerndSchwarzenbacher</dc:creator>
      <dc:date>2025-07-25T07:51:21Z</dc:date>
    </item>
    <item>
      <title>Re: Get/set door types</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Get-set-door-types/m-p/671120#M10510</link>
      <description>&lt;P&gt;I don't have&amp;nbsp;&lt;SPAN&gt;LibraryManagement_Test in my examples. Where can I get it?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Jul 2025 09:58:53 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Get-set-door-types/m-p/671120#M10510</guid>
      <dc:creator>LeanArc</dc:creator>
      <dc:date>2025-07-27T09:58:53Z</dc:date>
    </item>
    <item>
      <title>Re: Get/set door types</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Get-set-door-types/m-p/671184#M10511</link>
      <description>&lt;P&gt;It comes with AC28 DevKits. Previous versions don't have it.&lt;BR /&gt;But "LibPart_Test" also includes some handling of loaded libraries. Search for "APIEnv_GetLibrariesID".&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jul 2025 07:43:00 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Get-set-door-types/m-p/671184#M10511</guid>
      <dc:creator>BerndSchwarzenbacher</dc:creator>
      <dc:date>2025-07-28T07:43:00Z</dc:date>
    </item>
    <item>
      <title>Re: Get/set door types</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Get-set-door-types/m-p/671347#M10512</link>
      <description>&lt;P&gt;Thank you, but I still haven't found a way to distinguish the door type from the other types. Can you please show me how to do that in more detail?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jul 2025 08:26:56 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Get-set-door-types/m-p/671347#M10512</guid>
      <dc:creator>LeanArc</dc:creator>
      <dc:date>2025-07-29T08:26:56Z</dc:date>
    </item>
    <item>
      <title>Re: Get/set door types</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Get-set-door-types/m-p/671349#M10513</link>
      <description>&lt;P&gt;I found a way to change the door library part:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;void __stdcall OnTagType(NativeTypeModel* selectedType)
{
	GS::Array&amp;lt;API_Guid&amp;gt; doorGuids;

	GSErrCode err = ACAPI_Element_GetElemList(API_DoorID, &amp;amp;doorGuids, APIFilt_OnActFloor);
	if (err != NoError) {
		ACAPI_WriteReport("Failed to get door elements list.", true);
		return;
	}
	else
	{
		GS::UniString message = GS::UniString::Printf("Changing %d door elements.", doorGuids.GetSize());
		ACAPI_WriteReport(message, false);
	}

	int finalCount = 0;

	for (const API_Guid&amp;amp; doorGuid : doorGuids) {
		API_Element element;
		API_ElementMemo   memo;
		GSErrCode         err;
		API_Element       mask;

		element.header.guid = doorGuid;
		// 2. Get the existing element's data
		err = ACAPI_Element_Get(&amp;amp;element);
		if (err != NoError) { /* Handle error */ }
		err = ACAPI_Element_GetMemo(element.header.guid, &amp;amp;memo, APIMemoMask_All);
		if (err != NoError) { /* Handle error */ }

		// 3. Update the library index
		element.object.libInd = selectedType-&amp;gt;id;

		// 4. Get default parameters for the new library part
		double a, b;
		Int32 parCount;
		API_AddParType** addPars = nullptr;
		err = ACAPI_LibraryPart_GetParams(selectedType-&amp;gt;id, &amp;amp;a, &amp;amp;b, &amp;amp;parCount, &amp;amp;addPars);
		if (err != NoError) { /* Handle error */ }

		// 5. Update memo params
		memo.params = addPars;

		// 6. Apply changes to the element
		ACAPI_ELEMENT_MASK_CLEAR(mask);
		ACAPI_ELEMENT_MASK_SET(mask, API_DoorType, openingBase.libInd); // Or other relevant masks
		err = ACAPI_Element_Change(&amp;amp;element, &amp;amp;mask, &amp;amp;memo, APIMemoMask_AddPars, true);
		if (err != NoError) {
			ACAPI_WriteReport(GS::UniString::Printf("Failed to change door element %s. Error: %d",
				element.header.guid, err), false);
		}
		else
		{
			finalCount++;
		}

		// 7. Dispose of handles
		ACAPI_DisposeElemMemoHdls(&amp;amp;memo);
	}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;And don't forget to put it in a&amp;nbsp;&lt;FONT color="#FF6600"&gt;ACAPI_CallUndoableCommand&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jul 2025 08:31:00 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Get-set-door-types/m-p/671349#M10513</guid>
      <dc:creator>LeanArc</dc:creator>
      <dc:date>2025-07-29T08:31:00Z</dc:date>
    </item>
  </channel>
</rss>

