Hello Guest it is May 18, 2024, 07:25:21 PM

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

201
German / Re: Mach3 nimmt G-Code nicht an
« on: August 05, 2022, 05:05:17 AM »
Servus Manfred,
habe die beiden Dateien bei mir problemlos laden können.

Hast Du schon Mal in der Datei: C:\Mach3\lasterror.txt geschaut, ob es da Einträge gibt?

Gruß Tom

202
VB and the development of wizards / Re: position memorization
« on: August 05, 2022, 04:47:55 AM »
Code: [Select]
Dim X,Y as Double
  Open "C:\Mach3\myFile.txt" For Output As #1
  X = GetDRO(0)
  Y = GetDRO(1)
  Print #1, X
  Print #1, Y
  Close #1

Code: [Select]
Dim Answer
Dim newPosX, newPosY As Double
  Open "C:\Mach3\myFile.txt" For Input As #2              'Open the file for reading
  Line Input #2, newPosX                                                      'Read the first line of the file
  Line Input #2, newPosY                                                      'Read the second line of the file

  Answer = MsgBox ("Is it OK to move the X axis to: " & newPos & "?", 1)

  If Answer = 1 Then                                                           'You pressed OK
    Code "G0 X"& newPosX & " Y" & newPosY                                                  'Make the move
  End If

  Close #2               

NOT TESTED

203
General Mach Discussion / Re: Start VB Script with button wired to input
« on: August 05, 2022, 04:41:11 AM »
basicly OEMTriggers are used like regular input's but they Special functionalty

1st. you can assign in Config->System hotkeys oemcodes to a OEMtrigger witch will be done once if OEMTrigger comes true

2nd. you can define a triggermacro by SetTriggerMacro(number)

normaly done this way.

-add for example in Config->General Config ->Initialisation string  M333, that means every time you reset M333.M1s is called

-within M333.M1s add the VB code SetTriggerMacro(334)

-assign in Config->System hotkeys oemcodes to a OEMtrigger the code 301 witch means run triggermacro

so every time the OEMTrigger Comes True the VB Code within M334.M1S will run once.

hope i was able to explain the Basics of OEMTriggers in my bad bavarian english.

205
you can use your own scripts to create the file.

for example create a file M400.m1s in your macro folder to get the filename, M401 is called only at the
beginning of your G-Code.

code for M400.m1s:
Code: [Select]
'M400 for digtizing
'get the filename for digfile from user

Sub Main()
 If NOT Isloading() then
Dim  FNum, FName ' Declare variables.
'get Filename from user

Begin Dialog TextBoxSample 16,30,180,96,"enter digfilename"
OKButton 132,20,40,14
Text 8,8,132,8,"filename without extension:"
TextBox 8,20,100,12,.TextBox1
Text 8,44,132,8,"file will be in c:\Mach3\GCode"
End Dialog
Dim Dlg1 As TextBoxSample


Dialog Dlg1
SetUserLabel(255, Dlg1.TextBox1)

'open the to file errase all existing data
FNum = FreeFile ' Determine next file number.
FName = "C:\Mach3\GCode\" + GetUserLabel(255) + ".nc"
Open FName For Output As FNum ' Open file.
Close ' Close all files.
SetUserDro(1166,1)
   End If
End Sub

now create a file M401.m1s in your macro folder witch is called afte each G31 to save the values.

code for M401.m1s
Code: [Select]
'M401 for digtizing
'write the values into digfile

Sub Main()
Dim  FNum, FName ' Declare variables.

'wait for axis standstill
WaitForMove

'open the file for output data data
FNum = FreeFile ' Determine next file number.
FName = "C:\Mach3\GCode\" + GetUserLabel(255) + ".nc"
Open FName For Append As FNum ' Open file.
Print #FNum, nFmt(GetDro(0),4) & "," & nFmt(GetDro(1),4) & "," & nFmt(GetDro(2),4) 
Close ' Close all files.

End Sub

'global Sub's
Sub WaitForMove ()
While IsMoving()
Sleep(5)
Wend
End Sub

code is not tested, just written down

206
VB and the development of wizards / Re: scan problem
« on: July 09, 2022, 10:02:44 AM »
use:
Code: [Select]
Print #1, nFmt(X,4) & "," & nFmt(Y,4) & "," & nFmt(Z,4)
insteed:
Code: [Select]
Write #1, Format(X,"###0.000") , Format(Y,"###0.000") , Format(Z,"###0.000")

207
VB and the development of wizards / Re: scan problem
« on: July 09, 2022, 02:42:18 AM »
try to replace:
Code: [Select]
Write #1, X , Y, Z

by:
Code: [Select]
Write #1, Format(X,"###0.000") , Format(Y,"###0.000") , Format(Z,"###0.000")

208
your controller may support G31 what is enough for a "simple" probing, but am pretty sure
it is not supporting the update of the var's 2000-2002.

209
General Mach Discussion / Re: call a Macro with Input external
« on: July 03, 2022, 01:01:39 PM »
do a forum search for: SetTriggerMacro
and you will find the answer.

210
ich tippe auf Abschirmungsprobleme. Ist das Spindelmotorkabel abgeschirmt? alle PE Verbindungen sauber aufgelegt?

Gruß Tom