<?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 Error on Update Library Part in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Error-on-Update-Library-Part/m-p/307767#M1765</link>
    <description>&lt;P&gt;Hello all&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's a long time i didn't work on Archicad API. It's fun to be back here&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a problem when i try to update the parameter section of a library part.&lt;/P&gt;&lt;P&gt;To illustrate this i have made a simplified code i put below the message.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Everything is OK until the ACAPI_LibPart_UpdateSection call at the end.&lt;BR /&gt;This call returns this error :&amp;nbsp;APIERR_BADPARS : -2130313112 : The passed parameters are inconsistent.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my real code i add &amp;amp; modify parameters. In this sample, to eliminate my errors during these operations, i don't modify the parameters at all wich gives the same problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does someone had something like this ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Georges&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;// Experimental function for addPar updates
void BACDownload::TestParameterUpdates(API_LibPart&amp;amp; libPart)
{
	// Get the library part
	GSErrCode err = ACAPI_LibPart_Get(&amp;amp;libPart);
	if (err == NoError)
	{
		if (libPart.location != NULL)
		{
			delete libPart.location;
			libPart.location = NULL;
		}
	}

	// Define a parameter section
	API_LibPartSection section;
	BNZeroMemory(&amp;amp;section, sizeof(API_LibPartSection));
	section.sectType = API_SectParamDef;

	// Get parameter section
	GSHandle sectionHdl = NULL;
	err = ACAPI_LibPart_GetSection(libPart.index, &amp;amp;section, &amp;amp;sectionHdl, NULL);
	if (err) return;

	// Get current parameters
	double a, b;
	Int32 addParNum, i;
	API_AddParType** addPars;
	err = ACAPI_LibPart_GetParams(libPart.index, &amp;amp;a, &amp;amp;b, &amp;amp;addParNum, &amp;amp;addPars);
	if (err) return;
	
	// ..
	// Do nothing with the parameters
	// ..

	// Build a section handle with all parameters
	GSHandle Sect2DDrawHdl = NULL;
	err = ACAPI_LibPart_GetSect_ParamDef(&amp;amp;libPart, addPars, &amp;amp;a, &amp;amp;b, Sect2DDrawHdl, &amp;amp;sectionHdl);

	// Update our section
	err = ACAPI_LibPart_UpdateSection(libPart.index, &amp;amp;section, sectionHdl, NULL);
	// NOTE : Here above i get and error : APIERR_BADPARS :	-2130313112 : The passed parameters are inconsistent.

	BMKillHandle(&amp;amp;sectionHdl);
	ACAPI_DisposeAddParHdl(&amp;amp;addPars);
}
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 29 Sep 2021 06:45:14 GMT</pubDate>
    <dc:creator>gehairing</dc:creator>
    <dc:date>2021-09-29T06:45:14Z</dc:date>
    <item>
      <title>Error on Update Library Part</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Error-on-Update-Library-Part/m-p/307767#M1765</link>
      <description>&lt;P&gt;Hello all&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's a long time i didn't work on Archicad API. It's fun to be back here&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a problem when i try to update the parameter section of a library part.&lt;/P&gt;&lt;P&gt;To illustrate this i have made a simplified code i put below the message.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Everything is OK until the ACAPI_LibPart_UpdateSection call at the end.&lt;BR /&gt;This call returns this error :&amp;nbsp;APIERR_BADPARS : -2130313112 : The passed parameters are inconsistent.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my real code i add &amp;amp; modify parameters. In this sample, to eliminate my errors during these operations, i don't modify the parameters at all wich gives the same problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does someone had something like this ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Georges&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;// Experimental function for addPar updates
void BACDownload::TestParameterUpdates(API_LibPart&amp;amp; libPart)
{
	// Get the library part
	GSErrCode err = ACAPI_LibPart_Get(&amp;amp;libPart);
	if (err == NoError)
	{
		if (libPart.location != NULL)
		{
			delete libPart.location;
			libPart.location = NULL;
		}
	}

	// Define a parameter section
	API_LibPartSection section;
	BNZeroMemory(&amp;amp;section, sizeof(API_LibPartSection));
	section.sectType = API_SectParamDef;

	// Get parameter section
	GSHandle sectionHdl = NULL;
	err = ACAPI_LibPart_GetSection(libPart.index, &amp;amp;section, &amp;amp;sectionHdl, NULL);
	if (err) return;

	// Get current parameters
	double a, b;
	Int32 addParNum, i;
	API_AddParType** addPars;
	err = ACAPI_LibPart_GetParams(libPart.index, &amp;amp;a, &amp;amp;b, &amp;amp;addParNum, &amp;amp;addPars);
	if (err) return;
	
	// ..
	// Do nothing with the parameters
	// ..

	// Build a section handle with all parameters
	GSHandle Sect2DDrawHdl = NULL;
	err = ACAPI_LibPart_GetSect_ParamDef(&amp;amp;libPart, addPars, &amp;amp;a, &amp;amp;b, Sect2DDrawHdl, &amp;amp;sectionHdl);

	// Update our section
	err = ACAPI_LibPart_UpdateSection(libPart.index, &amp;amp;section, sectionHdl, NULL);
	// NOTE : Here above i get and error : APIERR_BADPARS :	-2130313112 : The passed parameters are inconsistent.

	BMKillHandle(&amp;amp;sectionHdl);
	ACAPI_DisposeAddParHdl(&amp;amp;addPars);
}
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Sep 2021 06:45:14 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Error-on-Update-Library-Part/m-p/307767#M1765</guid>
      <dc:creator>gehairing</dc:creator>
      <dc:date>2021-09-29T06:45:14Z</dc:date>
    </item>
  </channel>
</rss>

