<?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: Delete Specific Hotlink Element (Not HotlinkNode) in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Delete-Specific-Hotlink-Element-Not-HotlinkNode/m-p/602650#M9332</link>
    <description>&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;[Update]&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;I realized that the hotlink module are somewhat group of elements that is why I tried getting the group elements and delete those elements.&lt;BR /&gt;However, It did work in one of my hotlink but not with my other hotlinks. Not sure why it was not returning any group elements(Empty GS::Array&amp;lt;API_Guid&amp;gt;) based on the hotlink group id when using&amp;nbsp;&lt;STRONG&gt;ACAPI_Grouping_GetGroupedElems()&lt;/STRONG&gt;&lt;BR /&gt;Still not sure what is the best approach to successfully delete a placed Hotlink.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Here is my current code:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;// Get all hotlink elements
GS::Array&amp;lt;API_Guid&amp;gt; elemGuidList;
err = ACAPI_Element_GetElemList(API_HotlinkID, &amp;amp;elemGuidList);
DBPrintf("Number of found element type: %ld\n", elemGuidList.GetSize());
if (err != NoError) return err;

API_Element  element;
GSErrCode elemErr;
std::vector&amp;lt;API_Element&amp;gt; elemList;
for (GS::Array&amp;lt;API_Guid&amp;gt;::ConstIterator it = elemGuidList.Enumerate(); it != nullptr; ++it)
{
	BNZeroMemory(&amp;amp;element, sizeof(API_Element));
	element.header.guid = *it;
	elemErr = ACAPI_Element_Get(&amp;amp;element);
	if (elemErr == NoError)
	{
		elemList.push_back(element);

		DBPrintf("2D Hotlink Group Guid: %s\n", APIGuidToString(element.hotlink.hotlinkGroupGuid).ToCStr().Get());
		GS::Array&amp;lt;API_Guid&amp;gt; deleteGuids = {};
		err = ACAPI_Grouping_GetGroupedElems(element.hotlink.hotlinkGroupGuid, &amp;amp;deleteGuids);
		if (err != NoError) return err;
		err = ACAPI_CallUndoableCommand("Element Test - Delete 2D HLM Elements", [&amp;amp;]() -&amp;gt; GSErrCode {
			return ACAPI_Element_Delete(deleteGuids);
			});
		if (err != NoError) return err;

	}
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;Can be deleted: 2RF2-1.mod&lt;BR /&gt;Cannot be deleted: 3R-1.mod&lt;/P&gt;</description>
    <pubDate>Sun, 05 May 2024 16:10:26 GMT</pubDate>
    <dc:creator>kristkun</dc:creator>
    <dc:date>2024-05-05T16:10:26Z</dc:date>
    <item>
      <title>Delete Specific Hotlink Element (Not HotlinkNode)</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Delete-Specific-Hotlink-Element-Not-HotlinkNode/m-p/602626#M9330</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I am trying to delete the Hotlink Element via API using&amp;nbsp;ACAPI_Element_Delete with NoError(0) results but the Hotlink elements were not deleted in my project.&lt;BR /&gt;&lt;BR /&gt;My end goal is to delete hotlink elements on specific floors. I don't want to delete all hotlink referenced to a single source/Hotlink Node.&lt;BR /&gt;&lt;BR /&gt;I initially tried to use&amp;nbsp;ACAPI_Element_Delete() to delete all hotlink elements based on their element guids.&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt; (err==0)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;// Get all Hotlink elements
GS::Array&amp;lt;API_Guid&amp;gt; elemGuidList;
err = ACAPI_Element_GetElemList(API_HotlinkID, &amp;amp;elemGuidList);
if (err != NoError) return err;

// Delete all Hotlink elements
err = ACAPI_CallUndoableCommand("Element Test - Delete 2D HLM Element", [&amp;amp;]() -&amp;gt; GSErrCode {
				return ACAPI_Element_Delete(elemGuidList);
});
if (err != NoError) return err;
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="kristkun_0-1714846987012.png" style="width: 400px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/60456i10FB9A9094BEE868/image-size/medium?v=v2&amp;amp;px=400" role="button" title="kristkun_0-1714846987012.png" alt="kristkun_0-1714846987012.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;But after i executed the process/code. the element still exist in my project&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="kristkun_1-1714847057034.png" style="width: 400px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/60457i875B89D0558A2D27/image-size/medium?v=v2&amp;amp;px=400" role="button" title="kristkun_1-1714847057034.png" alt="kristkun_1-1714847057034.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;I already tried using&amp;nbsp;ACAPI_Hotlink_DeleteHotlinkNode() but again, this method will delete all elements that uses/referenced to that hotlink node(I dont need to delete all hotlink elements based on the hotlink node)&lt;BR /&gt;&lt;BR /&gt;Any Idea how can i delete specific hotlink element Example there are 2 hotlink element in ground floor and first floor(story) using the same hotlink source, I only want to delete the hotlink in first floor(Story) [Which is possible using Archicad software/done manually]&lt;/P&gt;</description>
      <pubDate>Tue, 17 Sep 2024 09:04:35 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Delete-Specific-Hotlink-Element-Not-HotlinkNode/m-p/602626#M9330</guid>
      <dc:creator>kristkun</dc:creator>
      <dc:date>2024-09-17T09:04:35Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Specific Hotlink Element (Not HotlinkNode)</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Delete-Specific-Hotlink-Element-Not-HotlinkNode/m-p/602650#M9332</link>
      <description>&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;[Update]&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;I realized that the hotlink module are somewhat group of elements that is why I tried getting the group elements and delete those elements.&lt;BR /&gt;However, It did work in one of my hotlink but not with my other hotlinks. Not sure why it was not returning any group elements(Empty GS::Array&amp;lt;API_Guid&amp;gt;) based on the hotlink group id when using&amp;nbsp;&lt;STRONG&gt;ACAPI_Grouping_GetGroupedElems()&lt;/STRONG&gt;&lt;BR /&gt;Still not sure what is the best approach to successfully delete a placed Hotlink.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Here is my current code:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;// Get all hotlink elements
GS::Array&amp;lt;API_Guid&amp;gt; elemGuidList;
err = ACAPI_Element_GetElemList(API_HotlinkID, &amp;amp;elemGuidList);
DBPrintf("Number of found element type: %ld\n", elemGuidList.GetSize());
if (err != NoError) return err;

API_Element  element;
GSErrCode elemErr;
std::vector&amp;lt;API_Element&amp;gt; elemList;
for (GS::Array&amp;lt;API_Guid&amp;gt;::ConstIterator it = elemGuidList.Enumerate(); it != nullptr; ++it)
{
	BNZeroMemory(&amp;amp;element, sizeof(API_Element));
	element.header.guid = *it;
	elemErr = ACAPI_Element_Get(&amp;amp;element);
	if (elemErr == NoError)
	{
		elemList.push_back(element);

		DBPrintf("2D Hotlink Group Guid: %s\n", APIGuidToString(element.hotlink.hotlinkGroupGuid).ToCStr().Get());
		GS::Array&amp;lt;API_Guid&amp;gt; deleteGuids = {};
		err = ACAPI_Grouping_GetGroupedElems(element.hotlink.hotlinkGroupGuid, &amp;amp;deleteGuids);
		if (err != NoError) return err;
		err = ACAPI_CallUndoableCommand("Element Test - Delete 2D HLM Elements", [&amp;amp;]() -&amp;gt; GSErrCode {
			return ACAPI_Element_Delete(deleteGuids);
			});
		if (err != NoError) return err;

	}
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;Can be deleted: 2RF2-1.mod&lt;BR /&gt;Cannot be deleted: 3R-1.mod&lt;/P&gt;</description>
      <pubDate>Sun, 05 May 2024 16:10:26 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Delete-Specific-Hotlink-Element-Not-HotlinkNode/m-p/602650#M9332</guid>
      <dc:creator>kristkun</dc:creator>
      <dc:date>2024-05-05T16:10:26Z</dc:date>
    </item>
  </channel>
</rss>

