Dear All
According to PC SDK user manual v2, I wrote some codes by CAPI to connect virtual controller and load RAPID module as follows:
… …
m_controller = ControllerFactory.CreateFrom(controller);
m_controller.Logon(UserInfo.DefaultUser);
if(m_controller.OperatingMode != ControllerOperatingMode.Auto)
{
//set to Auto mode
VirtualPanel vp = VirtualPanel.Attach(m_controller);
vp.ChangeMode(ControllerOperatingMode.Auto);
}
using(Mastership master = Mastership.Request(m_controller.Rapid))
{
try
{
Task taskMain = m_controller.Rapid.GetTask(“T_ROB1”);
taskMain.LoadProgramFromFile(“C:\Data\System1\HOME\MainMod.pgf”, RapidLoadMode.Replace);
master.Release();
}
catch(GeneralException)
{
master.Release();
throw;
}
}
The code did work until calling LoadProgramFromFile/LoadModuleFromFile, which threw InternalException. “CDataSystem1Internal” is the directory of virtual controller.
Could you please tell me the correct way to use LoadProgramFromFile/LoadModuleFromFile? Thanks.