Enumerates the planes of a Multi-plane Roof.
GSErrCode ACAPI_Element_Decompose ( const API_Guid& elemGuid, API_ElementDecomposerInterface* elementDecomposer );
Parameters
- elemGuid
- [in] Identifier of the element to be decomposed. Currently this must be a PolyRoof element.
- elementDecomposer
- [in] Interface pointer to an object implemented by the caller to be used during the decomposition.
Return Values
NoError
- The function has completed with success.
APIERR_BADPARS
- The elementDecomposer pointer is
nullptr
or the element specified with elemGuid is not PolyRoof type. APIERR_BADID
- The elemGuid parameter does not identify a valid element.
Remarks
Use this function to enumerate the planes of a Multi-plane Roof as a set of Single-plane API_RoofType elements.
First you need to implement a derived class of API_ElementDecomposerInterface. An object instance of this class should be passed to ACAPI_Element_Decompose to be called back by its GeneratePartElement
method.
Example
Declaration of a class of API_ElementDecomposerInterface type:
class PolyRoofConverter : public API_ElementDecomposerInterface { public: PolyRoofConverter (const API_Guid& polyRoofGuid); virtual GSErrCode GeneratePartElement (const API_Guid& guid, const API_ElemPartId& partId, const API_Element& partElem, const API_ElementMemo& partMemo); };
Call decomposition for a given Roof element:
void DecomposeRoof (const API_Guid& roofGuid) { API_Element element; BNZeroMemory (&element, sizeof (API_Element)); element.header.guid = roofGuid; GSErrCode err = ACAPI_Element_Get (&element); if (err == NoError && element.roof.roofClass == API_PolyRoofID) { PolyRoofConverter polyRoofConverter (element.header.guid); err = ACAPI_Element_Decompose (element.header.guid, &polyRoofConverter); } }
See also the snippet functions of the Element Test example add-on.
Requirements
- Version: API 15 or later
- Header: ACAPinc.h
See Also
API_ElementDecomposerInterface
API_RoofType
Element Manager, API Functions