2023-10-20
04:15 AM
- last edited
a month ago
by
Doreena Deng
blnForce = true;
err = ACAPI_Element_RefreshElement( &element.header, &blnForce);
//It worked on AC26 but not on AC27
//Please tell me how to deal with it
//note)element is GDL with script
Solved! Go to Solution.
2 weeks ago
My understanding is that this solution is not a workaround. You shouldn't need an extra parameter script call when you place an element.
Looking at the source code, the function internally calls the parameter script with your parametrization, so I don't know what else to fix. Do you receive any errors?
Best, Akos
2023-12-04 08:41 AM
Additional notes)
If replaced with 'ACAPI_Element_SetElementURLRef()' one step above in ACAPI_Database.h, no error will occur.
2023-12-15 06:02 PM
I forgot to mention something important.
It's a windows version.
API Development Kit 27.3001
3 weeks ago
Hi,
Please update your AC27 to the latest version (27.2.1) and check it again.
HTH
3 weeks ago
Archicad27 updated to version 27.2.1.
The error no longer occurs when calling up the function, but it is no longer functioning.
//bool force = true;
//err = ACAPI_Element_RefreshElement( &element.header, &force);
force = true : rebuild for GDL based elements (run parameter script).
is not work.
3 weeks ago
- last edited
2 weeks ago
by
Laszlo Nagy
API_Element element;
API_ElementMemo memo;
BNZeroMemory(&element, sizeof(API_Element));
BNZeroMemory(&memo, sizeof(API_ElementMemo));
element.header.type.typeID = API_ObjectID;
err = ACAPI_Element_GetDefaults(&element, &memo);
element.header.layer = Lind;
element.header.floorInd = Find;
element.object.libInd = LibIndex;
element.object.reflected = false;
element.object.pos = PosXY;
element.object.level = PosZ;
element.object.angle = 0;
API_ParamOwnerType paramOwner;
BNZeroMemory(¶mOwner, sizeof(API_ParamOwnerType));
paramOwner.libInd = LibIndex;
err = ACAPI_LibraryPart_OpenParameters( ¶mOwner);
if (err == NoError) {
API_GetParamsType getParams;
BNZeroMemory(&getParams, sizeof(API_GetParamsType));
err = ACAPI_LibraryPart_GetActParameters(&getParams);
if (err == NoError) {
ACAPI_DisposeAddParHdl(&memo.params);
memo.params = getParams.params;
(*memo.params)[ParaIndex + 0].value.real = EndX;
(*memo.params)[ParaIndex + 1].value.real = EndY;
(*memo.params)[ParaIndex + 2].value.real = EndZ;
}
ACAPI_LibraryPart_CloseParameters();
}
err = ACAPI_Element_Create(&element, &memo);
bool blnForce = true;
err = ACAPI_Element_RefreshElement( &element.header, &blnForce);
ACAPI_DisposeElemMemoHdls(&memo);
3 weeks ago
Hi,
There's no need to call RefreshElement in this case; the element creation handles that.
If that doesn't work, you can try the other way around:
- get original parameters from the library part (you may do that with `ACAPI_LibraryPart_GetParams()`, then you don't have to call OpenParameters/CloseParameters)
- create the element with those default parameters
- call ACAPI_LibraryPart_OpenParameters / ChangeAParameter / CloseParameters on the newly created object (fill the `guid` field instead of `libInd` in API_ParamOwnerType) → this ensures the parameter consistency
Best, Akos
2 weeks ago
Thank you for providing the workaround.
By the way, will the issue of "ACAPI_Element_RefreshElement()" not working properly in Archicad27 be fixed?
2 weeks ago
My understanding is that this solution is not a workaround. You shouldn't need an extra parameter script call when you place an element.
Looking at the source code, the function internally calls the parameter script with your parametrization, so I don't know what else to fix. Do you receive any errors?
Best, Akos
2 weeks ago
So the way the parameters were processed when creating the object was wrong in the first place.
I'll try reconstructing it.
If that doesn't work, I'll ask for your advice again.
note)
In the previous program,
In AC27.2.1, there is no error (NoError), but the GDL is not refreshed.