2013-08-01 07:35 AM - last edited on 2023-05-23 04:38 PM by Rubia Torres
GSErrCode ChangeElementParameter (API_ElemTypeID elementType, long elementIndex, const char* name, double value) { GSErrCode err = NoError; API_ParamOwnerType paramOwner; API_Element element, mask; API_ElementMemo memo; char msgStr[256]; BNZeroMemory (¶mOwner, sizeof (API_ParamOwnerType)); paramOwner.libInd = 0; paramOwner.typeID = elementType; paramOwner.index = elementIndex; err = ACAPI_Goodies (APIAny_OpenParametersID, ¶mOwner, NULL); if (err == NoError) { API_ChangeParamType chgParam; BNZeroMemory (&chgParam, sizeof (API_ChangeParamType)); CHCopyC (name, chgParam.name); chgParam.realValue = value; err = ACAPI_Goodies (APIAny_ChangeAParameterID, &chgParam, NULL); if (err == NoError) { API_GetParamsType getParams; BNZeroMemory (&getParams, sizeof (API_GetParamsType)); err = ACAPI_Goodies (APIAny_GetActParametersID, &getParams, NULL); if (err == NoError) { BNZeroMemory (&element, sizeof (API_Element)); BNZeroMemory (&mask, sizeof (API_Element)); BNZeroMemory (&memo, sizeof (API_ElementMemo)); element.header.typeID = elementType; element.header.index = elementIndex; memo.params = getParams.params; err = ACAPI_Element_Change (&element, &mask, &memo, APIMemoMask_AddPars, true); if (err != NoError) { sprintf(msgStr, "Error in ACAPI_Element_Change: %li", err); ACAPI_WriteReport(msgStr, false); } } else { sprintf(msgStr, "Error in APIAny_GetActParametersID: %li", err); ACAPI_WriteReport(msgStr, false); } ACAPI_DisposeAddParHdl(&getParams.params); } else { sprintf(msgStr, "Error in APIAny_ChangeAParameterID: %li", err); ACAPI_WriteReport(msgStr, false); } err = ACAPI_Goodies (APIAny_CloseParametersID, NULL, NULL); } else { sprintf(msgStr, "Error in APIAny_OpenParametersID: %li", err); ACAPI_WriteReport(msgStr, false); } return err; }Any clues on changing GDL parameters on Zone Stamps correctly?
2013-09-02 10:35 AM
API_ZoneID :
beside the setting parameters the following fields can be edited:
libInd, pos and the polygon of the zone (coords, pends, parcs, vertexIDs memo handles)
GSErrCode ChangeElementParameter (API_ElemTypeID elementType, long elementIndex, const char* name, double value) { API_ParamOwnerType paramOwner; API_ChangeParamType chgParam; API_GetParamsType getParams; API_Element element, mask; API_ElementMemo memo; GSErrCode err; char msgStr[256]; BNZeroMemory (¶mOwner, sizeof (API_ParamOwnerType)); paramOwner.libInd = 0; paramOwner.typeID = elementType; paramOwner.index = elementIndex; BNZeroMemory (&getParams, sizeof (API_GetParamsType)); err = ACAPI_Goodies (APIAny_OpenParametersID, ¶mOwner, NULL); if (err == NoError) { BNZeroMemory (&chgParam, sizeof (API_ChangeParamType)); err = ACAPI_Goodies (APIAny_GetActParametersID, &getParams, NULL); if (err == NoError) { chgParam.index = 0; CHCopyC (name, chgParam.name); chgParam.realValue = value; err = ACAPI_Goodies (APIAny_ChangeAParameterID, &chgParam, NULL); if (err == NoError) { err = ACAPI_Goodies (APIAny_GetActParametersID, &getParams, NULL); if (err != NoError) { sprintf(msgStr, "Error in APIAny_GetActParametersID"); ACAPI_WriteReport(msgStr, false); } } else { sprintf(msgStr, "Error in APIAny_ChangeAParameterID"); ACAPI_WriteReport(msgStr, false); } } else { sprintf(msgStr, "Error in APIAny_GetActParametersID"); ACAPI_WriteReport(msgStr, false); } ACAPI_Goodies (APIAny_CloseParametersID, NULL, NULL); } else { sprintf(msgStr, "Error in APIAny_OpenParametersID"); ACAPI_WriteReport(msgStr, false); } if (err == NoError) { BNZeroMemory (&element, sizeof (API_Element)); BNZeroMemory (&memo, sizeof (API_ElementMemo)); element.header.typeID = elementType; element.header.index = elementIndex; ACAPI_ELEMENT_MASK_CLEAR (mask); memo.params = getParams.params; err = ACAPI_Element_Change (&element, &mask, &memo, APIMemoMask_AddPars, true); if (err != NoError) { sprintf(msgStr, "Error in ACAPI_Element_Change"); ACAPI_WriteReport(msgStr, false); } } ACAPI_DisposeAddParHdl (&getParams.params); return err; }
bool force = true; err = ACAPI_Database (APIDb_RefreshElementID, &elem.header, &force);Regards,
2013-10-01 08:29 AM
ACAPI_Element_GetElemList(API_ObjectID, &elemList)It is the stamp object that I am changing, not the zone itself.
element.header.guid = *it; err = ACAPI_Element_Get (&element);If I include the following BEFORE calling the ChangeElementParameter function, the zone stamp will allow me to change the custom parameter. If I remove this code it will not allow me to change the custom parameter.
err = ACAPI_Element_Change (&element, &mask, NULL, 0, true);I understand that API_ZoneID cannot change additional custom parameters, but this is API_ObjectID.
2013-10-02 03:48 PM
Tibor wrote:We're changing zone parameters with
You can read in the documentation of ACAPI_Element_Change function that for each element type which fields can be edited:API_ZoneID :
beside the setting parameters the following fields can be edited:
libInd, pos and the polygon of the zone (coords, pends, parcs, vertexIDs memo handles)
So as you can see, unfortunately the params field cannot be edited, that's why it gives you APIERR_NOTSUPPORTED.