How to load a module in Omnicore? (Addin)
Hello, I've been working on an add-in for a while to push a module into a virtual controller. The code is as follows:
using (Controller controller = Controller.Connect(selectedController.SystemId, ConnectionType.RobotStudio)) controller.Logon(UserInfo.DefaultUser);
using (Controller controller = Controller.Connect(selectedController.SystemId, ConnectionType.RobotStudio)) controller.Logon(UserInfo.DefaultUser);
UserAuthorizationSystem authSystem = controller.AuthenticationSystem;
if (controller == null || !controller.Connected)
{
Logger.AddMessage("Link Failed");
return;
}
if (!authSystem.CheckDemandGrant(Grant.LoadRapidProgram))
{
Logger.AddMessage("Write access refused");
}
else
{
Logger.AddMessage("Write access granted");
}
Logger.AddMessage($"Link at {selectedController.Name}, {selectedController.Version} !");
ABB.Robotics.Controllers.RapidDomain.Task tRob1 = controller.Rapid.GetTask("T_ROB1");
string filePath = @C:\Users\user-reseau\Desktop\code.mod;
string filePath = @C:\Users\user-reseau\Desktop\code.mod;
if (File.Exists(filePath))
{
{
using (Mastership.Request(controller))
{
if (controller.Rapid.ExecutionStatus == ABB.Robotics.Controllers.RapidDomain.ExecutionStatus.Stopped)
{
bool loaded = tRob1.LoadModuleFromFile(filePath, RapidLoadMode.Replace);
Logger.AddMessage(loaded ? "Load success." : "Module loading failed.");
System.Threading.Thread.Sleep(1000);
}
else
{
Logger.AddMessage("Error 10");
}
}
}
}
It works perfectly on IRC5 without any issues, but as soon as I switch to an Omnicore virtual controller, I get the following error and can't seem to get rid of it.
RobotStudio .NET exception: C004A00C : File not found or could not be opened for reading.
It works perfectly on IRC5 without any issues, but as soon as I switch to an Omnicore virtual controller, I get the following error and can't seem to get rid of it.
RobotStudio .NET exception: C004A00C : File not found or could not be opened for reading.
LoadModuleFile
Does anyone have an idea? What is the correct method with Omnicore?
Does anyone have an idea? What is the correct method with Omnicore?
0
Answers
-
omnicore uses .modx files, have you tried this?Systemintegrator - Web / C# / Rapid / Robotstudio
If I helped, please press Vote Up
☑️2024 - RobotStudio® User Group0 -
Yes, I have tried it, and it does not work.0
Categories
- All Categories
- 5.6K RobotStudio
- 398 UpFeed
- 20 Tutorials
- 13 RobotApps
- 299 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 328 IRC5
- 66 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 822 RAPID Programming
- 9 AppStudio
- 3 RobotStudio AR Viewer
- 19 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings