ACAPI_​Element_​GetDefaultsExt

Retrieves the actual default settings for the Window, Door, Section, Elevation, Interior Elevation, ChangeMarker, Detail, Worksheet, or Stair element with its marker(s). You are able to obtain Curtain Wall and its subelem default settings also via this function.

    GSErrCode  ACAPI_Element_GetDefaultsExt (
        API_Element*             element,
        API_ElementMemo*         memo,
        UInt32                   nSubElems,
        API_SubElement*          subElems
    );

 

Parameters

element
[in/out] The desired element for which the defaults are needed. The element->header.type can be API_WindowID, API_DoorID, API_CutPlaneID, API_ElevationID, API_InteriorElevationID, API_ChangeMarkerID, API_DetailID, API_WorksheetID, API_CurtainWallID, API_CurtainWallPanelID, API_CurtainWallFrameID, API_CurtainWallJunctionID, API_CurtainWallAccessoryID, or API_StairID.
memo
[out] This is needed only in case of library part-based elements (including zone stamps).
nSubElems Modified in API 12
[out] The subelem of the desired element for which the defaults are needed.
subElems Modified in API 12
[out] The subelem(s) (normal, story handle, interior elevation common marker) of the desired element.

 

Return Values

NoError
The function has completed with success.
APIERR_BADPARS
The passed element parameter is nullptr.
APIERR_BADID
The element type should be API_WindowID, API_DoorID, API_CutPlaneID, API_ElevationID, API_InteriorElevationID, API_ChangeMarkerID, API_DetailID, API_WorksheetID, API_CurtainWallID, API_CurtainWallFrameID, API_CurtainWallPanelID, API_CurtainWallJunctionID, API_CurtainWallAccessoryID, or API_StairID.

For other common API errors see the API Errors document.

 

Remarks

This function is used to obtain the actual default settings for a Window, Door, Section, Elevation, Interior Elevation, ChangeMarker, Detail or Worksheet element, as an alternative of ACAPI_Element_GetDefaults.

The requested type is identified by the type field of the header. The function fills the central part of the API_Element structure with values from the Settings dialog. You have to fill in the geometric information yourself, if you need it.

The memo parameter is used only for library part based elements (including zone stamps), where the params field is filled with the actual parameter values of the referenced Library Part. Do not forget to call the ACAPI_DisposeElemMemoHdls function to dispose of the obtained handles.

To change the default settings use the ACAPI_Element_ChangeDefaultsExt function.

You can use the returned values to initialize the element attributes and parameters to create a new instance. Refer to the ACAPI_Element_CreateExt function for more details.

 

Example


API_Element          element;
API_ElementMemo      memo;
API_MarkerMemoMask   markers[2];
GSErrCode            err;

BNZeroMemory (&element, sizeof (API_Element));
BNZeroMemory (&memo, sizeof (API_ElementMemo));
BNZeroMemory (&markers, sizeof (markers));

element.header.type = API_CutPlaneID;
markers[0].markType = (API_MarkerMemoMaskType) (APIMarkerMemoMask_MainMarker | APIMarkerMemoMask_NoParams); // only the element is needed
markers[1].markType = (API_MarkerMemoMaskType) (APIMarkerMemoMask_SHMarker | APIMarkerMemoMask_NoElem);     // only the memo is needed

err = ACAPI_Element_GetDefaultsExt (&element, &memo, 2UL, &markers);
if (err == NoError) {
    if (markers[1].memo.params != nullptr) {
        DBPrintf ("Cut Plane Default: Show Story Level Marker head is %s\n",
            ((*markers[1].memo.params)[3].value.real > 0.0) ? "ON" : "OFF");     // "marker_head" parameter
    }

    API_LibPart libPart;
    BNZeroMemory (&libPart, sizeof (API_LibPart));
    libPart.index = markers[0].markElem.object.libInd;
    if (ACAPI_LibPart_Get (&libPart) == NoError) {
        DBPrintf ("Section Marker currently selected for Cut Plane Default: \"%s\"\n", (const char *) GS::UniString (libPart.docu_UName).ToCStr ());
    }
    if (libPart.location != nullptr)
        delete libPart.location;
}

ACAPI_DisposeElemMemoHdls (&memo);
ACAPI_DisposeElemMemoHdls (&markers[1].memo);

 

Requirements

Version: API 4.3 or later
Header: ACAPinc.h

 

See Also

API_Element, API_ElementMemo
ACAPI_Element_GetDefaults, ACAPI_Element_ChangeDefaultsExt, ACAPI_DisposeElemMemoHdls
ACAPI_Element_CreateExt, ACAPI_Element_ChangeExt
API_WindowType, API_CutPlaneType, API_ElevationType, API_InteriorElevationType, API_ChangeMarkerType, API_DetailType, API_WorksheetType
Element Manager, API Functions