Find Module containing Proc
KSP
✭
Hello,
Is it possible in RAPID to check if a certain PROC is defined and if so get the name of the module in which it is defined?
We are loading a module from a file using the Load instruction ("Load Test1.mod").
But in some cases it is possible that a module is still loaded ("Test2.mod") which contains a PROC with a name also defined in the module we are trying to load.
Here the (pseudo) code:
We hoped to achieve it with the SetDataSearch i.c.w. the GetNextSym but were not able to find a PROC by name let alone finding the module it is defined.
We hope something like this is possible in RAPID .
Is it possible in RAPID to check if a certain PROC is defined and if so get the name of the module in which it is defined?
We are loading a module from a file using the Load instruction ("Load Test1.mod").
But in some cases it is possible that a module is still loaded ("Test2.mod") which contains a PROC with a name also defined in the module we are trying to load.
Here the (pseudo) code:
procName = "TestProc";
! Check module with PROC exists and delete if so
If <CheckHere> THEN
EraseModule "<NameOfModule>";
ENDIF
! Load module and run the PROC
Load "Test1.mod"
%procName%;
We hoped to achieve it with the SetDataSearch i.c.w. the GetNextSym but were not able to find a PROC by name let alone finding the module it is defined.
We hope something like this is possible in RAPID .
0
Comments
-
Can you make those offending routines local to their respective modules and still retain the desired functionality?Lee Justice0
-
Unfortunately, there is no function in RAPID to determine if a routine already exists. You can only check if a module exists.As already suggested by lemester68, you could declare the routines locally, so that several routines with the same name can exist in the robot system without causing error messages.The call of the routine via late binding looks like this:
%"ModuleName:RoutineName"%;
The module name and the routine name are separated by a colon.0 -
You can try to use the ERRNO to check that.
Like this example maybe:
! You need that when the routine is local declared in other module%"ModuleName:RoutineName%;
! You can use this when the routine is gloable declared
%"RoutineName%;
! example
%"mp"+nActPos+"_p"+nTarget%;ERRORIF ERRNO=ERR_CALLPROC OR ERRNO=ERR_REFUNKPRC THEN! here you can made the error handling with RAISE or RETRY or other logic.ENDIFRETURN;ENDPROC
Maybe is helpfully.
Take care.0
Categories
- All Categories
- 5.5K RobotStudio
- 394 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 309 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 785 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 4 Job listings