Amend module file
ko414du4
✭
Greetings all,
I am trying to add a routine in a module file located in "Home:/".By this, I mean keeping the existing contents and then add a routine at the end of the module just before 'ENDMODULE' line.
=====================================================================
The issue I have now is that function ReadStr() cannot read more than 80 chars. While the existing contents has robtarget data that exceed this limit, and therefore the line is chopped and continued on the next line like below:
=====================================================================
=====================================================================
Is there any way of getting around this ReadStr() limitation of 80 chars? So the line is not chopped?
I am trying to add a routine in a module file located in "Home:/".By this, I mean keeping the existing contents and then add a routine at the end of the module just before 'ENDMODULE' line.
=====================================================================
Code:
=====================================================================
=====================================================================
VAR iodev readingChannel;
VAR iodev writingChannel;
VAR string line;
! Append new recipe routine
Open "HOME:/Recipes.mod",writingChannel\Append;
Write writingChannel,"! New routine here";
Write writingChannel,"PROC newProc()";
Write writingChannel,"! Test";
Write writingChannel,"ENDPROC";
Write writingChannel,"ENDMODULE";
Close writingChannel;
! Read result and get rid of old ENDMODULE lines. Add ENDMODULE to the end instead.
Open "HOME:/Recipes.mod",readingChannel\Read\Bin;
Open "HOME:/temp.mod",writingChannel\Write\Bin;
line:=ReadStr(readingChannel);
WHILE (line<>EOF) DO
IF (line <> "ENDMODULE") Write writingChannel,line;
line:=ReadStr(readingChannel);
ENDWHILE
Write writingChannel,"ENDMODULE";
! Close channels
Close readingChannel;
Close writingChannel;
! Copy temp module to Recipes.mod
Open "HOME:/temp.mod",readingChannel\Read;
Open "HOME:/Recipes.mod",writingChannel\Write;
line:=ReadStr(readingChannel);
WHILE line<>EOF DO
IF (line <> "ENDMODULE") Write writingChannel,line;
line:=ReadStr(readingChannel);
ENDWHILE
Write writingChannel,"ENDMODULE";
! Close channels
Close readingChannel;
Close writingChannel;
Stop;
=====================================================================
=====================================================================
The issue I have now is that function ReadStr() cannot read more than 80 chars. While the existing contents has robtarget data that exceed this limit, and therefore the line is chopped and continued on the next line like below:
=====================================================================
Result:
=====================================================================
=====================================================================
MODULE Recipes
PROC Recipe_33()
opsSets:=[
[1,[[-1819.4,712.469,1163.07],[1.265E-06,0.818184,-0.574957,1.29455E-06]
,[0,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],222,2,222],
[2,[[-2712.47,-1319.4,384.069],[2.08991E-08,-0.985099,-0.171988,-1.80987
E-06],[0,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],33,3,333],
[3,[[-2712.47,-1319.4,384.069],[2.08991E-08,-0.985099,-0.171988,-1.80987
E-06],[0,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],33,3,333],
[0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
[0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
[0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
[0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
[0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
[0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
[0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
[0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
[0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
[0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
[0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
[0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
[0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
[0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
[0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
[0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
[0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
[0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
[0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
[0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
[0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
[0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
[0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
[0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
[0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
[0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
[0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0]]
ENDPROC
! New routine here
PROC newProc()
! Test
ENDPROC
ENDMODULE
Is there any way of getting around this ReadStr() limitation of 80 chars? So the line is not chopped?
Tagged:
0
Comments
-
Why not do the changes in RobotStudio and then save the modified file back to the controller?0
-
graemepaulin said:Why not do the changes in RobotStudio and then save the modified file back to the controller?0
Categories
- All Categories
- 5.5K RobotStudio
- 395 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 310 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