Hello Guest it is March 19, 2024, 01:03:29 AM

Author Topic: Rewind to previous sequence in G-code  (Read 10607 times)

0 Members and 1 Guest are viewing this topic.

Rewind to previous sequence in G-code
« on: February 19, 2012, 05:36:25 AM »
I have a difficult task for you  ;)

I've built a screen that builds a cutting G-code program based of inputs from the user.

The program is simple and consist of [start parameters] -> [x number of cuts in a sequence] -> [End Parameters]

My question for you: Is it possible for the user to be able to rewind to the previous cutting sequence?

=> User is running cut number 2 -> User stops in the middle of the procedure -> Press "Rewind" button -> VB set next line to the start of Cut number 2 -> Press start



Program example:

->Parameters<-

Cut 1
.
.
Cut 2
.
.
And so on...
.
.
->End<-

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Rewind to previous sequence in G-code
« Reply #1 on: February 19, 2012, 11:16:46 AM »
It depends on HOW you are using the parameters.  IF the values are just presets and never change then yes you can restart. BUT if the vlaues are calculated as you go then NO as the rewind and prestest of the Gcode cannot run the calculations and solve for all the unknowns.

It IS possible inside of CB to JUMP from CB  to a point in a Gcode Program.

(;-) TP
Re: Rewind to previous sequence in G-code
« Reply #2 on: February 21, 2012, 02:05:42 PM »
The complete Gcode is calculated pre start based of the parameters that is collected from the user interface. Eg. the Gcode is static.

My first thought:

1. Program Start
2. Program STOP
3. User press "Rewind to last cut" [<]
4. CB check current Gcode line
5. CB opens file -> searches Gcode for keyword like "Cut"
6. CB determines which "cut" that is closest (backwards) to current line
7. CB set next line
8. User is happy, and press Start to try again!


Please tell me there is a better way :)

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Rewind to previous sequence in G-code
« Reply #3 on: February 21, 2012, 02:35:45 PM »
At each section of Gcode place the o word holder

o001

code
code

o002

From inside a CB macro,  code" M98 P002"  ,and it will take you to the o002 position. Press run or code the dooembutton() and off you go.

(;-) TP
Re: Rewind to previous sequence in G-code
« Reply #4 on: February 21, 2012, 02:49:37 PM »
Good one!

How to keep track of which was the latest cut (there can be several)?

Re: Rewind to previous sequence in G-code
« Reply #5 on: February 26, 2012, 02:15:52 PM »
Problem solved, M-macros within the G-code keep track of this parameters for me

Thanks for the input

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Rewind to previous sequence in G-code
« Reply #6 on: February 26, 2012, 03:59:40 PM »
Another easy way to track the cuts is to use a #var to assign it the latest cut#

#100 = 1

code
code
code

#100=2

Code
code
code
#100 = 3

That way when you need to rewind, the Value of #100 = the last cut you were on. Make the #100 the same as the oword.

Just a thought, (;-) TP