I created these singnals, know how to add by Click the add button.
now I want to add these in the Simulation Panel through the api .
Is this possible?
No, there is no such API. In the Simulation Panel, you can create a .spss file configuration that contains a list of signals and load it each time you need it.
in this spss file is for example this line:
<Item name="_StartRobots" id="E9A47116-798A-43BA-B886-DD3BEAEA1556" isForcedState="1" forceStrValue="1" strValue="0"/>
Is it possible to get this ID string from signal with API?
TxPlcProgram plcProgram = TxApplication.ActiveDocument.PlcProgramRoot.CurrentPlcProgram;
TxTypeFilter signalfilter = new TxTypeFilter(typeof(ITxPlcSignal));
TxObjectList signals = plcProgram.GetSignals(signalfilter);
string id = signals.Id;
I tried this and is not the right one.
Hi, @Tomaz_K !
this is obviously the so called external ID. You can obtain it from the ProcessModelId.ExternalId of any object, that implements ITxPlanningObject or ITxProcessModelObject interface.
You may not be able to add signals to a simulation panel directly through the api, but you can programmatically create an spss file with the proper xml format and then load it into the simulation panel. You do not need the external id, you can create it with only the signal names and leave the "id" attribute out of the "Item" elements entirely. It will load into the simulation panel and then when you save it through the simulation panel, the id's will be added.
This will work at least as of version 13.1, I have not tried this in earlier versions.