BIM Coordinator Program (INT) April 22, 2024
Find the next step in your career as a Graphisoft Certified BIM Coordinator!
Archicad C++ API
About Archicad add-on development using the C++ API.

Window/Door Heigth/Width change

Anonymous
Not applicable
I would like to change w/h of an existing window or set up default tool with proper w/h. I thought it will be an easy thing. But it seem more tricky thing.

Mostly I was trying to change API_OpeningBaseType parameters based on Do_ChangeElem form Element_test. But in the case of empty opening, it doesn't work. I case of Window it detaches opening from LibPart - there are two sets of points for opening and for LibPart.

I was also trying to change GDL properties - A and B in particluar. But not much achieved here only errors about the inconsistency of data.

So my question is which path is proper:
- change only opening data in element
- change GDL properties and opening elements
?
Are there any other parameters to change?
2 REPLIES 2
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
kzaremba wrote:
Mostly I was trying to change API_OpeningBaseType parameters based on Do_ChangeElem form Element_test. But in the case of empty opening, it doesn't work.
I've just checked it with this code (simplified version of UpdateOneWindow function from the Element_Test/Src/Element_Modify.cpp):
static void     UpdateOneWindow (const API_Guid& guid)
{
    API_Element     element = {};
    API_Element     mask = {};
    GSErrCode       err;

    element.header.guid = guid;

    err = ACAPI_Element_Get (&element);

    if (err == NoError) {
        ACAPI_ELEMENT_MASK_CLEAR (mask);
        ACAPI_ELEMENT_MASK_SET (mask, API_WindowType, openingBase.width);
        ACAPI_ELEMENT_MASK_SET (mask, API_WindowType, openingBase.height);

        element.window.openingBase.width *= 2.0;
        element.window.openingBase.height += 0.2;

        err = ACAPI_Element_Change (&element, &mask, nullptr, 0, true);
    }
}
It worked for empty openings also.
kzaremba wrote:
Are there any other parameters to change?
Yes, you should check the verticalLink field of the API_OpeningBaseType structure. The sill or header of the window/door can be linked to the top/bottom of the wall, so the distance can be fix.
Anonymous
Not applicable
Tibor wrote:
UpdateOneWindow
Thanks, I have missed this one somehow and tried the version with markers based on Ext .

So I assume that in case of changing Windows/Doors size and position there is no need to manipulate GDL properties and therefore memo of the element. Is that right?

I end up with changing the GDL parameters because when I created a new window with changed W/H it ends up "detached from the opening" so element it didn't fit the opening. However when I opened Window settings and clicked OK window is updated and its fine. After your suggestion, I do create a new window and then I call Element_Chanege to "update" element and this works. Is there any other way to force AC to refresh without calling another element based operation?
Tibor wrote:
verticalLink
Thanks a lot. I figured out that Value is stored in lower parameter but could find linking props.

I have one more question regarding EmptyOpenings. In Window documentation, there is a statement that libind with value 0 creates an empty opening. But unfortunately, when I tried to Create such an object it works error that params are inconsistent. Shall it works ? in most cases EmptyOpening has own libind in Library anyway.
Learn and get certified!