Author:gehairing
Posted: Mon Oct 19, 2015 4:49 pm (GMT+1)
I have found out how to manage that.
Thank you Ralph for guiding me.![Smile]()
Here is some testing code that works, hope it can help someone one day.
Now i have to do the real clean code...
Posted: Mon Oct 19, 2015 4:49 pm (GMT+1)
I have found out how to manage that.
Thank you Ralph for guiding me.

Here is some testing code that works, hope it can help someone one day.
Now i have to do the real clean code...
Code: |
static void AddParameterTest (const API_LibPart& libPart) { GSErrCode err; API_LibPartSection section; BNZeroMemory (§ion, sizeof (API_LibPartSection)); section.sectType = API_SectParamDef; GSHandle sectionHdl = NULL; err = ACAPI_LibPart_GetSection(libPart.index, §ion, §ionHdl, NULL); if (err) return; double a, b; Int32 addParNum, i; API_AddParType **addPars; err = ACAPI_LibPart_GetParams (libPart.index, &a, &b, &addParNum, &addPars); if (err) return; // Create enough space for all parameters Int32 myParameterCount = 1; short nPars = addParNum + myParameterCount; API_AddParType** newAddPars = reinterpret_cast<API_AddParType**>(BMAllocateHandle (nPars * sizeof (API_AddParType), ALLOCATE_CLEAR, 0)); if (addPars != NULL) { // Copy all parameters for (i = 0; i < addParNum; i++) { (*newAddPars)[i] = (*addPars)[i]; } // Add our new parameter API_AddParType* pAddPar = &(*newAddPars)[nPars-1]; pAddPar->typeID = APIParT_Mater; pAddPar->typeMod = 0; CHTruncate ("mat", pAddPar->name, sizeof (pAddPar->name)); GS::ucscpy (pAddPar->uDescname, L("Tom's testing parameter")); pAddPar->value.real = 1; // Build a section handle with all parameters GSHandle Sect2DHdl = NULL; err = ACAPI_LibPart_GetSect_ParamDef (&libPart, newAddPars, &a, &b, NULL, §ionHdl); BMKillHandle (reinterpret_cast<GSHandle*>(&newAddPars)); } // Update our section... err = ACAPI_LibPart_UpdateSection (libPart.index, §ion, sectionHdl, NULL); BMKillHandle (§ionHdl); ACAPI_DisposeAddParHdl (&addPars); } |