Hello Guest it is December 12, 2024, 01:14:12 PM

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

0 Members and 1 Guest are viewing this topic.

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • www.razordance.co.uk
Re: Plasma , new macro code
« Reply #20 on: June 22, 2010, 04:30:24 PM »
well - not being able to leave things alone  ;D I've come up with a version that SEEMS stable at my end. Note the comment at the top of the file - It MUST be run from a button.

Ian

Code: [Select]
'This macro MUST be run from a button
'running it from the MDI for example is not recommended

Begin Dialog Dialog1 60, 60, 104, 70, "Auto Extents"
Text 10, 10, 30, 12, "Feedrate:"
TextBox 44, 10, 50, 12, .feedrate
Text 10, 24, 30, 12, "Dwell:"
TextBox 44, 24, 50, 12, .dwell
Text 10, 38, 30, 12, "Z height:"
TextBox 44, 38, 50, 12, .zHeight

OKButton 10, 54, 40, 12
CancelButton 54,54,40,12
End Dialog

Dim Dlg1 As Dialog1

Dlg1.feedrate=getOEMDRO(818)
Dlg1.dwell=1
Dlg1.zHeight=getOEMDRO(802)

button=Dialog(Dlg1)

If button <> -1 Then
  Exit Sub
End If

DoButton(8)      'ZeroX
DoButton(9)      'ZeroY
While isMoving()
Wend

DoOemButton(160) 'Regen ToolPath
While isLoading()
  sleep 100
Wend

doOEMButton(1002) 'Rewind
While isMoving()
  sleep 100
Wend

xmin = minX()
xmax = maxX()
ymin = minY()
ymax = maxY()

dwell=Dlg1.dwell * 1000

Code "F" & Dlg1.feedRate & " G1 Z" & Dlg1.zHeight
While Ismoving()
  sleep 100
Wend

Code "G1 X" & xmin & " Y" & ymin
While Ismoving()
  sleep 100
Wend

sleep dwell

Code "G1 Y" & ymax
While Ismoving()
  sleep 100
Wend

sleep dwell

Code "G1 X" & xmax
While Ismoving()
  sleep 100
Wend

sleep dwell

Code "G1 Y" & ymin
While Ismoving()
  sleep 100
Wend

sleep dwell

Code "G1 X" & xmin   
While Ismoving()
  sleep 100
Wend

MsgBox "Finished",0,"Auto Extents"   

Offline budman68

*
  • *
  •  2,352 2,352
Re: Plasma , new macro code
« Reply #21 on: June 22, 2010, 05:21:44 PM »
Well thanks for trying Ian, unfortunately same thing for me.

It runs great running it from the VB Editor, but running from the button, it once again cycles through and then the run time just counts up as if the GCode is running.

The new pop up dialog box threw me a bit too, lol!

I appreciate your persistance  ;)
Dave

EDIT: I just don't get it, why does it run perfectly through the Editor when open, but not from a button? Is there another way to code a button to do this?
----------------------------------------------------------------------
Just because I'm a Global Moderator, don't assume that I know anything !

Dave->    ;)

Offline budman68

*
  • *
  •  2,352 2,352
Re: Plasma , new macro code
« Reply #22 on: June 22, 2010, 05:40:57 PM »
Ok, may have found something. Ian, I've deleted a bit of your code and got it working.

You'll notice I deleted:

Code: [Select]
DoButton(8)      'ZeroX
DoButton(9)      'ZeroY
While isMoving()
Wend

DoOemButton(160) 'Regen ToolPath
While isLoading()
  sleep 100
Wend

doOEMButton(1002) 'Rewind
While isMoving()
  sleep 100
Wend




Now is this going to be safe?

Code: [Select]
'This macro MUST be run from a button
'running it from the MDI for example is not recommended

Begin Dialog Dialog1 60, 60, 104, 70, "Auto Extents"
Text 10, 10, 30, 12, "Feedrate:"
TextBox 44, 10, 50, 12, .feedrate
Text 10, 24, 30, 12, "Dwell:"
TextBox 44, 24, 50, 12, .dwell
Text 10, 38, 30, 12, "Z height:"
TextBox 44, 38, 50, 12, .zHeight

OKButton 10, 54, 40, 12
CancelButton 54,54,40,12
End Dialog

Dim Dlg1 As Dialog1

Dlg1.feedrate=getOEMDRO(818)
Dlg1.dwell=1
Dlg1.zHeight=getOEMDRO(802)

button=Dialog(Dlg1)

If button <> -1 Then
  Exit Sub
End If

xmin = minX()
xmax = maxX()
ymin = minY()
ymax = maxY()

dwell=Dlg1.dwell * 1000

Code "F" & Dlg1.feedRate & " G1 Z" & Dlg1.zHeight
While Ismoving()
  sleep 100
Wend

Code "G1 X" & xmin & " Y" & ymin
While Ismoving()
  sleep 100
Wend

sleep dwell

Code "G1 Y" & ymax
While Ismoving()
  sleep 100
Wend

sleep dwell

Code "G1 X" & xmax
While Ismoving()
  sleep 100
Wend

sleep dwell

Code "G1 Y" & ymin
While Ismoving()
  sleep 100
Wend

sleep dwell

Code "G1 X" & xmin    
While Ismoving()
  sleep 100
Wend

MsgBox "Finished",0,"Auto Extents"  

Another question, what can I add to make it go back to the zero coords that I started with when the extents is finished running?

EDIT: The reason I chose to delete those portions was because I was already doing those before running the script. I thought maybe it was getting stuck because it couldn't perform those functions because they were already done! ;D

Thanks again,
Dave
« Last Edit: June 22, 2010, 05:45:21 PM by budman68 »
----------------------------------------------------------------------
Just because I'm a Global Moderator, don't assume that I know anything !

Dave->    ;)

Offline budman68

*
  • *
  •  2,352 2,352
Re: Plasma , new macro code
« Reply #23 on: June 22, 2010, 06:31:34 PM »
Ok, so I added this to the code to get it back to X and Y Zero coords:

Code"G1 X0.000 Y0.000"
While Ismoving()
  sleep 100
Wend

Is that correct? I added it like this towards the end:

Code "G1 X" & xmin   
While Ismoving()
  sleep 100
Wend

Code"G1 X0.000 Y0.000"
While Ismoving()
  sleep 100
Wend


MsgBox "Finished",0,"Auto Extents"


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

Dave->    ;)

Offline BR549

*
  •  6,965 6,965
Re: Plasma , new macro code
« Reply #24 on: June 22, 2010, 06:34:50 PM »
Dave if you want to take out the auto part it will run just fine.

NOW last night I worked out a different solution with Sheetcam. I redid the post to output a Dry run around the PART perimeter to verify the material. It also has the block delete charectors in that part so you can turn  the funtion on and off if needed.

AND it has nothing to do with VB(;-) Not as quick and easy BUT it does give a more detailed look at the material fit.

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • www.razordance.co.uk
Re: Plasma , new macro code
« Reply #25 on: June 23, 2010, 03:20:01 AM »
Dave - as Terry says, now you've taken out the toolpath generation it should work fine. That kind of takes away the point of it though really. BUT as it's proving a bit of a mare that's probably the way to go. Interesting you can get it to run from the VB code window but not the button. In my case it's the exact opposite. If I run it from the VB code window all hell breaks loose and it then completely hangs, I have to power cycle the PC to get it back. Your zero code is fine - not sure where it went from mine - it was in there at some point! Sorry the dialog threw you - just me playing about.

Terry - again I see parallels with your approach and what I had to do in my probing routines. Initially I did everything in VB but then as I said had to do most of it in a .DLL - BUT I also had to write the main loop in gcode to get it to work. I think we may just have to accept that Mach's relationship with VB is about as flaky as a box of kellogs ;D

Ian
« Last Edit: June 23, 2010, 03:22:31 AM by stirling »

Offline budman68

*
  • *
  •  2,352 2,352
Re: Plasma , new macro code
« Reply #26 on: June 23, 2010, 05:05:57 AM »
Thanks so much fellas, I appreciate the info and for all the help.

This will be nice to have, especially to make sure if any clamps or other obstacles may be in the way.

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

Dave->    ;)

Offline BR549

*
  •  6,965 6,965
Re: Plasma , new macro code
« Reply #27 on: June 23, 2010, 07:20:37 PM »
HI IAN, Actually the Sheetcam approach worked very well ran it all day today testing the idea . It is nice to be able to do a dry run




Offline budman68

*
  • *
  •  2,352 2,352
Re: Plasma , new macro code
« Reply #28 on: June 23, 2010, 07:30:27 PM »
Ran my sorry little code all day today as well and it worked perfectly for each job I ran.

Thanks so much for inspiring me fellas  8)

Dave

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

Dave->    ;)

Offline BR549

*
  •  6,965 6,965
Re: Plasma , new macro code
« Reply #29 on: June 23, 2010, 08:17:16 PM »
Way to go Big Dave (;-)