API_​ElementDecomposerInterface

Interface class for the element decomposition process.

    class API_ElementDecomposerInterface {
    public:
         virtual             ~API_ElementDecomposerInterface () {};
         virtual GSErrCode   GeneratePartElement (const API_Guid& guid, const API_ElemPartId& partId,
                                                  const API_Element& partElem, const API_ElementMemo& partMemo) = 0;
    };

 

Remarks

Interface class for enumerating the planes of a Multi-plane Roof element with the ACAPI_Element_Decompose function. An instance of a derived class of this type should be passed to the decomposer function, which then calls the GeneratePartElement virtual method of the object for each planes of the PolyRoof one by one.

Parameters of the GeneratePartElement method:

guid
[in] The guid of the original PolyRoof element.
partId
[in] Identifies the part element within the whole structure. In the context of Multi-plane Roofs the main member refers to the vertexId of the pivot polygon, and sub identifies the roof level.
partElem
[in] Data describing the element part. Currently this variable always returns API_RoofType parameters with API_PlaneRoofID class.
partMemo
[in] Memo data of the part element. Only the relevant members are initialized, in case of plane roofs the following ones:
coords, pends, parcs, vertexIDs, edgeTrims, roofEdgeTypes, sideMaterials.
These memo arrays will be disposed by ACAPI_Element_Decompose at the end of the call.

 

Note that the decomposed parts show their original shape, without the effect of trim connections and Skylight holes. If you need the actual shape of the Roof planes, browse through the 3D model of the original Multi-plane Roof element with ACAPI_Element_Get3DInfo or using the ModelAccess interface.

 

Example


// list the number of vertices of all Multi-plane Roof parts

class PolyRoofConverter : public API_ElementDecomposerInterface {
public:
    virtual GSErrCode   GeneratePartElement (const API_Guid& guid, const API_ElemPartId& partId,
                                             const API_Element& partElem, const API_ElementMemo& /*partMemo*/)
    {
        GS::UniString reportString = GS::UniString::Printf ("Plane component [%d:%d] of Multi-plane Roof {%T} has %d vertices",
                                                            partId.main, partId.sub,
                                                            APIGuid2GSGuid (guid).ToUniString ().ToPrintf (),
                                                            partElem.roof.u.planeRoof.poly.nCoords - 1);
        ACAPI_WriteReport (reportString.ToCStr ().Get (), false);
        return NoError;
    }
} polyRoofConverter;

GS::Array<API_Guid> roofs;
GSErrCode err = ACAPI_Element_GetElemList (API_RoofID, &roofs);
if (err == NoError) {
    for (GS::Array<API_Guid>::ConstIterator it = roofs.Enumerate (); it != nullptr; ++it) {
        err = ACAPI_Element_Decompose (*it, &polyRoofConverter);
        if (err == APIERR_BADPARS)
            ACAPI_WriteReport ("This Roof is not Multi-plane, cannot be decomposed", false);
    }
}

 

Requirements

Version: API 15 or later
Header: APIdefs_Callback.h

 

See Also

ACAPI_Element_Decompose
API_RoofType
API Types