Hello
You can use this script in CamBam to revert G2/G3 in a selected GCode file.
There is no "standard" file requester to browse the file (I can't remember how to get it with script), so you must type the file name with it extension in the box when the script ask for it (ex: myfile.nc)
the path where the script will searche for the file is fixed by the line: Dim path as string ="C:\"
you can change the text in boldface to the path you want.
to use it:
Unpack the file in attachment and move the remaining .vbs file to your cambam script folder
Open the script through the cambam script menu
if your files are not on C:\ , change the path in the code to match the one of your files as explained above.
run the script > give the file name to convert when the box appears
the converted Gcode will appears in the cambam log windows and a new file is created as arcrevert_filename.xx in the same folder than the source file.
the code (the same as in attachment)
' New CamBam VBScript
' revert G2/G3 in GCode file
sub main
Dim line, line2 As String
Dim path as string ="C:\"
Dim fname as string, outname as string
fname = InputBox("file:","","")
if fname = "" then exit sub
outname = path & "arcrevert_" & fname
Try
Using sr As System.IO.StreamReader = New System.IO.StreamReader(path & fname)
FileOpen(1, outname, OpenMode.Output)
Do
line = sr.ReadLine()
if InStr(line,"G3 ")= 1 then 'G3 found
line = Replace(line,"G3 ","G2 ")
else if InStr(line,"G2")= 1 then 'G2 found
line = Replace(line,"G2 ","G3 ")
end if
app.log(line)
PrintLine(1, line)
Loop Until line Is Nothing
sr.Close()
End Using
Catch E As Exception
End Try
FileClose(1)
end sub
++
David