The type or namespace name 'Modules' could not be found
Jorge
✭✭
Hello, I trying this example from flexpendan sdk, And I got this error while trying to compile:
Error 1 The type or namespace name 'Modules' could not be found (are you missing a using directive or an assembly reference?) C:\Users\W7\Documents\Visual Studio 2008\Projects\TpsViewIRC5WartsilaApp\TpsViewIRC5WartsilaApp\view.cs 184 18 TpsViewIRC5WartsilaApp
This is the exampled extracted from SDK help
private int CountRoutines(Controller c)
{
int result = 0;
Task[] tasks;
try
{
tasks = c.Rapid.GetTasks();
Modules modules;
// Iterate tasks
foreach (Task t in tasks)
{
// Get all modules of the task
modules = t.GetModules();
Routines routines;
foreach (Module m in modules)
{
// Get all routines of the module
routines = m.GetRoutines();
result += routines.Lenght;
}
}
}
catch (GeneralException ee)
{
// TODO: Add error handling
}
catch (System.Exception ee)
{
// TODO: Add error handling
}
return result;
}
{
int result = 0;
Task[] tasks;
try
{
tasks = c.Rapid.GetTasks();
Modules modules;
// Iterate tasks
foreach (Task t in tasks)
{
// Get all modules of the task
modules = t.GetModules();
Routines routines;
foreach (Module m in modules)
{
// Get all routines of the module
routines = m.GetRoutines();
result += routines.Lenght;
}
}
}
catch (GeneralException ee)
{
// TODO: Add error handling
}
catch (System.Exception ee)
{
// TODO: Add error handling
}
return result;
}
Any Idea?
Thanks for help
Jorge Turiel
Tagged:
0
Answers
-
Hi Jorge, the data types Modules and Routines don't exist.
The methods getRoutines and getModules return an array.
Here is the correct code.private int CountRoutines(Controller c){int result = 0;Task[] tasks;try{tasks = c.Rapid.GetTasks();Module[] modules;// Iterate tasksforeach (Task t in tasks){// Get all modules of the taskmodules = t.GetModules();Routine[] routines;foreach (Module m in modules){// Get all routines of the moduleroutines = m.GetRoutines();result += routines.Length;}}}catch (GeneralException ee){// TODO: Add error handling}catch (System.Exception ee){// TODO: Add error handling}return result;}Best regards,
//U.0 -
Thanks for your help, It's works/JJorge Turiel0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 316 IRC5
- 61 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 798 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings