APIAny_​GetSkylightHolePolygonID

Returns the polygon data of a Skylight hole contour.

    GSErrCode ACAPI_Goodies (
        APIAny_GetSkylightHolePolygonID,
        const API_Guid*        skylightGuid,
        Geometry::Polygon2D*     holePoly
    );

 

Parameters

skylightGuid
[in] Identifier of the Skylight element.
holePoly
[out] Polygon data of the hole contour.

 

Return Values

NoError
The function has completed with success.
APIERR_NOPLAN
There is no active plan database.
APIERR_BADPARS
skylightGuid or holePoly is nullptr.
APIERR_BADINDEX
skylightGuid does not refer to a valid element in the database.
APIERR_REFUSEDPAR
The element specified with skylightGuid is not Skylight type.

For other common API errors see the API Errors document.

 

Remarks

This function is used to get the contour polygon of a Skylight hole in absolute coordinates, projected to the horizontal plane.
(Note that currently this is not the actual hole contour but the four corner points of the Skylight element).

No need to dispose the allocated data of the Geometry::Polygon2D nor the Geometry::MultiPolygon2D.

Before Archicad 18, this function was called APIAny_GetSkylightHolePoly2DDataID.

 

Example


void AddSkylightHolesToRoofPolygon (Geometry::Polygon2DData& polygon2DData, const GS::Array<API_Guid>& skylights)
{
    Geometry::MultiPolygon2D multi;
    Geometry::ConvertPolygon2DDataToPolygon2D (multi, polygon2DData);
    Geometry::Polygon2D polygon2D = multi.PopLargest ();

    for (UIndex i = 0; i < skylights.GetSize (); i++) {
        Geometry::Polygon2D holePoly;
        if (ACAPI_Goodies (APIAny_GetSkylightHolePolygonID, (void*) &skylights[i], &holePoly) == NoError) {
            Geometry::MultiPolygon2D resultPolys;
            polygon2D.Substract (holePoly, resultPolys);
            if (!resultPolys.IsEmpty ()) {
                polygon2D = resultPolys.PopLargest ();
            }
        }
    }
    Geometry::FreePolygon2DData (&Polygon2DData);
    Geometry::ConvertPolygon2DToPolygon2DData (polygon2DData, polygon2D);
}

 

Requirements

Version: API 15 or later
Header: APIdefs_Goodies.h

 

See Also

Geometry::Polygon2DData, Polygon2DData functions
API_SkylightType, ACAPI_Element_GetConnectedElements
ACAPI_Goodies, API Functions