ACAPI_​ElementSet_​Delete

Deletes an existing element set.

    GSErrCode  ACAPI_ElementSet_Delete (
        API_Guid     setGuid
    );

 

Parameters

setGuid Changed in API 12
[in] The GUID of the element set to be deleted.

 

Return Values

NoError
The function has completed with success.
APIERR_BADDATABASE
The function cannot operate on the current database.
APIERR_NEEDSUNDOSCOPE
The function must be undoable, it wasn’t called from an undoable command scope.
APIERR_BADID
The setGuid parameter is invalid.
APIERR_NOTMINE
The element set referenced by setGuid is owned by another user.
APIERR_DELETED
The element set is already deleted.

For other common API errors see the API Errors document.

 

Remarks

This function deletes an element set identified by the setGuid parameter.

Note that you cannot delete element sets created by another add-ons.

 

Example


// delete all element sets that refer to the element (identify by guid)
void DeleteElementSets (const API_Guid& guid)
{
    GS::Array<API_Guid> setGuids;
    GSErrCode err = ACAPI_ElementSet_Identify (guid, &setGuids);
    if (err == NoError) {
        USize nSet = setGuids.GetSize ();
        ACAPI_CallUndoableCommand ("Delete Element Set",
            [&] () -> GSErrCode {
                for (UIndex i = 0; i < nSet; i++) {
                    err = ACAPI_ElementSet_Delete (setGuids[i]);
                    if (err != NoError) {
                        DBPRINTF ("Delete Element Set error: %d\n", err);
                    }
                }

                return NoError;
            });
    }
}

 

Requirements

Version: API 4.1 or later
Header: ACAPinc.h

 

See Also

ACAPI_ElementSet_Create
ACAPI_ElementSet_GetData
ACAPI_ElementSet_Identify
Element Set Manager
API Functions