Hello Guest it is April 23, 2024, 07:37:26 AM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - TPS

2081
General Mach Discussion / Re: G49 on Mach3 Mill
« on: February 07, 2018, 06:05:56 AM »
have you tryed to run this code (sent this on page 4 of this thread):

Code: [Select]
'Make the MSComDlg.CommonDialog class available for use. Required for filedialog function.
function registerComDlg
    Set objRegistry = GetObject("winmgmts:\\.\root\default:StdRegProv")
    objRegistry.CreateKey &H80000001, "Software\CLASSES\Licenses\4D553650-6ABE-11cf-8ADB-00AA00C00905"
    objRegistry.SetStringValue &H80000001, "Software\CLASSES\Licenses\4D553650-6ABE-11cf-8ADB-00AA00C00905", "", "gfjmrfkfifkmkfffrlmmgmhmnlulkmfmqkqj"
end function

once in vbscripter window to Register MSComDlg ?

2082
G-Code, CAD, and CAM discussions / Re: Mach3 Error when running G-code
« on: February 06, 2018, 02:51:21 PM »
just have a look into your GCode file, for example the big circle:

N239020G2X0.3354Y-6.0715I-6.0636J0.4566F100.0
N239030G1Z-0.6450
N239040G1X0.1678Y-6.0785
N239050G1X0.0000Y-6.0808
N239060G1X-0.2938Y-6.0737
N239070G1X-0.5870Y-6.0524
N239080G1Z-0.7700F30.0
N239090G2X-6.0636Y-0.4566I0.5870J6.0524F100.0
N239100G1Z-0.6450
N239110G1X-6.0765Y-0.2284
N239120G1X-6.0808Y0.0000
N239130G1X-6.0764Y0.2313
N239140G1X-6.0632Y0.4623
N239150G1Z-0.7700F30.0
N239160G2X-0.6194Y6.0492I6.0632J-0.4623F100.0
N239170G1Z-0.6450
N239180G1X-0.4134Y6.0667
N239190G1X-0.2068Y6.0773
N239200G1X0.0000Y6.0808
N239210G1X0.2950Y6.0736
N239220G1Z-0.7700F30.0
N239230G2X6.0634Y0.4594I-0.2950J-6.0736F100.0

the ist nothing bigger than 6.something Inch

also if you have a look in Standard Screen set (1024 -> tool path)  for the
Programm Limits, they are +/- 6.08",

so why should  the result be bigger than this ?





2083
a first easy step would be,
to check the voltage with a Voltmeter
at the dir pin.
 

2084
General Mach Discussion / Re: G49 on Mach3 Mill
« on: February 06, 2018, 05:53:09 AM »
---
If it can take this many cycles to get a FileLoad screen right
---

i'm realy sorry, i needed so much tryes to get it working perfect.

Thomas

2085
General Mach Discussion / Re: G49 on Mach3 Mill
« on: February 06, 2018, 04:14:20 AM »
Aaah nice but,,,

The load is now 100% sensible but Its broken the cancel buttons again :(

Pressing cancel is the same as pressing load.

courios not so here, everytime i press the cancel button, script does nothing and
"user cancel" is displayed in Status line ?

maybe you can debug in VB Scripter window.

2086
General Mach Discussion / Re: G49 on Mach3 Mill
« on: February 06, 2018, 03:53:43 AM »
Code: [Select]
' ---------------------------------------------------------------------------------
' TPS 02/2018 
' macro to open GCode file and comment out all G43
' ---------------------------------------------------------------------------------
Sub Main()
On Error GoTo errhandler

'get the source file
Dim Filename As String
Dim Dialog1

    Set Dialog1 = CreateObject("MSComDlg.CommonDialog")
    Dialog1.MaxFileSize = 256
    Dialog1.Filter = "GCode Files (*.tap)|*.tap"
    Dialog1.FilterIndex = 1
    Dialog1.DialogTitle = "select GCode file"
    Dialog1.InitDir = GetUserLabel(200)
    Dialog1.CancelError = True
    'get the last selection
    Dialog1.FileName = ""
    save = false
    If save = true Then
        Dialog1.DefaultExt = def
        Dialog1.Flags = &H800 + &H4
        discard = Dialog1.ShowSave()
    Else
        Dialog1.Flags = &H1000 + &H4 + &H800
        discard = Dialog1.ShowOpen()
    End If

FileName = Dialog1.FileName
If Len(FileName) = 0 Then
message "no source file selected"
Exit Sub
End If
'store last selection
SetUserLabel(200,CurDir)

'find the last "\" in filename
For i = 1 To Len(FileName)
If Mid(FileName,i,1) = "\" Then
last = i
End If
Next i

'extract filename
myfilename = Mid(FileName,last+1,Len(FileName)-last)

'get the destination folder
Dim destfile As String

    Dialog1.DialogTitle = "select destination folder and filename"
    'get the last selection
    Dialog1.FileName = GetUserLabel(201) + "\" + myfilename
    Dialog1.InitDir = GetUserLabel(201)

    save = true
    If save = true Then
        Dialog1.DefaultExt = def
        Dialog1.Flags = &H800 + &H4
        discard = Dialog1.ShowSave()
    Else
        Dialog1.Flags = &H1000 + &H4 + &H800
        discard = Dialog1.ShowOpen()
    End If

destfile = Dialog1.FileName

If Len(destfile) = 0 Then
message "no destination file selected"
  Exit Sub
End If
  'store last selection
SetUserLabel(201,CurDir)

'open input file
FNumInput    = FreeFile 'Determine next file number.
Open FileName For Input As FNumInput

'open output file
FNumOutput = FreeFile 'Determine next file number.
Open "C:\Mach3\GCode\import.txt" For Output As FNumOutput

actions = 0
'go through To whole file
Do While Not EOF(FNumInput)
Line Input #FNumInput, FileData ' Read a line of data.
If ((InStr(FileData,"G43") <> 0) And (Left(FileData,1) <> "(")) Then
Print #FNumOutput, "( " + FileData + " )"
actions = actions + 1
Else
Print #FNumOutput, FileData
End If
Loop


Close ' Close all open files.
message CStr(actions) + " G43 have been found"
DoOEMButton(169) 'close Mach3 files just in case
SourceFile = "C:\Mach3\GCode\import.txt"

FileCopy SourceFile, destfile ' Copy source to target.
Kill SourceFile
LoadFile( destfile)
Exit Sub
errhandler:
message "user cancel"
End Sub




2087
General Mach Discussion / Re: G49 on Mach3 Mill
« on: February 06, 2018, 03:36:27 AM »
next test
Code: [Select]

' ---------------------------------------------------------------------------------
' TPS 02/2018 
' macro to open GCode file and comment out all G43
' ---------------------------------------------------------------------------------
Sub Main()
On Error GoTo errhandler

'get the source file
Dim Filename As String
Dim Dialog1

    Set Dialog1 = CreateObject("MSComDlg.CommonDialog")
    Dialog1.MaxFileSize = 256
    Dialog1.Filter = "GCode Files (*.tap)|*.tap"
    Dialog1.FilterIndex = 1
    Dialog1.DialogTitle = "select GCode file"
    Dialog1.InitDir = "C:\Mach3\GCode"
Dialog1.CancelError = True
    'get the last selection
    Dialog1.FileName = GetUserLabel(200)
    save = false
    If save = true Then
        Dialog1.DefaultExt = def
        Dialog1.Flags = &H800 + &H4
        discard = Dialog1.ShowSave()
    Else
        Dialog1.Flags = &H1000 + &H4 + &H800
        discard = Dialog1.ShowOpen()
    End If

FileName = Dialog1.FileName
If Len(FileName) = 0 Then
message "no source file selected"
Exit Sub
End If
'store last selection
SetUserLabel(200,FileName)

'get the destination folder
Dim destfile As String

    Dialog1.DialogTitle = "select destination folder and filename"
    'get the last selection
    Dialog1.FileName = ""
    Dialog1.InitDir = GetUserLabel(201)

    save = true
    If save = true Then
        Dialog1.DefaultExt = def
        Dialog1.Flags = &H800 + &H4
        discard = Dialog1.ShowSave()
    Else
        Dialog1.Flags = &H1000 + &H4 + &H800
        discard = Dialog1.ShowOpen()
    End If

destfile = Dialog1.FileName

If Len(destfile) = 0 Then
message "no destination file selected"
  Exit Sub
End If
  'store last selection
SetUserLabel(201,CurDir)

'open input file
FNumInput    = FreeFile 'Determine next file number.
Open FileName For Input As FNumInput

'open output file
FNumOutput = FreeFile 'Determine next file number.
Open "C:\Mach3\GCode\import.txt" For Output As FNumOutput

actions = 0
'go through To whole file
Do While Not EOF(FNumInput)
Line Input #FNumInput, FileData ' Read a line of data.
If ((InStr(FileData,"G43") <> 0) And (Left(FileData,1) <> "(")) Then
Print #FNumOutput, "( " + FileData + " )"
actions = actions + 1
Else
Print #FNumOutput, FileData
End If
Loop


Close ' Close all open files.
message CStr(actions) + " G43 have been found"
DoOEMButton(169) 'close Mach3 files just in case
SourceFile = "C:\Mach3\GCode\import.txt"

FileCopy SourceFile, destfile ' Copy source to target.
Kill SourceFile
LoadFile( destfile)
Exit Sub
errhandler:
message "user cancel"
End Sub



2088
General Mach Discussion / Re: G49 on Mach3 Mill
« on: February 06, 2018, 02:46:47 AM »
next try

Code: [Select]
Sub Main()
On Error GoTo errhandler

'get the source file
Dim Filename As String
Dim Dialog1

    Set Dialog1 = CreateObject("MSComDlg.CommonDialog")
    Dialog1.MaxFileSize = 256
    Dialog1.Filter = "GCode Files (*.tap)|*.tap"
    Dialog1.FilterIndex = 1
    Dialog1.DialogTitle = "select GCode file"
    Dialog1.InitDir = "C:\Mach3\GCode"
    Dialog1.CancelError = True
    'get the last selection
    Dialog1.FileName = GetUserLabel(200)
    save = false
    If save = true Then
        Dialog1.DefaultExt = def
        Dialog1.Flags = &H800 + &H4
        discard = Dialog1.ShowSave()
    Else
        Dialog1.Flags = &H1000 + &H4 + &H800
        discard = Dialog1.ShowOpen()
    End If

FileName = Dialog1.FileName
If Len(FileName) = 0 Then Exit Sub
'store last selection
SetUserLabel(200,FileName)

'get the destination folder
Dim destfile As String

    Dialog1.DialogTitle = "select destination folder and filename"
    'get the last selection
    Dialog1.FileName = GetUserLabel(201)

    save = true
    If save = true Then
        Dialog1.DefaultExt = def
        Dialog1.Flags = &H800 + &H4
        discard = Dialog1.ShowSave()
    Else
        Dialog1.Flags = &H1000 + &H4 + &H800
        discard = Dialog1.ShowOpen()
    End If

destfile = Dialog1.FileName

If Len(destfile) = 0 Then Exit Sub
'store last selection
SetUserLabel(201,destfile)

'open input file
FNumInput    = FreeFile 'Determine next file number.
Open FileName For Input As FNumInput

'open output file
FNumOutput = FreeFile 'Determine next file number.
Open "C:\Mach3\GCode\import.txt" For Output As FNumOutput

'go through To whole file
Do While Not EOF(FNumInput)
Line Input #FNumInput, FileData ' Read a line of data.
If ((InStr(FileData,"G43") <> 0) And (Left(FileData,1) <> "(")) Then
Print #FNumOutput, "( " + FileData + " )"
Else
Print #FNumOutput, FileData
End If
Loop


Close ' Close all open files.
DoOEMButton(169) 'close Mach3 files just in case
SourceFile = "C:\Mach3\GCode\import.txt"

FileCopy SourceFile, destfile ' Copy source to target.
Kill SourceFile
LoadFile( destfile)

errhandler:

End Sub


2089
General Mach Discussion / Re: G49 on Mach3 Mill
« on: February 05, 2018, 02:26:14 PM »
--> cancel buttons appear to have the same effect as the ok buttons Wink

that is a "side" effect from --> Persistent file dialogues

because the Dialog1.FileName has now allready a value in.

i will have a look tomorrow, how to get the value out witch button was pressed.
 
Thomas


2090
General Mach Discussion / Re: G49 on Mach3 Mill
« on: February 05, 2018, 01:30:06 PM »
ok here is the Version with pathes remembered and Abort on the wright place

used Userlabel 200 and 201 just Change if allready in use

Code: [Select]
Sub Main()
'get the source file
Dim Filename As String
Dim Dialog1

    Set Dialog1 = CreateObject("MSComDlg.CommonDialog")
    Dialog1.MaxFileSize = 256
    Dialog1.Filter = "GCode Files (*.tap)|*.tap"
    Dialog1.FilterIndex = 1
    Dialog1.DialogTitle = "select GCode file"
    Dialog1.InitDir = "C:\Mach3\GCode"
    'get the last selection
    Dialog1.FileName = GetUserLabel(200)
    save = false
    If save = true Then
        Dialog1.DefaultExt = def
        Dialog1.Flags = &H800 + &H4
        discard = Dialog1.ShowSave()
    Else
        Dialog1.Flags = &H1000 + &H4 + &H800
        discard = Dialog1.ShowOpen()
    End If

FileName = Dialog1.FileName
If Len(FileName) = 0 Then Exit Sub
'store last selection
SetUserLabel(200,FileName)

'get the destination folder
Dim destfile As String

    Dialog1.DialogTitle = "select destination folder and filename"
    'get the last selection
    Dialog1.FileName = GetUserLabel(201)

    save = true
    If save = true Then
        Dialog1.DefaultExt = def
        Dialog1.Flags = &H800 + &H4
        discard = Dialog1.ShowSave()
    Else
        Dialog1.Flags = &H1000 + &H4 + &H800
        discard = Dialog1.ShowOpen()
    End If

destfile = Dialog1.FileName

If Len(destfile) = 0 Then Exit Sub
'store last selection
SetUserLabel(201,destfile)

'open input file
FNumInput    = FreeFile 'Determine next file number.
Open FileName For Input As FNumInput

'open output file
FNumOutput = FreeFile 'Determine next file number.
Open "C:\Mach3\GCode\import.txt" For Output As FNumOutput

'go through To whole file
Do While Not EOF(FNumInput)
Line Input #FNumInput, FileData ' Read a line of data.
If ((InStr(FileData,"G43") <> 0) And (Left(FileData,1) <> "(")) Then
Print #FNumOutput, "( " + FileData + " )"
Else
Print #FNumOutput, FileData
End If
Loop


Close ' Close all open files.
DoOEMButton(169) 'close Mach3 files just in case
SourceFile = "C:\Mach3\GCode\import.txt"

FileCopy SourceFile, destfile ' Copy source to target.
Kill SourceFile
LoadFile( destfile)

End Sub