Cancel
Showing results for 
Search instead for 
Did you mean: 

How to Get Robot Program plain text?

Valued Contributor
Valued Contributor

Hi,

 

There is a requirement that to check something about robot program. so, how to get the robot program text?

 

I try ITxRoboticProgram, but I don't know how to get all content as a continuous text, which like robot program viewer displayed.

 

and whether there is any different on Tx13, Tx14? 

 

thanks for any info.

3 REPLIES 3

Re: How to Get Robot Program plain text?

Phenom
Phenom

Hello @ErnestA

 

You can loop through each ITxOperation object inside robotic program and get the download representation (as mentioned in the other topic you posted).

 

If you need the download file structure, take a look in this topic to see how you can download the file (and then you can take the contents later).

 

Regards!

Re: How to Get Robot Program plain text?

Valued Contributor
Valued Contributor

Hi, Fred

 

thanks. loop through each ITxOperation is what I do at present. I thought there should be a more simple method to get all program info, which no need to save to a file.

                if (cmds[i] is TxRoboticCompositeCommand compCmd)
                {
                    ITxRobot irobot = GetRobot(ops[i]);
                    TxOlpCommandServices services = new TxOlpCommandServices(irobot as TxRobot);
                    string[] strComp = services.GetCommandRepresentation(TxOlpCommandLayerRepresentation.Download, compCmd, ops[i]);
                    text.AddRange(strComp);
                }
                else
                    text.Add(cmds[i].Text);

thanks again.

Re: How to Get Robot Program plain text?

Siemens Legend Siemens Legend
Siemens Legend

ITxRoboticDownloader downloader = null;

ITxRobot robot = GetRobot(roboticObject);

if (robot != null)

{

ITxOlpRobotControllerParametersHandler paramHandler = (ITxOlpRobotControllerParametersHandler)_controllerUtilities.GetInterfaceImplementationFromController(robot.Controller.Name, typeof(ITxOlpRobotControllerParametersHandler), typeof(TxRobotSimulationControllerAttribute), "ControllerName");

if (paramHandler != null)

{

paramHandler.Init(robot as TxRobot);

}

 

\\ according to the controller name

downloader = (ITxRoboticDownloader)_controllerUtilities.GetInterfaceImplementationFromController(robot.Controller.Name, typeof(ITxRoboticDownloader), typeof(TxControllerAttribute), "ControllerName");

downloader.Download(..)