ACAPI_​Element_​Merge_​Remove

Remove the merge connection from the given elements.

    GSErrCode  ACAPI_Element_Merge_Remove (
        const API_Guid&     guid_Element1,
        const API_Guid&     guid_Element2
    );

 

Parameters

guid_Element1
[in] The first element GUID.
guid_Element2
[in] The second element GUID.

 

Return Values

NoError
The function has completed with success.
APIERR_NEEDSUNDOSCOPE
The function must be undoable, it wasn’t called from an undoable command scope.
APIERR_BADDATABASE, APIERR_NOTMINE
The function cannot operate on the current database.
APIERR_BADINDEX
One or more of the passed IDs are invalid.
APIERR_BADELEMENTTYPE
One of the elements is not construction element type.

For other common API errors see the API Errors document.

 

Remarks

This function removes merge connection between the elements.

 

Example


void Do_Merge_Remove (void)
{
    API_ElemType    typeID1;
    API_Guid        guid_Element1;

    if (!ClickAnElem ("Click on a construction element to remove the connection!", API_ZombieElemID, nullptr, &typeID1, &guid_Element1)) {
        WriteReport_Alert ("No element was clicked.");
        return;
    }

    API_Element tmpElement;
    BNZeroMemory (&tmpElement, sizeof(tmpElement));
    tmpElement.header.guid = guid_Element1;
    if (ACAPI_Element_Get (&tmpElement) != NoError) {
        WriteReport_Alert ("No element was clicked.");
        return;
    }
    typeID1 = tmpElement.header.type;
    guid_Element1 = tmpElement.header.guid;
    if (typeID1 == API_SectElemID) {
        typeID1 = tmpElement.sectElem.parentType;
        guid_Element1 = tmpElement.sectElem.parentGuid;
    }

    API_ElemType    typeID2;
    API_Guid        guid_Element2;
    if (!ClickAnElem ("Click on a second construction element to remove the connection with the first!", API_ZombieElemID, nullptr, &typeID2, &guid_Element2)) {
        WriteReport_Alert ("No element was clicked.");
        return;
    }

    BNZeroMemory (&tmpElement, sizeof(tmpElement));
    tmpElement.header.guid = guid_Element2;
    if (ACAPI_Element_Get (&tmpElement) != NoError) {
        WriteReport_Alert ("No element was clicked.");
        return;
    }
    typeID2 = tmpElement.header.type;
    guid_Element2 = tmpElement.header.guid;
    if (typeID2 == API_SectElemID) {
        typeID2 = tmpElement.sectElem.parentType;
        guid_Element2 = tmpElement.sectElem.parentGuid;
    }

    GSErrCode err = ACAPI_Element_Merge_Remove (guid_Element1, guid_Element2);
    if (err != NoError) {
        if (err == APIERR_NO3D)
            WriteReport_Alert ("Only construction elements have merge connection!");
        else
            WriteReport_Alert ("ACAPI_Element_Merge_Remove failed: %d", err);
    }

    return;
}

 

Requirements

Version: API 18 or later
Header: ACAPinc.h

 

See Also

ACAPI_Element_Merge_Elements
ACAPI_Element_Merge_GetMergedElements
API Functions