cancel
Showing results for 
Search instead for 
Did you mean: 

How to validate controller XML files

Genius
Genius

 Hello!

 

I'm trying to write a method to perform similar action to "Customized Command XML Checker" command but have not been successful on doing that so far.

 

The method is shown below. Try/catch was used to ignore exceptions (the returned exception is marked in yellow as a warning when using "Customized Command XML Checker" command - see image attached below). The command runs but is not validating new xmls.

 

Can anyone find what I'm missing?

 

Customized Command XMl Checker result dialogueCustomized Command XMl Checker result dialogueThe method:

 

public void RefreshXmlCustomization()
{


TxObjectList robotList = TxApplication.ActiveDocument.PhysicalRoot.GetAllDescendants(new TxTypeFilter(typeof(TxRobot)));
TxRobot robot = robotList[0] as TxRobot;
TxOlpDataServices newService = new TxOlpDataServices(robot);
try
{
newService.Refresh();
}
catch (Exception)
{
}

 

}

 

8 REPLIES

Re: How to validate controller XML files

Siemens Legend Siemens Legend
Siemens Legend

Hello Fred,

 

The code that you are using is correct. If you have more than one robot in the study, you may be refreshing the wrong robot?

And when you run the PS command, do you get the same error, which you get when running your code?

 

Best Regards,

DianaG

Re: How to validate controller XML files

Siemens Legend Siemens Legend
Siemens Legend

Hi,

 

The warning, shown in your screenshot, is not a problem.

 

Only "DataConfiguration" folder is missing. You can manually create it and this warning no longer shown.

 

 

From NC-Code-Embraer User Manual:

RCS Module
•Simulation is not using RCS module, however following entry can be added to rrs.xml file under eMPower\Robotics\Olp to include the following block

Example :

<Data>
<ControllersData>
...
<Controller Name="NC-Code-Embraer" RCSDecoupleSimulationAction="True" RCSDecoupleNonSimulationAction="True">
</Controller>
...
</ControllersData>
</Data>

 

Customized commands
◦Installation
◾The customized commands are written in a .xml description file in the <ControllerInstallationFolder>\OlpConfiguration directory. The name of the file is irrelevant as long as the extension is xml.
◦Insertion in the Teach pendant command menu
◾In the .xml file, each customized command has a Dialog Title parameter which describs the menu interface to activate the command specific dialog box. The Dialog Title is a string setting the names and the order of the submenus to access to the command.
◾The format is : SubMenu1 | SubMenu2 | ... | SubMenuX | CommandName. The submenu number X can be 0 ( no submenu ), then the command is placed to the top command menu.

 

Best regards

Patrick

Re: How to validate controller XML files

Genius
Genius

Hello Diana,

 

1 - The study has only one robot, that was not an issue in this case (of course, coding can be enhanced regarding that situation);

2 - When I run PS command, it shows the dialogue as shown in the image from my first post (the exception is shown in yellow). When I run the customized command, there's no report dialogue shown on screen. 

3 - Additional information:

 

The aim of this command is to validate the controller when pointed to a different xml customization. In the controller folder I have two rrs.xml files pointing to those customizations (rrs.xml and rrs_spare.xml, for example). 

 

When I change the name of those xmls to make the "spare" to be the "active" I need to run the validation again. For this situation, when I run PS command, the validation migrates to the new xml customization, although the customized command doesn't change the xml customization (that's why I don't know if it is validating the xmls or not).

Re: How to validate controller XML files

Genius
Genius

Hello Patrick,

 

Actually I've tried that before using the try/catch block, but then I've got a different exception, something related to missing files in this created folder. I understand this is not a problem, the only problem is that it looks like the validation is not being executed, as mention in the post for Diana.

 

Regards!

 

 

Re: How to validate controller XML files

Siemens Legend Siemens Legend
Siemens Legend

Hello Fred,

 

The call to the API does not open a dialog with the results, this is part of the PS command and it is implemented in addition. To verify if the API call worked you need a try/catch block. In case of a problem there will be an exception that should say what is the problem.

If you get TxOlpXMLMissingOlpConfigurationFileException, TxOlpXMLLoadingException or TxOlpXMLElementException, then you can check from the exception what was wrong - Message property. The base class for that exception types is TxOlpXMLException, you can use it in the catch block.

If you don't get any exception then all is OK.

 

Best Regards,

DianaG

 

Re: How to validate controller XML files

Genius
Genius

Hi Diana,

 

The problem about the exception is that it is expected and shall be ignored (the validation should be done even with the exception that is currently being returned). 

 

The prof for that is that PS Command gets the same exception from the customized command, that's why the dialogue shows "This folder is missing for controller: 'NC-Code-Embraer'.", which is the exact same message that I receive when the exception is throw from the customized command.

 

I'll investigate a little more about this. Maybe I need, somehow, to refresh the rrs.xml that is loaded for the controller. It looks like that when I execute the command it continues to point to the old xml and not for the new one. I checked some RRS classes that may solve this issue. 

 

Thanks again!

 

 

Re: How to validate controller XML files

Siemens Legend Siemens Legend
Siemens Legend

After a small research Smiley Happy

 

Each xml should be validated separately using a try/catch block. TxOlpDataServices  class refreshes only the Data Template. To validate the other xmls, we should use the following services (use try/catch blocks).

TxOlpCommandServices

TxOlpMotionCommandServices

TxOlpPathTemplateServices

TxOlpDownloadTemplateServices

 

In case you get a TxOlpXMLMissingOlpConfigurationFileException, then it means that the xml file is missing.

bool isMissing = false;
TxOlpCommandServices olpService = new TxOlpCommandServices(robot);
try
{                    
         olpService.Refresh();
}
catch (TxOlpXMLMissingOlpConfigurationFileException ex)
{
         isMissing = true ;
}
catch (TxOlpXMLException ex)
{
     ...
}

 

Best Regards,

DianaG

Re: How to validate controller XML files

Genius
Genius

Hi Diana,

 

Thank you very much, now it is completely validating the xmls!

 

I misunderstood the method definition thinking that only data service refresh would do the job. 

 

Smiley Happy