Main Content


Specify options for customizing exported scene graph files

Since R2024a


    The sceneGraphExportOptions object enables you to specify options for customizing exported scene graph files.



    options = sceneGraphExportOptions creates a default export options configuration object.

    options = sceneGraphExportOptions(Name=Value) specifies properties using one or more name-value arguments. For example, ExportSceneGraph=false specifies not to export a scene graph file when exporting to the ASAM OpenSCENARIO® format.


    expand all

    Format of the scene graph file to export, specified as "OpenSceneGraph". Specify this option to export a new scene graph file for the scenario. To reuse an existing scene graph file, specify the ExistingFileName property instead.

    Example: options = sceneGraphExportOptions(FormatName="OpenSceneGraph"); exports a scene graph file to the OpenSceneGraph format.

    Name of the new scene graph file to be generated, specified as a string scalar or character vector. By default, RoadRunner generates a new OpenSceneGraph file with the same name as the exported ASAM OpenSCENARIO file.

    Name of a previously exported scene graph file, specified as a string scalar or character vector. Specify this property to reuse an existing scene, which can reduce export time. If you specify FormatName, then RoadRunner ignores this property and generates a new scene graph file.

    Option to export a scene graph file, specified as a logical 1 (true) or 0 (false).

    By default, RoadRunner exports a scene graph file. To skip the scene graph file when exporting to an ASAM OpenSCENARIO format, set this property to false.

    Example: options = sceneGraphExportOptions(ExportSceneGraph=false); specifies for RoadRunner not to export a scene graph file when exporting to an ASAM OpenSCENARIO format.

    Export options for the OpenSceneGraph file, specified as an openSceneGraphExportOptions object. Do not specify this property if you specify ExistingFileName, or if ExportSceneGraph is false.

    Example: options = sceneGraphExportOptions(OpenSceneGraphOptions=ocgOps); specifies the OpenSceneGraph export options object ocgOps for the exported open scene graph file.


    collapse all

    When you export your RoadRunner scenario, you can simultaneously specify options for exporting an OpenSceneGraph file by using the openSceneGraphExportOptions object and the sceneGraphExportOptions object.

    Create a roadrunner object, specifying the path to an existing project. For example, this code shows the path to a project, on a Windows® machine, located at "C:\RR\MyProject". This code assumes that RoadRunner is installed in the default location, and returns an object, rrApp, that provides functions for performing basic tasks such as opening, closing, and saving scenes and projects.

    rrApp = roadrunner(ProjectFolder="C:\RR\MyProject");

    Open an existing scenario in RoadRunner Scenario by using the openScenario function with the roadrunner object rrApp and the filename of the specific scenario that you want to open.

    filename = "TrajectoryCutIn.rrscenario";

    Create an openSceneGraphExportOptions object to specify options for the OpenSceneGraph file to be created on export.

     osgOps = openSceneGraphExportOptions(SplitMeshes=true);

    Set export options for the scene graph file by creating a sceneGraphExportOptionsobject, specifying the OpenSceneGraphOptions property as the openSceneGraphExportOptions object created in the previous step. Optionally, specify the FormatName and NewFileName properties.

    sgeOps = sceneGraphExportOptions(FormatName="OpenSceneGraph",NewFileName="MySceneGraph",OpenSceneGraphOptions=ocgOps);

    Specify your scene graph export options object to the SceneGraphOptions property of an openScenarioExportOptions object. Then, export your scenario using the exportScenario function, specifying the openScenarioExportOptions object as input. For more information on exporting your scenario with MATLAB®, see exportScenario (RoadRunner Scenario).

    filename = "TrajectoryCutIn.rrscenario.xosc";
    formatname = "OpenSCENARIO";
    options = openScenarioExportOptions(SceneGraphOptions=sgeOps);

    Version History

    Introduced in R2024a