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.
SOLVED!

How can I determine the corner coordinate of a door opening?

Anonymous
Not applicable
Hello Archicad community,

I know the front center point coordinate of my door element (see attachment), and starting from there using the width of the door opening I could calculate the door opening coordinate on the side (see attachment). The problem with fetching the width of the door, however, is that it depends on a setting, so that the door width could include the frame or not (80cm or 100cm). Is there an easy way to always get the full opening width (100cm)? Because if I would simply add the frame widths on both sides (20cm total) I would get 120cm in case the setting already includes the frame widths. If I could directly get the coordinate of the corner via the wall without having to know the door opening width this would also be fine.

Thanks a lot,
Dan

Archicad version: 22
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Hi Dan,

Using ACAPI_Element_GetQuantities function you can get easily the width and nominal width of the door. The width should be the full width what you are looking for:
API_ElementQuantity quantity;
API_QuantitiesMask  mask;
API_Quantities      quantities;
BNZeroMemory (&quantity, sizeof (API_ElementQuantity));
quantities.elements = &quantity;

ACAPI_ELEMENT_QUANTITY_MASK_CLEAR (mask);
ACAPI_ELEMENT_QUANTITY_MASK_SET (mask, door, width1);
ACAPI_ELEMENT_QUANTITY_MASK_SET (mask, door, width2);
ACAPI_ELEMENT_QUANTITY_MASK_SET (mask, door, nWidth1);
ACAPI_ELEMENT_QUANTITY_MASK_SET (mask, door, nWidth2);
GSErrCode err = ACAPI_Element_GetQuantities (doorGuid, nullptr, &quantities, &mask);
if (err == NoError) {
    ACAPI_WriteReport ("Door quantities:\n
                        Reveal Side Width = %.6lf\n
                        Opposite Side Width = %.6lf\n
                        Reveal Side Nominal Width = %.6lf\n
                        Opposite Side Nominal Width = %.6lf\n",
                        true,
                        quantity.door.width1,
                        quantity.door.width2,
                        quantity.door.nWidth1,
                        quantity.door.nWidth2);
}
Regards,
Tibor

View solution in original post

2 REPLIES 2
Solution
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Hi Dan,

Using ACAPI_Element_GetQuantities function you can get easily the width and nominal width of the door. The width should be the full width what you are looking for:
API_ElementQuantity quantity;
API_QuantitiesMask  mask;
API_Quantities      quantities;
BNZeroMemory (&quantity, sizeof (API_ElementQuantity));
quantities.elements = &quantity;

ACAPI_ELEMENT_QUANTITY_MASK_CLEAR (mask);
ACAPI_ELEMENT_QUANTITY_MASK_SET (mask, door, width1);
ACAPI_ELEMENT_QUANTITY_MASK_SET (mask, door, width2);
ACAPI_ELEMENT_QUANTITY_MASK_SET (mask, door, nWidth1);
ACAPI_ELEMENT_QUANTITY_MASK_SET (mask, door, nWidth2);
GSErrCode err = ACAPI_Element_GetQuantities (doorGuid, nullptr, &quantities, &mask);
if (err == NoError) {
    ACAPI_WriteReport ("Door quantities:\n
                        Reveal Side Width = %.6lf\n
                        Opposite Side Width = %.6lf\n
                        Reveal Side Nominal Width = %.6lf\n
                        Opposite Side Nominal Width = %.6lf\n",
                        true,
                        quantity.door.width1,
                        quantity.door.width2,
                        quantity.door.nWidth1,
                        quantity.door.nWidth2);
}
Regards,
Tibor
Anonymous
Not applicable
Thanks a lot! width1 seems to work as intended.
Learn and get certified!

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!