<?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 Help using ACAPI_Element_Change to change Door's &amp;quot;info&amp;quot; in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Help-using-ACAPI-Element-Change-to-change-Door-s-quot-info-quot/m-p/184754#M5266</link>
    <description>&lt;DIV class="actalk-migrated-content"&gt;&lt;STRONG&gt;I'm needing help to change the &lt;U&gt;&lt;/U&gt;&lt;/STRONG&gt;&lt;S&gt;&lt;U&gt;&lt;U&gt;&lt;/U&gt;&lt;/U&gt;&lt;/S&gt;element.door.openingBase.info of all doors. I've been able to use this API function to change a Wall's info but for some reason no luck with Doors&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;API_Element element, mask;&lt;BR /&gt;Int32 nElem;&lt;BR /&gt;GSErrCode err;&lt;BR /&gt;char newID[256];&lt;BR /&gt;bool *suspGrp;&lt;BR /&gt;char msgText[256];&lt;BR /&gt;&lt;BR /&gt;err = ACAPI_OpenUndoableSession ("Create Door Unique IDs");&lt;BR /&gt;&lt;BR /&gt;err = ACAPI_Environment (APIEnv_IsSuspendGroupOnID, &amp;amp;suspGrp, "", "");&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/* suspend group mode */&lt;BR /&gt;if (suspGrp==false)&lt;BR /&gt;err = ACAPI_Element_Tool (NULL, 0, APITool_SuspendGroups, "");&lt;BR /&gt;&lt;BR /&gt;BNZeroMemory (&amp;amp;element, sizeof (API_DoorType));&lt;BR /&gt;&lt;BR /&gt;err = ACAPI_Element_GetNum (API_DoorID, &amp;amp;nElem);&lt;BR /&gt;for (Int32 k = 1; k &amp;lt;= nElem; k++) &lt;BR /&gt;{&lt;BR /&gt;element.header.typeID = API_DoorID;&lt;BR /&gt;element.header.index = k;&lt;BR /&gt;err = ACAPI_Element_Get (&amp;amp;element);&lt;BR /&gt;&lt;BR /&gt;if (err == NoError) {&lt;BR /&gt;&lt;BR /&gt;sprintf (newID, "%s%d", "Door ", k);&lt;BR /&gt;&lt;BR /&gt;ACAPI_ELEMENT_MASK_CLEAR (mask);&lt;BR /&gt;ACAPI_ELEMENT_MASK_SET (mask, API_OpeningBaseType, info); &lt;BR /&gt;CHCopyC(newID, element.door.openingBase.info);&lt;BR /&gt;&lt;BR /&gt;//CHCopyC(element.door.openingBase.info, msgText);&lt;BR /&gt;//DGAlert (DG_INFORMATION, "Unique IDs", msgText, "", "OK","", "");&lt;BR /&gt;&lt;BR /&gt;err = ACAPI_Element_Change (&amp;amp;element, &amp;amp;mask, NULL, 0, true);&lt;BR /&gt;//err = ACAPI_Element_Change (&amp;amp;element, NULL, NULL, 0, true);&lt;BR /&gt;&lt;BR /&gt;if (err) {&lt;BR /&gt;&lt;BR /&gt;WriteReport_Err ("Doors-Create Unique IDs:ACAPI_Element_Change", err);&lt;BR /&gt;err = NoError;&lt;BR /&gt;}&lt;BR /&gt;} &lt;BR /&gt;}&lt;BR /&gt;ACAPI_CloseUndoableSession ();&lt;BR /&gt;}&lt;/DIV&gt;</description>
    <pubDate>Tue, 01 Aug 2023 12:29:30 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-08-01T12:29:30Z</dc:date>
    <item>
      <title>Help using ACAPI_Element_Change to change Door's "info"</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Help-using-ACAPI-Element-Change-to-change-Door-s-quot-info-quot/m-p/184754#M5266</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;&lt;STRONG&gt;I'm needing help to change the &lt;U&gt;&lt;/U&gt;&lt;/STRONG&gt;&lt;S&gt;&lt;U&gt;&lt;U&gt;&lt;/U&gt;&lt;/U&gt;&lt;/S&gt;element.door.openingBase.info of all doors. I've been able to use this API function to change a Wall's info but for some reason no luck with Doors&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;API_Element element, mask;&lt;BR /&gt;Int32 nElem;&lt;BR /&gt;GSErrCode err;&lt;BR /&gt;char newID[256];&lt;BR /&gt;bool *suspGrp;&lt;BR /&gt;char msgText[256];&lt;BR /&gt;&lt;BR /&gt;err = ACAPI_OpenUndoableSession ("Create Door Unique IDs");&lt;BR /&gt;&lt;BR /&gt;err = ACAPI_Environment (APIEnv_IsSuspendGroupOnID, &amp;amp;suspGrp, "", "");&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/* suspend group mode */&lt;BR /&gt;if (suspGrp==false)&lt;BR /&gt;err = ACAPI_Element_Tool (NULL, 0, APITool_SuspendGroups, "");&lt;BR /&gt;&lt;BR /&gt;BNZeroMemory (&amp;amp;element, sizeof (API_DoorType));&lt;BR /&gt;&lt;BR /&gt;err = ACAPI_Element_GetNum (API_DoorID, &amp;amp;nElem);&lt;BR /&gt;for (Int32 k = 1; k &amp;lt;= nElem; k++) &lt;BR /&gt;{&lt;BR /&gt;element.header.typeID = API_DoorID;&lt;BR /&gt;element.header.index = k;&lt;BR /&gt;err = ACAPI_Element_Get (&amp;amp;element);&lt;BR /&gt;&lt;BR /&gt;if (err == NoError) {&lt;BR /&gt;&lt;BR /&gt;sprintf (newID, "%s%d", "Door ", k);&lt;BR /&gt;&lt;BR /&gt;ACAPI_ELEMENT_MASK_CLEAR (mask);&lt;BR /&gt;ACAPI_ELEMENT_MASK_SET (mask, API_OpeningBaseType, info); &lt;BR /&gt;CHCopyC(newID, element.door.openingBase.info);&lt;BR /&gt;&lt;BR /&gt;//CHCopyC(element.door.openingBase.info, msgText);&lt;BR /&gt;//DGAlert (DG_INFORMATION, "Unique IDs", msgText, "", "OK","", "");&lt;BR /&gt;&lt;BR /&gt;err = ACAPI_Element_Change (&amp;amp;element, &amp;amp;mask, NULL, 0, true);&lt;BR /&gt;//err = ACAPI_Element_Change (&amp;amp;element, NULL, NULL, 0, true);&lt;BR /&gt;&lt;BR /&gt;if (err) {&lt;BR /&gt;&lt;BR /&gt;WriteReport_Err ("Doors-Create Unique IDs:ACAPI_Element_Change", err);&lt;BR /&gt;err = NoError;&lt;BR /&gt;}&lt;BR /&gt;} &lt;BR /&gt;}&lt;BR /&gt;ACAPI_CloseUndoableSession ();&lt;BR /&gt;}&lt;/DIV&gt;</description>
      <pubDate>Tue, 01 Aug 2023 12:29:30 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Help-using-ACAPI-Element-Change-to-change-Door-s-quot-info-quot/m-p/184754#M5266</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-08-01T12:29:30Z</dc:date>
    </item>
    <item>
      <title>Re: Help using ACAPI_Element_Change to change Door's "i</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Help-using-ACAPI-Element-Change-to-change-Door-s-quot-info-quot/m-p/184755#M5267</link>
      <description>&lt;BLOCKQUOTE&gt;Bianca wrote:&lt;BR /&gt;&lt;B&gt;I'm needing help to change the &lt;U&gt;&lt;/U&gt;&lt;/B&gt;&lt;S&gt;&lt;B&gt;&lt;U&gt;&lt;U&gt;&lt;/U&gt;&lt;/U&gt;&lt;/B&gt;&lt;/S&gt;element.door.openingBase.info &lt;E&gt;&lt;/E&gt; of all doors.  I've been able to use this API function to change a Wall's info but for some reason no luck with Doors&lt;BR /&gt;
			&lt;BR /&gt;
			ACAPI_ELEMENT_MASK_CLEAR (mask);&lt;BR /&gt;
			ACAPI_ELEMENT_MASK_SET (mask, API_OpeningBaseType, info);  &lt;BR /&gt;
			CHCopyC(newID, element.door.openingBase.info);&lt;BR /&gt;
					&lt;BR /&gt;
}&lt;/BLOCKQUOTE&gt;

Hi Bianca,&lt;BR /&gt;
&lt;BR /&gt;
Please set the mask differently:&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;			ACAPI_ELEMENT_MASK_CLEAR (mask);
			ACAPI_ELEMENT_MASK_SET (mask, API_Element, door.openingBase.info);
			CHTruncate (newID, element.door.openingBase.info, sizeof (element.door.openingBase.info));
&lt;/PRE&gt;

Hope this helps, Akos</description>
      <pubDate>Tue, 01 Jul 2014 08:23:29 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Help-using-ACAPI-Element-Change-to-change-Door-s-quot-info-quot/m-p/184755#M5267</guid>
      <dc:creator>Akos Somorjai</dc:creator>
      <dc:date>2014-07-01T08:23:29Z</dc:date>
    </item>
    <item>
      <title>Re: Help using ACAPI_Element_Change to change Door's "i</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Help-using-ACAPI-Element-Change-to-change-Door-s-quot-info-quot/m-p/184756#M5268</link>
      <description>Hi Bianca, &lt;BR /&gt;
 &lt;BR /&gt;
You have few mistakes in your code, let me correct them: &lt;BR /&gt;
 
&lt;BLOCKQUOTE&gt;Bianca wrote:&lt;BR /&gt;BNZeroMemory (&amp;amp;element, sizeof (&lt;FONT color="red"&gt;API_DoorType&lt;/FONT&gt;));&lt;/BLOCKQUOTE&gt; 
&lt;BLOCKQUOTE&gt;Correction wrote:&lt;BR /&gt;BNZeroMemory (&amp;amp;element, sizeof (&lt;FONT color="lightgreen"&gt;API_Element&lt;/FONT&gt;));&lt;/BLOCKQUOTE&gt; &lt;BR /&gt;
 
&lt;BLOCKQUOTE&gt;Bianca wrote:&lt;BR /&gt;ACAPI_ELEMENT_MASK_SET (mask, &lt;FONT color="red"&gt;API_OpeningBaseType, info&lt;/FONT&gt;);&lt;/BLOCKQUOTE&gt; 
&lt;BLOCKQUOTE&gt;Correction wrote:&lt;BR /&gt;ACAPI_ELEMENT_MASK_SET (mask, &lt;FONT color="lightgreen"&gt;API_DoorType, openingBase.info&lt;/FONT&gt;);&lt;/BLOCKQUOTE&gt; &lt;BR /&gt;
 &lt;BR /&gt;
And I suggest you to don't use old typeID+index identification (it's deprecated and in API18 it will be deleted), please use Guids!&lt;BR /&gt;
Here is your fully corrected code:&lt;BR /&gt;

&lt;PRE&gt;API_Element			element, mask; 
GS::Array&amp;lt;API_Guid&amp;gt;	elemList; 
Int32				nElem = 0; 
GSErrCode			err = NoError; 
char				newID[256]; 
bool				*suspGrp; 
char				msgText[256]; 
 
err = ACAPI_OpenUndoableSession ("Create Door Unique IDs"); 
if (err) 
	WriteReport_Err ("ACAPI_OpenUndoableSession failed", err); 
 
err = ACAPI_Environment (APIEnv_IsSuspendGroupOnID, &amp;amp;suspGrp, "", ""); 
if (err) 
	WriteReport_Err ("APIEnv_IsSuspendGroupOnID failed", err); 
 
/* suspend group mode */  
if (suspGrp == false) { 
	err = ACAPI_Element_Tool (NULL, 0, APITool_SuspendGroups, ""); 
	if (err) 
		WriteReport_Err ("APIEnv_IsSuspendGroupOnID failed", err); 
} 
 
BNZeroMemory (&amp;amp;element, sizeof (API_Element)); 
 
ACAPI_Element_GetElemList (API_DoorID, &amp;amp;elemList); 
for (GS::Array&amp;lt;API_Guid&amp;gt;::ConstIterator it = elemList.Enumerate (); it != NULL; ++it) { 
	element.header.typeID = API_DoorID; 
	element.header.guid = *it; 
 
	err = ACAPI_Element_Get (&amp;amp;element); 
 
	if (err == NoError) { 
		ACAPI_ELEMENT_MASK_CLEAR (mask); 
		ACAPI_ELEMENT_MASK_SET (mask, API_DoorType, openingBase.info); 
 
		sprintf (newID, "%s%d", "Door ", ++nElem); 
		CHCopyC (newID, element.door.openingBase.info); 
 
		err = ACAPI_Element_Change (&amp;amp;element, &amp;amp;mask, NULL, 0, true); 
		if (err) { 
			WriteReport_Err ("Doors-Create Unique IDs:ACAPI_Element_Change", err); 
			err = NoError; 
		} 
	} 
} 
 
ACAPI_CloseUndoableSession ();&lt;/PRE&gt; &lt;BR /&gt;
 &lt;BR /&gt;
Best Regards, &lt;BR /&gt;
Tibor</description>
      <pubDate>Tue, 01 Jul 2014 08:35:29 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Help-using-ACAPI-Element-Change-to-change-Door-s-quot-info-quot/m-p/184756#M5268</guid>
      <dc:creator>Tibor Lorantfy</dc:creator>
      <dc:date>2014-07-01T08:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: Help using ACAPI_Element_Change to change Door's "i</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Help-using-ACAPI-Element-Change-to-change-Door-s-quot-info-quot/m-p/184757#M5269</link>
      <description>Thank you so much for your help.  I learnt a few things from this</description>
      <pubDate>Wed, 02 Jul 2014 00:46:23 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Help-using-ACAPI-Element-Change-to-change-Door-s-quot-info-quot/m-p/184757#M5269</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-07-02T00:46:23Z</dc:date>
    </item>
  </channel>
</rss>

