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.6K RobotStudio
- 401 UpFeed
- 21 Tutorials
- 15 RobotApps
- 306 PowerPacs
- 407 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.9K Robot Controller
- 363 IRC5
- 80 OmniCore
- 8 RCS (Realistic Controller Simulation)
- 853 RAPID Programming
- 30 AppStudio
- 4 RobotStudio AR Viewer
- 19 Wizard Easy Programming
- 110 Collaborative Robots
- 5 Job listings
