Multiple O103 repeat [n] in a single file

More
7 years 10 months ago #122124 by thadwald
I am using the O103 repeat[n] function to do some repetitive incremental moves. This works fine until I try to use a second O103 in the program. Then i get an error saying “error duplicate o-word o103.”

What am I doing wrong?

Please Log in or Create an account to join the conversation.

More
7 years 10 months ago #122126 by Todd Zuercher
While you can call an o sub multiple times (same o number), but an o repeat command can only be used once in a g-code program. To do multiple repeat commands you will have to use a unique number for each repeat call that you use in a g-code program.

To do what I think you want to do I would suggest putting your repeat within an o sub, then call the o sub repeatedly throughout your g-code program.

Please Log in or Create an account to join the conversation.

More
7 years 10 months ago - 7 years 10 months ago #122205 by thadwald
Your suggestion to place the repeat into an o code would work for this particular program. But suppose I wanted to write a program with multiple repeats, each of which is different. How would I approach this? Will either of the other two looping commands (while/endwhile, do/while)let me create multiple loops in one program?
Last edit: 7 years 10 months ago by thadwald.

Please Log in or Create an account to join the conversation.

More
7 years 10 months ago #122209 by Todd Zuercher
You can have multiple repeats in a program, but they each have to use a different o-number. Same with other o-commands.
The following user(s) said Thank You: thadwald

Please Log in or Create an account to join the conversation.

More
7 years 10 months ago #122210 by thadwald
Well!

Thank you for pointing that out. I'll try that.

If I may ask, what then is the purpose of the o-number?

Please Log in or Create an account to join the conversation.

More
7 years 10 months ago - 7 years 10 months ago #122213 by Todd Zuercher
For example here is an array repeat that will make rows and colums of some code using 2 repeat commands (one nested inside the other).
Code:
#1=3 (number of items on Y) #2=5 (number of items on X) #3=2.38 (column spacing for X) #4=23.5 (row spacing for Y) O100 sub (insert some g-code you want repeated here) O100 endsub O102 repeat [#1] (number of rows Y repeats) O103 repeat [#2] (number of columns X repeats) O100 call G0 X#3 Y0 (width of columns) G92 X0Y0 O103 end repeat G0 X[#3*-#2] G92X0 G0 X0 Y#4 (length of rows) G92 X0Y0 O102 endrepeat G92.1
Last edit: 7 years 10 months ago by Todd Zuercher.
The following user(s) said Thank You: thadwald

Please Log in or Create an account to join the conversation.

Time to create page: 0.245 seconds
Powered by Kunena Forum