Archicad 27 C++ API
Loading...
Searching...
No Matches
API_ElementDecomposerInterface Class Referenceabstract

Interface class for the element decomposition process. More...

#include <APIdefs_Callback.h>

Public Member Functions

virtual GSErrCode GeneratePartElement (const API_Guid &guid, const API_ElemPartId &partId, const API_Element &partElem, const API_ElementMemo &partMemo)=0
 

Detailed Description

Interface class for the element decomposition process.

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.
Example
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);
}
}
Identify a part of an element. It's valid for PolyRoof and Morph only.
Definition: APIdefs_Elements.h:474
Interface class for the element decomposition process.
Definition: APIdefs_Callback.h:1104
GS::Guid & APIGuid2GSGuid(API_Guid &guid)
Definition: API_Guid.hpp:61
void __ACENV_CALL ACAPI_WriteReport(const GS::UniString &format, bool withDial,...)
Writes a report string into the Report Windowot into a custom alert window.
GSErrCode __ACENV_CALL ACAPI_Element_Decompose(const API_Guid &elemGuid, API_ElementDecomposerInterface *elementDecomposer)
Enumerates the planes of a Multi-plane Roof.
GSErrCode __ACENV_CALL ACAPI_Element_GetElemList(const API_ElemType &type, GS::Array< API_Guid > *elemList, API_ElemFilterFlags filterBits=APIFilt_None, const API_Guid &renovationFilterGuid=APINULLGuid)
Returns an array of guids of the elements of the given type.
Describes the variable length additional data of elements.
Definition: APIdefs_Elements.h:13856
Represents a GS::Guid in the API layer.
Definition: API_Guid.hpp:45
API_Polygon poly
The polygon of the roof slab, projected onto the horizontal plane.
Definition: APIdefs_Elements.h:4950
Int32 nCoords
Number of elements in the coordinate array. The begin points of contours are duplicated.
Definition: APIdefs_Base.h:398
A union collecting all known element types.
Definition: APIdefs_Elements.h:13390
API_RoofType roof
Represents a roof.
Definition: APIdefs_Elements.h:13441

Member Function Documentation

◆ GeneratePartElement()

virtual GSErrCode API_ElementDecomposerInterface::GeneratePartElement ( const API_Guid guid,
const API_ElemPartId partId,
const API_Element partElem,
const API_ElementMemo partMemo 
)
pure virtual

This methor is called from the ACAPI_Element_Decompose function for all decomposed element part.

Parameters
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.