ACAPI_Element_RefreshElement() doesn't work on AC27
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2023-10-20
04:15 AM
- last edited on
‎2024-05-31
12:07 PM
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.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2024-06-14 08:29 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2023-12-15 06:02 PM
I forgot to mention something important.
It's a windows version.
API Development Kit 27.3001
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2024-06-12 05:39 AM
Hi,
Please update your AC27 to the latest version (27.2.1) and check it again.
HTH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2024-06-13 05:06 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2024-06-13
08:20 AM
- last edited on
‎2024-06-19
02:41 AM
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);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2024-06-13 06:35 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2024-06-14 06:13 AM
Thank you for providing the workaround.
By the way, will the issue of "ACAPI_Element_RefreshElement()" not working properly in Archicad27 be fixed?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2024-06-14 08:29 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2024-06-14 07:25 PM
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.