Cancel
Showing results for 
Search instead for 
Did you mean: 

upload robot programs

Pioneer
Pioneer

according to a suggestion by Mr Unangst (see here) i've tried to use the same technique to upload robot programs into PS.

private void button5_Click(object sender, EventArgs e)

{

int s = cmb_robots.SelectedIndex;

TxRobot selectedRobot = (TxRobot)allRobots[s];

TxOlpControllerUtilities txOlpControllerUtilities = new TxOlpControllerUtilities();

string path = @"C:\Temp\uploadtest\FF_BC1.tid";

ITxRoboticProgramUploader uploader = txOlpControllerUtilities.GetInterfaceImplementationFromController(selectedRobot.Controller.Name,

typeof(ITxRoboticProgramUploader),

typeof(TxControllerAttribute),

selectedRobot.Controller.Name) as ITxRoboticProgramUploader

uploader.Upload(path, selectedRobot);

}

 

unfourtunately the uploader Object stay's null, since i have no clue what to pass into

GetInterfaceImplementationFromController parameters to get a ItxRoboticProgramUploader.

Did anyone get an upload method running?

13 REPLIES

Re: upload robot programs

Phenom
Phenom

Hello @Titaniser

 

Code below works for me. Although, I can't actually remember why I'm also checking if uploader is not "null", maybe some configuration in robot controller needs to be done correctly before trying to upload. Or maybe some controller I was testing had no upload capability. 

 

You can also test for last "ControllerName" string, if changing that can help you to get the object correctly

 

TxOlpControllerUtilities newUtilities = new TxOlpControllerUtilities();

                if (robot != null)
                {
                    ITxRoboticProgramUploader uploader =
                        newUtilities.GetInterfaceImplementationFromController(robot.Controller.Name,
                            typeof(ITxRoboticProgramUploader), typeof(TxRoboticProgramUploaderAttribute),
                            "ControllerName") as ITxRoboticProgramUploader;
                    if (uploader != null) uploader.Upload(newPath, robot);
                }

Regards!

Re: upload robot programs

Pioneer
Pioneer

That seems to work at first sight, but unfourtunately no locations where uploaded.

 

The build in uploader works fine with locations.

Do i have to create locations (including parameters) by my self?

 

 

 

op_without_locs.JPG

Re: upload robot programs

Phenom
Phenom

@Titaniser

 

The uploader shall do the complete job for you.

 

Maybe you can try to check if the robot was correctly selected. The builtin application automatically filter the nc file extension for specific robots (in your case ".tid"), but your application is not checking that, so maybe you're trying to upload a nc file with incorrect robot (which I don't know if throws an exception or if can result in an empty uploaded file, like happened in your case). 

 

Regards!

 

 

Highlighted

Re: upload robot programs

Pioneer
Pioneer

my fault,

 

instead of uploading the datafile, i've tried it with the program file. That works.

 

Thanks guys or girls

Re: upload robot programs

Creator
Creator

Hy,

 

does anyone knows or has figure it out. If you upload more than one Program using PS Upload function, it puts you all Programs being uploaded under one Compound Operation like on the picture. 

 

2018-08-19 14_19_39-Operation Tree.jpg

 

When I´m uploading using foreach, it uploaded each program under his own Compound Operation.

 

So how to upload files into one Compound Operation?

 

 

Re: upload robot programs

Siemens Genius Siemens Genius
Siemens Genius

Hi,

 

Can you please share your code?

 

Regards,

Moshe

Re: upload robot programs

Creator
Creator

Hi,

 

here is my code.

 

foreach (string file in OpenFile.FileNames)
{
......
Upload(SelectedFile, Robot);

}

 

 

public void Upload(string file, TxRobot robot)
{
TxOlpControllerUtilities newUtilities = new TxOlpControllerUtilities();

if (robot != null)
{
ITxRoboticProgramUploader uploader = newUtilities.GetInterfaceImplementationFromController(robot.Controller.Name,
typeof(ITxRoboticProgramUploader), typeof(TxRoboticProgramUploaderAttribute),"ControllerName") as ITxRoboticProgramUploader;

if (uploader != null) uploader.Upload(file, robot);

}
}

Re: upload robot programs

Siemens Genius Siemens Genius
Siemens Genius

Hi,

 

you create a new uploader for each file, instead of creating only once and using it for all files. So the loop over files should be below.

 

Regards,

Moshe