construct_scenario_from_dict#

construct_scenario_from_dict(root: STKObjectRoot, dictionary: dict) Scenario#

Create a scenario with sub-objects from a dictionary describing its structure.

The dictionary represents a hierarchy of nodes, where each node has a type, a name, and children. The type is case insensitive and corresponds to the values in the STKObjectType enumeration.

Parameters:

root : STKObjectRoot The STK object root.

dict : dict A dictionary describing the scenario to construct.

Returns:

Scenario The newly created scenario.

Raises:

RuntimeError If the dictionary does not have the proper structure.

Examples:

Construct a scenario with a place and a sensor attached to it:

scenario = construct_scenario_from_dict(
    root,
    {
        "type": "Scenario",
        "name": "MyScenario",
        "children": [
            {
                "type": "Place",
                "name": "MyPlace",
                "children": [
                    {
                        "type": "Sensor",
                        "name": "MySensor",
                        "children": []
                    }
                 ]
            }
        ]
    })

Import detail#

from ansys.stk.extensions.scenario_construction import construct_scenario_from_dict