We recently received the question of how to extract the numeric ID of a transition type or group by its name using rsyncrosim or pysyncrosim. This can be done using the Transition Type or Group project-scoped datasheets.
To get the IDs of all Transition Types in an ST-Sim library, load the project datasheet called “stsim_TransitionType”, and set the include_key argument to ‘true’.
rsyncrosim
transitionTypes <- datasheet(ssimObject = myProject, name = "stsim_TransitionType", includeKey = TRUE)
pysyncrosim
transition_types = myProject.datasheets(name = “stsim_TransitionType”, include_key = True)
The same approach can be used to get the ID of a Transition Group:
rsyncrosim
transitionGroups <- datasheet(ssimObject = myProject, name = "stsim_TransitionGroup", includeKey = TRUE)
pysyncrosim
transition_groups = myProject.datasheets(name = “stsim_TransitionGroup”, include_key = True)
The datasheets can then be filtered by the Name column to extract the TransitionTypeID or TransitionGroupID value. For example, the following code demonstrates how to extract the Transition Type ID for the transition, “Fire”.
rsyncrosim
fireTransitionId <- transitionTypes$TransitionTypeID[transitionTypes$Name == “Fire”]
pysyncrosim
fire_transition_id = transition_types[transition_types[“Name”] == “Fire”][“TransitionTypeID”].values[0]