Hello Guest it is December 09, 2019, 03:24:16 PM

Author Topic: Plasma , new macro code  (Read 16877 times)

0 Members and 1 Guest are viewing this topic.

Re: Plasma , new macro code
« Reply #30 on: June 24, 2010, 10:00:47 AM »
I've been working on the same thing this week.  Here is my version.  Runs from a button.

'Code to test gcode travel limits
'John Champlain - June 20, 2010
'
' Save current XYZ positions
CurrX = GetDRO(0)
CurrY = GetDRO(1)
CurrZ = GetDRO(2)
CurrFeed = GetOemDRO(818)
SafeZ = GetOEMDRO(54)
'
'
Dim Msg, Num ' Declare variables.
Title$ = "Check Extents"
Prompt$ = "Enter Feedrate"
Default$ = ""
x% = 75
Y%  =200
Num$ = InputBox(Prompt$, Title$, Default$,X%,Y%) ' Get user input.
'
' Get gcode travel limits
XMin = GetOEMDRO (4)
XMax = GetOEMDRO(10)
YMin = GetOEMDRO(5)
YMax = GetOEMDRO(11)

' Test travel limits
' Move one axis at a time
'
Code "F" & num ' set feedrate
'
'
Code "G1 Z" & SafeZ 'move Z to safe height
While IsMoving ()
Wend
Code "G1 X" & XMin & "Y" & YMin 'move to minimum XY position
While IsMoving ()
Wend
Code "G1 Y" & YMax 'move to maximum Y position
While IsMoving ()
Wend
Code "G1 X" & XMax 'move to maximum X position
While IsMoving ()
Wend
Code "G1 Y" & YMin 'move to minimum Y position
While IsMoving ()
Wend
Code "G1 X" & XMin 'move to minimum X position
While IsMoving ()
Wend
'
' Reset to original settings
Code "G1 X" & CurrX & "Y" & CurrY 'reset X
While IsMoving ()
Wend
Code "G1 Z" & CurrZ 'reset Z
While IsMoving ()
Wend
Code "F" & CurrFeed
Code "(Done)"

Regards All,
John Champlain

Offline budman68

*
  • *
  •  2,360 2,360
    • View Profile
Re: Plasma , new macro code
« Reply #31 on: June 24, 2010, 10:55:21 AM »
Hi John,

Just wanted to let you know your script works correctly for me as well from a button.  :)

Dave
----------------------------------------------------------------------
Just because I'm a Global Moderator, don't assume that I know anything !

Dave->    ;)

Offline BR549

*
  •  6,916 6,916
    • View Profile
Re: Plasma , new macro code
« Reply #32 on: June 24, 2010, 11:05:33 AM »
AH, but you left out the regen toolpath(;-) routine to make sure the extents is accurate. Mach does NOT auto correct the extents in the toolpath. Just make sure you do the SET XYAXIS ZERO and REGEN as a manual function before you run it

Offline budman68

*
  • *
  •  2,360 2,360
    • View Profile
Re: Plasma , new macro code
« Reply #33 on: June 24, 2010, 11:07:43 AM »
That's why I'm guessing it works for me too Terry-

Dave
----------------------------------------------------------------------
Just because I'm a Global Moderator, don't assume that I know anything !

Dave->    ;)
Re: Plasma , new macro code
« Reply #34 on: June 24, 2010, 03:24:16 PM »
Thanks,
I see what you mean about the Regen.
Regards,
John Champlain
Re: Plasma , new macro code
« Reply #35 on: June 24, 2010, 11:23:48 PM »
Code revised from suggestions.  I would appreciate someone testing and giving opinion.

Thanks,
John Champlain

'Code to test gcode travel limits
'John Champlain - June 20, 2010
'
' Save current XYZ positions
CurrX = GetDRO(0)
CurrY = GetDRO(1)
CurrZ = GetDRO(2)
CurrFeed = GetOemDRO(818)
SafeZ = GetOEMDRO(54)
'
'
Dim Msg, Num ' Declare variables.
Title$ = "Check Extents"
Prompt$ = "Enter Feedrate for Test"
Default$ = ""
x% = 75
Y%  =200

Message "Please Wait While Regenerating"
DoOemButton(160)   'Regen ToolPath
While isLoading()
 
Wend
Message ""
Num$ = InputBox(Prompt$, Title$, Default$,X%,Y%) ' Get user input.
'
' Get gcode travel limits
XMin = GetOEMDRO (4)
XMax = GetOEMDRO(10)
YMin = GetOEMDRO(5)
YMax = GetOEMDRO(11)
' Test travel limits
' Move one axis at a time
'
Code "F" & num ' set feedrate
'
'
Code "G1 Z" & SafeZ 'move Z to safe height
While IsMoving ()
Wend
Code "G1 X" & XMin & "Y" & YMin 'move to minimum XY position
While IsMoving ()
Wend
Code "G1 Y" & YMax 'move to maximum Y position
While IsMoving ()
Wend
Code "G1 X" & XMax 'move to maximum X position
While IsMoving ()
Wend
Code "G1 Y" & YMin 'move to minimum Y position
While IsMoving ()
Wend
Code "G1 X" & XMin 'move to minimum X position
While IsMoving ()
Wend
'
' Reset to original settings
Code "G1 X" & CurrX & "Y" & CurrY 'reset X
While IsMoving ()
Wend
Code "G1 Z" & CurrZ 'reset Z
While IsMoving ()
Wend
Code "F" & CurrFeed

DoOEMButton(1002) 'Rewind code

Message "TEST COMPLETE"
Sleep 5000
Message ""
   

Offline budman68

*
  • *
  •  2,360 2,360
    • View Profile
Re: Plasma , new macro code
« Reply #36 on: June 25, 2010, 01:39:19 PM »
This one does not work for me as a button, but works with the VB Editor open.

Dave
----------------------------------------------------------------------
Just because I'm a Global Moderator, don't assume that I know anything !

Dave->    ;)
Re: Plasma , new macro code
« Reply #37 on: June 25, 2010, 01:50:47 PM »
Thanks Dave,
Any clue as to why it won't work from a button for you?  It works both ways for me (editor and button) using Version R3.042.035.

Regards,
John Champlain

Offline budman68

*
  • *
  •  2,360 2,360
    • View Profile
Re: Plasma , new macro code
« Reply #38 on: June 25, 2010, 02:09:01 PM »
Hi John, not a clue as I hardly know anything about VB.

So far all I know is that if it contains the refresh/regen part of the code, it will not work for me.

On the other codes, I just had to edit that out and it works fine from the button.

Dave

« Last Edit: June 25, 2010, 02:12:21 PM by budman68 »
----------------------------------------------------------------------
Just because I'm a Global Moderator, don't assume that I know anything !

Dave->    ;)

Offline BR549

*
  •  6,916 6,916
    • View Profile
Re: Plasma , new macro code
« Reply #39 on: June 25, 2010, 09:31:49 PM »
Dave a question for you(;-)  When you run the code from a button do you put the code "IN" the button OR do you make an "Mcode" from the code and call it from the button?