Author:gehairing
Posted: Mon Oct 19, 2015 3:36 pm (GMT+1)
Thanks Ralph. I'll try to find how to do what you've explained.
After my previous message i have tried following :
Creating a "dump" code :
(completely based on sample code i found in the API doc)
Called this method to dump all parameters before my code :
Then i run this code (the same as in my previous message) to "add" a parameter :
Then run the dump code again :
"mat" is the one i "added".
So It seem's to me that i have lost (or destroyed or whatever
)some parameters but not all.
Posted: Mon Oct 19, 2015 3:36 pm (GMT+1)
Thanks Ralph. I'll try to find how to do what you've explained.
After my previous message i have tried following :
Creating a "dump" code :
(completely based on sample code i found in the API doc)
Code: |
static void DumpParameters (Int32 libInd, API_LibTypeID typeID) { API_LibPartDetails details; double a, b; Int32 addParNum, i, ind, i1, i2; API_AddParType **addPars; double value; char *valueStr; GSErrCode err; err = ACAPI_LibPart_GetParams (libInd, &a, &b, &addParNum, &addPars); if (err) return; for (i = 0; i < addParNum; i++) { if ((*addPars)[i].typeMod == API_ParSimple) { ACAPI_WriteReport ((*addPars)[i].name, false); } else { ind = 0; ACAPI_WriteReport ((*addPars)[i].name, false); for (i1 = 1; i1 <= (*addPars)[i].dim1; i1++) { for (i2 = 1; i2 <= (*addPars)[i].dim2; i2++) { if ((*addPars)[i].typeID != APIParT_CString) { value = (Int32) ((double *) *(*addPars)[i].value.array) [ind]; valueStr = NULL; ind ++; } else { value = 0.0; valueStr = *(*addPars)[i].value.array + ind; ind += strlen (valueStr) + 1; } ACAPI_WriteReport (valueStr, false); } } } } ACAPI_DisposeAddParHdl (&addPars); } |
Called this method to dump all parameters before my code :
Code: |
A B ZZYZX AC_show2DHotspotsIn3D ac_bottomlevel ac_toplevel showerType services matFinish SKU gs_2D_representation gs_cont_pen gs_fill_type gs_fill_pen gs_back_pen gs_list gs_list_cost gs_list_manufacturer gs_list_note gs_list_location gs_list_accessories FM_Type iFMType FM_InventoryNumber FM_SerialNumber FM_ProductionYear FM_ObjectWeight FM_ObjectWeightUnit gs_list_custom1 gs_list_custom2 gs_list_custom3 gs_list_custom4 gs_list_custom5 gs_3D_representation gs_detlevel_3D gs_shadow doorOpen |
Then i run this code (the same as in my previous message) to "add" a parameter :
Code: |
// Set parameters to the given libPart void TestSetParameters(const API_LibPart& libPart) { // Add parameters/properties for this object API_LibPartSection section; BNZeroMemory (§ion, sizeof (API_LibPartSection)); section.sectType = API_SectParamDef; GSHandle sectionHdl = NULL; GSErrCode err = ACAPI_LibPart_GetSection(libPart.index, §ion, §ionHdl, NULL); short nPars = 1; API_AddParType** addPars = reinterpret_cast<API_AddParType**>(BMAllocateHandle (nPars * sizeof (API_AddParType), ALLOCATE_CLEAR, 0)); if (addPars != NULL) { API_AddParType* pAddPar = &(*addPars)[0]; 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; double aa = 1.0; double bb = 1.0; GSHandle Sect2DHdl = NULL; err = ACAPI_LibPart_GetSect_ParamDef (&libPart, addPars, &aa, &bb, Sect2DHdl, §ionHdl); BMKillHandle (reinterpret_cast<GSHandle*>(&addPars)); } err = ACAPI_LibPart_UpdateSection (libPart.index, §ion, sectionHdl, NULL); BMKillHandle (§ionHdl); } |
Then run the dump code again :
Code: |
A B ZZYZX AC_show2DHotspotsIn3D ac_bottomlevel ac_toplevel gs_2D_representation gs_cont_pen gs_fill_type gs_fill_pen gs_back_pen gs_list gs_list_cost gs_list_manufacturer gs_list_note gs_list_location gs_list_accessories FM_Type iFMType FM_InventoryNumber FM_SerialNumber FM_ProductionYear FM_ObjectWeight FM_ObjectWeightUnit gs_list_custom1 gs_list_custom2 gs_list_custom3 gs_list_custom4 gs_list_custom5 mat |
"mat" is the one i "added".
So It seem's to me that i have lost (or destroyed or whatever
