construct_scenario_from_dict#
- ansys.stk.extensions.scenario_construction.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 :
STKObjectRootThe STK object root.dict :
dictA dictionary describing the scenario to construct.- Returns:
ScenarioThe newly created scenario.- Raises:
RuntimeErrorIf 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