BIM Coordinator Program (INT) April 22, 2024

Find the next step in your career as a Graphisoft Certified BIM Coordinator!

Archicad C++ API
About Archicad add-on development using the C++ API.

Error on Update Library Part

gehairing
Participant

Hello all

 

It's a long time i didn't work on Archicad API. It's fun to be back here 😉

 

I have a problem when i try to update the parameter section of a library part.

To illustrate this i have made a simplified code i put below the message.

 

Everything is OK until the ACAPI_LibPart_UpdateSection call at the end.
This call returns this error : APIERR_BADPARS : -2130313112 : The passed parameters are inconsistent.

 

In my real code i add & 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.

 

Does someone had something like this ?

 

Thanks,

 

Georges

 

// Experimental function for addPar updates
void BACDownload::TestParameterUpdates(API_LibPart& libPart)
{
	// Get the library part
	GSErrCode err = ACAPI_LibPart_Get(&libPart);
	if (err == NoError)
	{
		if (libPart.location != NULL)
		{
			delete libPart.location;
			libPart.location = NULL;
		}
	}

	// Define a parameter section
	API_LibPartSection section;
	BNZeroMemory(&section, sizeof(API_LibPartSection));
	section.sectType = API_SectParamDef;

	// Get parameter section
	GSHandle sectionHdl = NULL;
	err = ACAPI_LibPart_GetSection(libPart.index, &section, &sectionHdl, NULL);
	if (err) return;

	// Get current parameters
	double a, b;
	Int32 addParNum, i;
	API_AddParType** addPars;
	err = ACAPI_LibPart_GetParams(libPart.index, &a, &b, &addParNum, &addPars);
	if (err) return;
	
	// ..
	// Do nothing with the parameters
	// ..

	// Build a section handle with all parameters
	GSHandle Sect2DDrawHdl = NULL;
	err = ACAPI_LibPart_GetSect_ParamDef(&libPart, addPars, &a, &b, Sect2DDrawHdl, &sectionHdl);

	// Update our section
	err = ACAPI_LibPart_UpdateSection(libPart.index, &section, sectionHdl, NULL);
	// NOTE : Here above i get and error : APIERR_BADPARS :	-2130313112 : The passed parameters are inconsistent.

	BMKillHandle(&sectionHdl);
	ACAPI_DisposeAddParHdl(&addPars);
}

 

0 REPLIES 0
Learn and get certified!