Hello Guest it is May 04, 2024, 12:17:16 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

2501
VB and the development of wizards / Re: homing macro and Ismoving
« on: August 31, 2014, 01:25:26 PM »
Hello Gerry,

tryed this already, but i figured out
that without the sleep it does not
wait after the

DoButton(24)

for z-reference.

Thanks Thomas

2502
VB and the development of wizards / homing macro and Ismoving
« on: August 31, 2014, 10:18:48 AM »
Hello together,
first of all excuse my bad english.

after hours of searching i will post my problem here.

i have written a small macro for auto homing and clearing home limit swtiches if
necessary.

here the code:
Code: [Select]
Sub Main()
' -------------------------------------------------------------------------------
' TPS 30.08.2014 
' Referenzschalter freifahren und anschliessend Referenzieren
' -------------------------------------------------------------------------------
'beim Laden des Files Abbrechen
If IsLoading() Then
    GoTo Ende
End If

Message ("Automatische Referenzfahrt")

'Referenz INI Z freifahren
If GetOEMLED(836) Then
Code "G91" ' Inkremental Modus
Code "G0 Z-50" ' Freifahren
WaitMoving
Code "G90" ' Absolut Modus
End If

'Z referenzieren
DoButton(24)   'Zuerst Z
WaitMoving

'Referenz INI X freifahren
If GetOEMLED(830) Then
Code "G91" ' Inkremental Modus
Code "G0 X-50" ' Freifahren
WaitMoving
Code "G90" ' Absolut Modus
End If

'Referenz INI Y freifahren
If GetOEMLED(833) Then
Code "G91" ' Inkremental Modus
Code "G0 Y-50" ' Freifahren
WaitMoving
Code "G90" ' Absolut Modus
End If

'X und Y referenzieren
RefCombination(3) ' dann X und Y
WaitMoving
Code "G54" 'Koordinatenverschiebung ein
Sleep(200) 'warten
    Message (" ") 'Stauszeile löschen
Exit Sub
 '--------------------------------------------------------------------------------

Ende:
 
 Message ("Automatisches Referenzieren Abgebrochen")
   
End Sub   

'Funktion zum warten bis Antrieb steht
Function WaitMoving()
Sleep(200)
While IsMoving()
Sleep(200)
Wend
End Function 


sorry for the german comments.

the problem ist that the macro hangs in about 1 of 50 tryes
at the line

   While IsMoving()

line. if i press the stop button
i get the message:

internal error at line ..


i have no idea what i am doing wrong.

Thanks Thomas

2505
VB and the development of wizards / Re: SetToolDesc problem
« on: July 26, 2012, 09:15:56 AM »
Hi Klaus,

version is: R3.043.058, but i found the problem 5 minutes ago:

 If SetToolDescription(TNum, TDesc) Then 'this is wrong in the example

must be:

 If SetToolDesc(TNum, TDesc) Then

now it works.

regards Thomas

2506
VB and the development of wizards / SetToolDesc problem
« on: July 26, 2012, 04:00:25 AM »
hi all,

tryed the example from

Mach3 Version 3.x
Macro Programmers Reference Manual

to set tool description.

Sub Main

   Dim TNum As Integer
   Dim TDesc As String

   TNum  = 1 ' want to set description for tool # 1
   TDesc = "1/4 135 degree split point drill"

   If SetToolDescription(TNum, TDesc) Then
      Message "Tool description was set"
   Else
      Message "Error setting Tool description"
   End If

End Sub

geting errormessage in VB Scripter : Sub or function not defined:SetToolDescription

any ideas how to fix ?

Thanks Thomas


2507
hello,

i have written a small macro to write values into a file.

macro:
Code: [Select]
'Funktion zum schreiben in INI Datei
Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal LpString As Any, ByVal lpFileName As String) As Long

Sub Main()
' -------------------------------------------------------------------------------
' TPS 25.07.2012 
' Der im P-Parameter übergebene Wert wird für Werkzeug im Q Parameter im Configfile abgelegt
' -------------------------------------------------------------------------------
'beim Laden des Files Abbrechen
If IsLoading() Then
    GoTo Ende
End If

'Übergebene Parameter holen------------------------------------------------------
ZWert    = Param1()
Werkzeug = Param2()
'--------------------------------------------------------------------------------

Dim File    As String
Dim Sektion As String
Dim Eintrag As String
Dim Wert    As String
Dim n       As Long

'Parameter festlegen ------------------------------------------------------------
File    = "C:\Platemaster\Config.txt"
Sektion = "Werkzeuglaengen"
Eintrag = CStr(Werkzeug)
Wert    = CStr(ZWert)
'--------------------------------------------------------------------------------

'Wert schreiben
n = WritePrivateProfileString(Sektion, Eintrag, Wert, File)

'MsgBox (CStr(n))

Ende:
End Sub


tryed for a couple of hours to get it work.
only the file is created but nothing is written.using the same function in VB6 and ist working fine.
probably somebody has an idea, because i  am out of ideas now.

thanks Thomas