ExtractSelectedObjAndRunThyme:
PROC [comm: CDSequencer.Command] = {
selected: CD.Instance;
multiple: BOOL;
cx: Sisyph.Context ← Sisyph.Create[comm.design];
cellType: Core.CellType;
wDir: ROPE ← CDIO.GetWorkingDirectory[comm.design];
thymeHandle: ThymeHandle ← GetThymeHandle[wDir];
thymeFileName: ROPE;
[selected, multiple] ← CDOps.SelectedInstance[comm.design];
IF ~IsSingleSelectedAndCell[selected, multiple] THEN RETURN;
[] ← CDSatellites.EnforceInvariants[comm.design, CDOps.InstList[comm.design]];
cellType ← NARROW [Sinix.Extract[obj: selected.ob, mode: Sisyph.sisyphMode, properties: selected.properties, userData: cx].result];
WHILE cellType.class=CoreClasses.identityCellClass
DO
cellType ← CoreOps.Recast[cellType];
ENDLOOP;
IF CoreOps.GetCellTypeName[cellType]=
NIL
THEN thymeFileName ← Rope.Cat[wDir, "CoreThymeDefaultFile.thy"]
ELSE thymeFileName ← Rope.Cat[wDir, CoreOps.GetCellTypeName[cellType], ".thy"];
CoreThyme.Translate[cellType, thymeFileName];
CoreOps.PrintCellType[cellType, TerminalIO.TOS[]];
CoreThyme.Simulate[thymeFileName, thymeHandle];
};