APIEnv_​Get3DStyleListID

Retrieves the names of all styles in the project and/or the name of the current style.

    GSErrCode ACAPI_Environment (
        APIEnv_Get3DStyleListID,
        GS::Array<GS::UniString>*     styles,
        GS::UniString*                current
    );

 

Parameters

styles
[out] List of the names of all styles in the project.
current
[out] The name of the currently active style.

 

Return Values

NoError
The function has completed with success.
APIERR_BADPARS
Both parameter pointers are nullptr.

For other common API errors see the API Errors document.

 

Remarks

This function is used to retrieve the list of 3D styles which can be accessed via the ‘3D Styles’ dialog box. Any of the parameters can be set to nullptr if that information is to be ignored, but doing so with both at the same time returns no information.

 

Example


// Get the name of all styles.
GS::Array<GS::UniString> stylesNames;
GS::UniString currentName;
ACAPI_Environment (APIEnv_Get3DStyleListID, &stylesNames, &currentName);

API_3DStyle apiStyle;
BNClear (apiStyle);
// Get the details of the currently active style. The name field is used for identification.
GS::ucsncpy (apiStyle.name, currentName.ToUStr (), API_UniLongNameLen);
ACAPI_Environment (APIEnv_Get3DStyleID, &apiStyle);

// Change ground color to green.
apiStyle.backGroundRGB = { 0.0, 1.0, 0.0 };
// Update the style.
ACAPI_Environment (APIEnv_Change3DStyleID, &apiStyle);

// Create a new style based on the current one, with a different sky color. Finally set it as the current style.
GS::UniString testStyleName ("testStyle");
if (!stylesNames.Contains (testStyleName)) {
    apiStyle.bkgSkyColor = { 0.2, 0.2, 1.0 };
    GS::ucsncpy (apiStyle.name, testStyleName.ToUStr (), API_UniLongNameLen);
    ACAPI_Environment (APIEnv_Create3DStyleID, &apiStyle);
    ACAPI_Environment (APIEnv_SetCurrent3DStyleID, &testStyleName);
}
        

 

Requirements

Version: API 21 or later
Header: APIdefs_Environment.h

 

See Also

ACAPI_Environment,
API Functions,
APIEnv_Get3DStyleID,
APIEnv_Change3DStyleID,
APIEnv_SetCurrent3DStyleID,
APIEnv_Create3DStyleID,
API_3DStyle