Developer forum
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!