The Global ARCHICAD Community

Stay informed. Get help. Share your knowledge.

Discussions about using GRAPHISOFT's tools (API DevKit) for independent software developers

Moderators: Karl Ottenstein, LaszloNagy, ejrolon, Barry Kelly, gkmethy, MOREH Tamas, Akos Somorjai, Ed Brown, Mihály Palenik, Tibor Lorántfy

By ufo_ru
#287272
Hello
Help change and save library item settings.
I can change them for the required library element, it is not placed on the plan and not the default tool. From this element, the script GDL then has to get globals.
Code: Select allvoid ModifyGlobParameters (const API_Guid &guid , const UInt32 index , const double &valD1 , const double &valD2 ) { API_ParamOwnerType paramOwner; API_ChangeParamType chgParam; API_GetParamsType getParams; GSErrCode err; BNZeroMemory (&paramOwner, sizeof (API_ParamOwnerType)); BNZeroMemory (&getParams, sizeof (API_GetParamsType)); paramOwner.libInd = index; // !!!! default parameters of a Library Part itself !!!! paramOwner.typeID = API_ObjectID; err = ACAPI_Goodies (APIAny_OpenParametersID, &paramOwner, NULL); if (err == NoError) { BNZeroMemory (&chgParam, sizeof (API_ChangeParamType)); err = ACAPI_Goodies (APIAny_GetActParametersID, &getParams, NULL); if (err == NoError) { chgParam.index = 0; CHCopyC ("Global_ALL_SUMM_K", chgParam.name); chgParam.realValue = valD1; err = ACAPI_Goodies (APIAny_ChangeAParameterID, &chgParam, NULL); if (err == NoError) err = ACAPI_Goodies (APIAny_GetActParametersID, &getParams, NULL); chgParam.index = 0; CHCopyC ("Global_kSum", chgParam.name); chgParam.realValue = valD2; err = ACAPI_Goodies (APIAny_ChangeAParameterID, &chgParam, NULL); if (err == NoError) err = ACAPI_Goodies (APIAny_GetActParametersID, &getParams, NULL); } ACAPI_Goodies (APIAny_CloseParametersID, NULL, NULL); WriteReport ("All OK 1: %lf 2: %lf", (*getParams.params)[2].value.real , (*getParams.params)[3].value.real ); } if (err == NoError) { API_Element element; API_Element mask; API_ElementMemo memo; BNZeroMemory (&element, sizeof (API_Element)); BNZeroMemory (&memo, sizeof (API_ElementMemo)); ACAPI_ELEMENT_MASK_CLEAR (mask); guid; element.header.typeID = API_ObjectID; err = ACAPI_Element_GetDefaults (&element, &memo); ACAPI_ELEMENT_MASK_CLEAR (mask); ACAPI_ELEMENT_MASK_SET (mask, API_ObjectType, libInd); element.object.libInd = index; memo.params = getParams.params; //err =ACAPI_Element_ChangeDefaults (&element, &memo, &mask); //err = ACAPI_Element_Change (&element, &mask, &memo, ); // SAVE ??????? unplaced library item parameters, not default tools } ACAPI_DisposeAddParHdl (&getParams.params); return; }//ModifyLibParameters (void)
User avatar
By Ralph Wessel
#287281
Just to clarify, are you trying to change the parameters of a library part (in the library – not an element instance placed in the project)?
By ufo_ru
#287291
Yes. not an element instance placed in the project.
It seems to me that you need to change the values that are set when creating the library element. The task as a whole is to transfer the values from the API -> GDL Global (LIBRARYGLOBAL)-> Gdl Object
Image
By ufo_ru
#287298
From the API, you need to change the parameters of the biliotech element, this element will not be placed on the plan, and will not be the element of the tool by default.
http://archicadapi.graphisoft.com/docum ... movnertype
Library part default - so I get it, then change it, but I don’t know how to save

Then through the GDL, LIBRARYGLOBAL ("Get_Global", "Global_kSum", kSum) in the desired element.
User avatar
By Akos Somorjai
#287408
From the API, you need to change the parameters of the biliotech element, this element will not be placed on the plan, and will not be the element of the tool by default.
http://archicadapi.graphisoft.com/docum ... movnertype
Library part default - so I get it, then change it, but I don’t know how to save

Then through the GDL, LIBRARYGLOBAL ("Get_Global", "Global_kSum", kSum) in the desired element.
So, then is it a library global that appears in the model view options?

Akos
By ufo_ru
#287411
Yes it is, in the first version of my addon there was a global library element whose parameters were changed through the parameters of the model view. And all this can be implemented without addon with pure GDL properties. But as it turned out, the use of model view parameters in the event that it is not a graphical display that depends on it, but quantitative measurements are not the best solution. It is difficult to track the parameters of the model view, especially in interactive catalogs. Therefore, I decided to develop a second version of the addon where the global element will be changed not through GDL, but through the API, especially since I still created a modal window for the addon parameters. As can be seen from the code, I found this global library element made a change in its parameters, but I can not save it.

In short, it is necessary to change the parameters of the global library element from the API, after which the GDL script of library elements considers them.