ACAPI_​Element_​SolidOperation_​Create

Creates a new Solid Operation.

    GSErrCode  ACAPI_Element_SolidOperation_Create (
        API_Guid                 guid_Target,
        API_Guid                 guid_Operator,
        API_SolidOperationID     operation,
        GS::Array<API_Guid>*     guid_Results = nullptr,
    );

 

Parameters

guid_Target
[in] Identifies the target element.
guid_Operator
[in] Identifies the operator element.
operation
[in] The operation type
guid_Results
[out] The result elements after the operation (in case of successfull operation, the target and operator elements will be deleted).

 

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 both of the passed IDs are invalid, or the two IDs are equal.
APIERR_BADPARS
Invalid value passed in the operation parameter.
APIERR_NO3D
Solid operation targets and operators can be freeshape elements only.

For other common API errors see the API Errors document.

 

Remarks

This function defines a new Solid Operation between two morph elements.

In case of successfull operation, the target and operator elements will be deleted. The result elements will be returned in the guid_Results parameter.

 

Example

Substract and add morphs:


GSErrCode SolidOperation (const API_Guid& guid_Target, const API_Guid& guid_OperatorSubstract, const API_Guid& guid_OperatorAdd)
{
    return ACAPI_CallUndoableCommand ("Solid Operation",
        [&] () -> GSErrCode {
            GS::Array<API_Guid> guid_Results;
            GSErrCode err = ACAPI_Element_SolidOperation_Create (guid_Target, guid_OperatorSubstract, APISolid_Substract, &guid_Results);
            if (err != NoError) {
                if (err == APIERR_NO3D)
                    ACAPI_WriteReport ("Solid operation targets and operators can be freeshape elements only.", true);
                else
                    WriteReport_Alert ("ACAPI_Element_SolidOperation_Create failed: %d", err);
            } else {
                if (!guid_Results.IsEmpty ()) {
                    err = ACAPI_Element_SolidOperation_Create (guid_Results[0], guid_OperatorAdd, APISolid_Add);
                    if (err != NoError) {
                        if (err == APIERR_NO3D)
                            ACAPI_WriteReport ("Solid operation targets and operators can be freeshape elements only.", true);
                        else
                            WriteReport_Alert ("ACAPI_Element_SolidOperation_Create failed: %d", err);
                    }
                }
            }

            return err;
        });
}

 

Requirements

Version: API 20 or later
Header: ACAPinc.h

 

See Also

API_SolidOperationID
Element Manager
API Functions