Cancel
Showing results for 
Search instead for 
Did you mean: 

Create OLP commands for Custom XML

Experimenter
Experimenter

Gooday

 

I am trying to auto create OLP commands for each location from a custom XML(UI/Sim/Layer). I am able to read the current commands using TxOlpCommandServices.GetCommandRepresentation but I am unable to find the command to Set commands/create these.

 

Thanks in advance

 

 

4 REPLIES 4

Re: Create OLP commands for Custom XML

Phenom
Phenom

Hello @GMVC

 

I've created an utility command to create OLP customized commands, in a very straightforward manner.

 

You need to pass the OLP command name (defined in xml file), the dialog name (also defined in xml file), the arraylist with parameters from your command (depends on each customized command) and the location where the command should be created.

 

Take a look in the code below and see if you can investigate more on this subject. There are some topics also discussing about it. 

 

public TxRoboticCompositeCommand CreateOlpCompositeCommand(string commandName, string dialogName, ArrayList elements, ITxRoboticOperation op)
        {
            // create the customized dialog element
            TxRoboticCompositeCommandStringElement strElement = new TxRoboticCompositeCommandStringElement();
            strElement.Type = "CustomizedOLPName";
            strElement.Value = commandName;

            // add the element to the other composite elements
            elements.Add(strElement);

            // create a new composite creation data with specific elements
            TxRoboticCompositeCommandCreationData data = new TxRoboticCompositeCommandCreationData(elements);

            // create the command
            TxRoboticCompositeCommand newCommand = op.CreateCompositeCommand(data);

            // update text property to formally create the composite dialog (instead of a text command)
            string uid = Guid.NewGuid().ToString();
            newCommand.Text = "OLP_CUSTOMIZED_COMMAND_NAME=" + dialogName  + ";OLP_CUSTOMIZED_COMMAND_ID=e" + uid;

            return newCommand;
        }

Re: Create OLP commands for Custom XML

Valued Contributor
Valued Contributor
Hi

the newCommand.Text is the key to write Composite Command(instead of plain text), and how do I know how to format the Text such as "OLP_CUSTOMIZED_COMMAND_NAME=" + dialogName + ";OLP_CUSTOMIZED_COMMAND_ID=e" + uid;

I mean how to format the Text while the command is "Wait Signal", "ENTER ZONE 12 With R13" and so on.

Thanks very much.
Highlighted

Re: Create OLP commands for Custom XML

Valued Contributor
Valued Contributor

 

Hi, thanks for your code, this below can write the correct commands, no need to change the text format. thank you.

            TxRoboticCompositeCommandIntElement Num = new TxRoboticCompositeCommandIntElement();
            Num.Type = "Singal_No";
            Num.Value = 137;

            TxRoboticCompositeCommandStringElement offon = new TxRoboticCompositeCommandStringElement();
            offon.Type = "ON_OFF";
            offon.Value = "OFF";

            // create the customized dialog element
            TxRoboticCompositeCommandStringElement strElement = new TxRoboticCompositeCommandStringElement();
            strElement.Type = "CustomizedOLPName";
            strElement.Value = commandName;

            elements.AddRange(new ArrayList { offon, Num, strElement });

 

Re: Create OLP commands for Custom XML

Siemens Legend Siemens Legend
Siemens Legend

Hi,

 

you work too hard for that, this is not the right way to create your own OLP command.

Actually you don’t need to code at all, Process Simulate supports it OOTB.

The correct way, is to write customized OLP XML.

There is a detailed manual “RoboticsCustomizedUIManual” that you can find under you installation or open it directly from Robot->Customized Command XML Checker->Help.

Bu this, you new OLP will be supported totally by system, in UI, simulation, download & upload.   

 

Regards

Moshe Hazan