<?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 How to read parameters of placed GDL panel in Curtian Wall? in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-read-parameters-of-placed-GDL-panel-in-Curtian-Wall/m-p/319924#M1846</link>
    <description>&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;How to read the parameter value of curtain wall panels?&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class=""&gt;&lt;SPAN&gt;Curtain wall panels are made by GDL objects.&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class=""&gt;&lt;SPAN&gt;The usual way&lt;FONT color="#808080"&gt; (ACAPI_Element_GetMemo(guid, &amp;amp;memo, APIMemoMask_AddPars)&lt;/FONT&gt; of reading parameters for objects does not work, because&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class=""&gt;&lt;SPAN&gt;the panels do not have&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt; memo. &lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;Is there an alternative way to read panel parameters?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;GSErrCode GetCWPanelsForCWall(const API_Guid&amp;amp; elemGuid, GS::Array&amp;lt;API_Guid&amp;gt;&amp;amp; panelGuid) {
	GSErrCode			err = NoError;
	API_Elem_Head elementhead = {};
	elementhead.guid = elemGuid;
	err = ACAPI_Element_GetHeader(&amp;amp;elementhead);
	if (err != NoError) return err;
	if (!elementhead.hasMemo) return err;
	API_ElementMemo	memo;
	BNZeroMemory(&amp;amp;memo, sizeof(API_ElementMemo));
	bool isDegenerate;
	err = ACAPI_Element_GetMemo(elemGuid, &amp;amp;memo, APIMemoMask_CWallPanels);
	if (err != NoError) {
		ACAPI_DisposeElemMemoHdls(&amp;amp;memo);
		return err;
	}
	GSSize nPanels = BMGetPtrSize(reinterpret_cast&amp;lt;GSPtr&amp;gt;(memo.cWallPanels)) / sizeof(API_CWPanelType);
	for (Int32 idx = 0; idx &amp;lt; nPanels; ++idx) {
		err = ACAPI_Database(APIDb_IsCWPanelDegenerateID, &amp;amp;memo.cWallPanels[idx].head.guid, &amp;amp;isDegenerate);
		if (!isDegenerate &amp;amp;&amp;amp; memo.cWallPanels[idx].hasSymbol) {
			panelGuid.Push(memo.cWallPanels[idx].symbolID);
			API_Elem_Head panelhead = {};
			panelhead.guid = memo.cWallPanels[idx].symbolID;
			err = ACAPI_Element_GetHeader(&amp;amp;panelhead);
			if (!panelhead.hasMemo) {
				ErrorBeep("ACAPI_Element_GetMemo", err);
			}
		}
	}
	ACAPI_DisposeElemMemoHdls(&amp;amp;memo);
	return err;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 06 Nov 2021 11:23:38 GMT</pubDate>
    <dc:creator>kuvbur</dc:creator>
    <dc:date>2021-11-06T11:23:38Z</dc:date>
    <item>
      <title>How to read parameters of placed GDL panel in Curtian Wall?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-read-parameters-of-placed-GDL-panel-in-Curtian-Wall/m-p/319924#M1846</link>
      <description>&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;How to read the parameter value of curtain wall panels?&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class=""&gt;&lt;SPAN&gt;Curtain wall panels are made by GDL objects.&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class=""&gt;&lt;SPAN&gt;The usual way&lt;FONT color="#808080"&gt; (ACAPI_Element_GetMemo(guid, &amp;amp;memo, APIMemoMask_AddPars)&lt;/FONT&gt; of reading parameters for objects does not work, because&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class=""&gt;&lt;SPAN&gt;the panels do not have&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt; memo. &lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;Is there an alternative way to read panel parameters?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;GSErrCode GetCWPanelsForCWall(const API_Guid&amp;amp; elemGuid, GS::Array&amp;lt;API_Guid&amp;gt;&amp;amp; panelGuid) {
	GSErrCode			err = NoError;
	API_Elem_Head elementhead = {};
	elementhead.guid = elemGuid;
	err = ACAPI_Element_GetHeader(&amp;amp;elementhead);
	if (err != NoError) return err;
	if (!elementhead.hasMemo) return err;
	API_ElementMemo	memo;
	BNZeroMemory(&amp;amp;memo, sizeof(API_ElementMemo));
	bool isDegenerate;
	err = ACAPI_Element_GetMemo(elemGuid, &amp;amp;memo, APIMemoMask_CWallPanels);
	if (err != NoError) {
		ACAPI_DisposeElemMemoHdls(&amp;amp;memo);
		return err;
	}
	GSSize nPanels = BMGetPtrSize(reinterpret_cast&amp;lt;GSPtr&amp;gt;(memo.cWallPanels)) / sizeof(API_CWPanelType);
	for (Int32 idx = 0; idx &amp;lt; nPanels; ++idx) {
		err = ACAPI_Database(APIDb_IsCWPanelDegenerateID, &amp;amp;memo.cWallPanels[idx].head.guid, &amp;amp;isDegenerate);
		if (!isDegenerate &amp;amp;&amp;amp; memo.cWallPanels[idx].hasSymbol) {
			panelGuid.Push(memo.cWallPanels[idx].symbolID);
			API_Elem_Head panelhead = {};
			panelhead.guid = memo.cWallPanels[idx].symbolID;
			err = ACAPI_Element_GetHeader(&amp;amp;panelhead);
			if (!panelhead.hasMemo) {
				ErrorBeep("ACAPI_Element_GetMemo", err);
			}
		}
	}
	ACAPI_DisposeElemMemoHdls(&amp;amp;memo);
	return err;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 06 Nov 2021 11:23:38 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-read-parameters-of-placed-GDL-panel-in-Curtian-Wall/m-p/319924#M1846</guid>
      <dc:creator>kuvbur</dc:creator>
      <dc:date>2021-11-06T11:23:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to read parameters of placed GDL panel in Curtian Wall?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-read-parameters-of-placed-GDL-panel-in-Curtian-Wall/m-p/319990#M1847</link>
      <description>&lt;P&gt;If you have the GUID of the placed library part instance (= GDL based element = symbol), then you can get its parameters by using the&amp;nbsp;APIAny_OpenParametersID,&amp;nbsp;APIAny_GetActParametersID and&amp;nbsp;APIAny_CloseParametersID methods. See the&amp;nbsp;GetGDLParametersOfSymbol function below.&lt;/P&gt;
&lt;P&gt;This works for CWPanels also.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;API_Guid GetSymbolGuidOfCWPanel (const API_CWPanelType&amp;amp; cwPanel)
{
	bool isDegenerate = false;
	ACAPI_Database (APIDb_IsCWPanelDegenerateID, (void*)(&amp;amp;cwPanel.head.guid), &amp;amp;isDegenerate);
	if (isDegenerate || !cwPanel.hasSymbol) {
		return APINULLGuid;
	}

	return cwPanel.symbolID;
}

GSErrCode GetSymbolGuidOfCWPanel (const API_Guid&amp;amp; cwPanelGuid, API_Guid&amp;amp; symbolGuid)
{
	API_Element	elem = {};
	elem.header.guid = cwPanelGuid;

	const GSErrCode err = ACAPI_Element_Get (&amp;amp;elem);
	if (err != NoError) {
		return err;
	}

	symbolGuid = GetSymbolGuidOfCWPanel (elem.cwPanel);
	if (symbolGuid == APINULLGuid) {
		return APIERR_BADPARS;
	}

	return NoError;
}

GSErrCode GetCWPanelSymbolGuidsOfCW (const API_Guid&amp;amp; cwGuid, GS::Array&amp;lt;API_Guid&amp;gt;&amp;amp; panelSymbolGuids)
{
	GSErrCode	err = NoError;

	API_ElementMemo	memo = {};
	err = ACAPI_Element_GetMemo (cwGuid, &amp;amp;memo, APIMemoMask_CWallPanels);
	if (err != NoError) {
		ACAPI_DisposeElemMemoHdls (&amp;amp;memo);
		return err;
	}

	const GSSize nPanels = BMGetPtrSize (reinterpret_cast&amp;lt;GSPtr&amp;gt;(memo.cWallPanels)) / sizeof (API_CWPanelType);
	for (Int32 idx = 0; idx &amp;lt; nPanels; ++idx) {
		const API_Guid symbolGuid = GetSymbolGuidOfCWPanel (memo.cWallPanels[idx]);
		if (symbolGuid != APINULLGuid) {
			panelSymbolGuids.Push (std::move (symbolGuid));
		}
	}

	ACAPI_DisposeElemMemoHdls (&amp;amp;memo);
	return err;
}

GSErrCode GetGDLParametersOfSymbol (const API_Guid&amp;amp; symbolGuid, API_AddParType**&amp;amp; params)
{
	GSErrCode	err = NoError;

	API_ParamOwnerType	apiOwner = {};
	API_GetParamsType	apiParams = {};

	apiOwner.guid = symbolGuid;
	apiOwner.typeID = API_ObjectID;

	err = ACAPI_Goodies (APIAny_OpenParametersID, &amp;amp;apiOwner);
	if (err != NoError) {
		return err;
	}

	err = ACAPI_Goodies (APIAny_GetActParametersID, &amp;amp;apiParams);
	if (err != NoError) {
		return err;
	}

	params = apiParams.params;

	err = ACAPI_Goodies (APIAny_CloseParametersID);

	return err;
}

GSErrCode HandleGDLParameters (API_AddParType** params)
{
	Int32	addParNum = BMGetHandleSize ((GSHandle)params) / sizeof (API_AddParType);
	for (Int32 ii = 0; ii &amp;lt; addParNum; ++ii) {
		API_AddParType&amp;amp; actualParam = (*params)[ii];
		// Do whatever you want with it
		UNUSED_VARIABLE (actualParam);
	}

	return NoError;
}

// -----------------------------------------------------------------------------

void	Do_CWPanelGDLParameters (void)
{
	API_ElemTypeID	typeID;
	API_Guid		clickedElemGuid;
	if (!ClickAnElem ("Click a curtain wall or a cwpanel.", API_ZombieElemID, nullptr, &amp;amp;typeID, &amp;amp;clickedElemGuid)) {
		WriteReport_Alert ("No element was clicked.");
		return;
	}

	GSErrCode err = NoError;
	if (typeID == API_CurtainWallID) {
		GS::Array&amp;lt;API_Guid&amp;gt; cwPanelSymbolGuids;
		err = GetCWPanelSymbolGuidsOfCW (clickedElemGuid, cwPanelSymbolGuids);
		for (const API_Guid&amp;amp; symbolGuid : cwPanelSymbolGuids) {
			API_AddParType** params = {};
			err = GetGDLParametersOfSymbol (symbolGuid, params);
			if (params == nullptr || err != NoError) {
				continue;
			}

			HandleGDLParameters (params);

			ACAPI_DisposeAddParHdl (&amp;amp;params);
		}
	}
	else if (typeID == API_CurtainWallPanelID) {
		API_Guid symbolGuid;

		err = GetSymbolGuidOfCWPanel (clickedElemGuid, symbolGuid);

		API_AddParType** params = {};
		err = GetGDLParametersOfSymbol (symbolGuid, params);
		if (params == nullptr || err != NoError) {
			return;
		}

		HandleGDLParameters (params);

		ACAPI_DisposeAddParHdl (&amp;amp;params);
	}
	else {
		WriteReport_Alert ("The clicked element is not a curtain wall or a cwpanel.");
		return;
	}
}

// -----------------------------------------------------------------------------&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Don't forget that the API_AddParType list returned by the&amp;nbsp;APIAny_GetActParametersID method is just a copy! So if you modify it, then the parameters of the placed element won't be changed automatically. You have to call the ACAPI_Element_ChangeMemo explicitly to modify the parameters of the element:&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;API_ElementMemo	elemMemo = {};
elemMemo.params = params;

ACAPI_Element_ChangeMemo (symbolGuid, APIMemoMask_AddPars, &amp;amp;elemMemo);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Nov 2021 08:05:59 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-read-parameters-of-placed-GDL-panel-in-Curtian-Wall/m-p/319990#M1847</guid>
      <dc:creator>Tibor Lorantfy</dc:creator>
      <dc:date>2021-11-07T08:05:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to read parameters of placed GDL panel in Curtian Wall?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-read-parameters-of-placed-GDL-panel-in-Curtian-Wall/m-p/320214#M1848</link>
      <description>&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;Works great, thanks!&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 09:13:39 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-read-parameters-of-placed-GDL-panel-in-Curtian-Wall/m-p/320214#M1848</guid>
      <dc:creator>kuvbur</dc:creator>
      <dc:date>2021-11-09T09:13:39Z</dc:date>
    </item>
  </channel>
</rss>

