Hello Guest it is March 28, 2024, 03:34:11 PM

Author Topic: hole macro help please :)  (Read 28178 times)

0 Members and 1 Guest are viewing this topic.

Offline Chris.Botha

*
  •  488 488
  • wine me.. dine me.. tram my mill for me...
    • View Profile
    • Digital-Jeweller
hole macro help please :)
« on: May 10, 2009, 05:41:26 AM »
Hi guys..

This may seem a simple task to the guru's here but after playing around with mach for a while i have to admit defeat (ie: i reached the threshold where i stop being obstinate and ask for help instead)

i have a repetitive task that need to happen for virtually every ring i cut. so i have the gcode saved on my desktop for it.. it simply drills a  hole (6mm hole with 3.17mm endmill)  in the middle of a hub in the centre of a ring to allow me to pick it up 90' to a finishing pass on my 4th axis.. i have been playing with MachScreen for tweaking my mach interface and i was thinking it would be cool to be able to add a button that would simply drill this hole for me. the example attatched is round but i hve a variety of hubs so i was hoping to add another screen to mach and have a few different hub buttons.. once i figure out how to add one the rest will be easy.. i hope :)

some clues to get me going in the right direction?

posting images and the gcode as an example.



Thanks in advance

Chris :)


[edit] aded rhino hub to help this post make more sense.. i hope




« Last Edit: May 10, 2009, 05:45:24 AM by Chris.Botha »

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: hole macro help please :)
« Reply #1 on: May 10, 2009, 06:14:35 AM »
Make the macro and store it in the macro fiolder of the profile you use with a name such as M111.m1s  (User macro should be over 100 if I recall correctly) then its  just a matter of having a VB button on your screen that calls the macro, all you would need in the button is code("m111").  Incidentally calling M111  from MDI or code would also do that macro.

How the macro is written depends on what you need to do but  if its simple then its just a case of
Code("G0X0Y0XZ2")
While IsMoving()
Sleep(10) 'the sleep should not be needed if using one of the recent revisions of Mach
Wend
Code ("G1Z-5F40")
etc etc


You will may need to add spindle calls etc, all depends on how you want to do things and how your machine is setup.
I am not good enough at VB to rattle things off in seconds and it often takes me a few hours to do simple things I want to do but in the end it all works out and the sense of achievment is a nice thing for a thicko like me :)

Hood
« Last Edit: May 10, 2009, 06:28:22 AM by Hood »

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: hole macro help please :)
« Reply #2 on: May 10, 2009, 06:36:17 AM »
Just tested things out and looks like the VB will wait until the code is completed before executing the next line so probably no need for the
While IsMoving()
Wend

but as said I am a thicko when it comes to VB so test with caution ;)

Hood
« Last Edit: May 10, 2009, 06:42:36 AM by Hood »
Re: hole macro help please :)
« Reply #3 on: May 10, 2009, 06:44:54 AM »
Another great tip learned.

Hood don't sell yourself, short next to me your a genius.  ;D

Phil
The Good Thing About Mach3, Is It's very Configurable

The Bad Thing About Mach3, Is It's Too Configurable

Offline Chris.Botha

*
  •  488 488
  • wine me.. dine me.. tram my mill for me...
    • View Profile
    • Digital-Jeweller
Re: hole macro help please :)
« Reply #4 on: May 10, 2009, 07:08:08 AM »
Code("G0X0Y0XZ2")

ok so in my case i have a whole swag of code happening .. so i can do this??

code ("
G17 G21 G40 G54 G64 G90
M03
G00 Z4.5850
X0.0000 Y0.0000
G01 Z0.0250 F300.0
Z0.0000 F600.0
X0.9116 Y1.0778 Z-3.0000
X0.8753 Y1.1079
X0.8743 Y1.1088 Z0.0000
etc
etc
etc
etc
Z0.0250
G00 Z4.5850
G00 Y0.0000
M05
M30
")


or

do i need to edit in the

code (" ")
section on each line of code?




« Last Edit: May 10, 2009, 07:23:14 AM by Chris.Botha »

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: hole macro help please :)
« Reply #5 on: May 10, 2009, 08:07:44 AM »
Phi next to some I may be  a genius but there are many more that are geniuses when compared  to me ;)

Chris
Test and see , easy enough to do, just open Mach copy your code and then go to the Operator menu and open the VB editor. Paste in your code and then add the Code(" to the start and ") to the end, Press the green arrow and you will either get a syntax error or the code will run correctly, I suspect it will need to be line by line though.

Hood

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: hole macro help please :)
« Reply #6 on: May 10, 2009, 08:17:00 AM »
Ok just tested myself and as suspected you will need tto put it on each line, you might also need to put a G0, G1 or whatever on each line that involves axis movementl.

Hood
« Last Edit: May 10, 2009, 08:19:12 AM by Hood »

Offline Chris.Botha

*
  •  488 488
  • wine me.. dine me.. tram my mill for me...
    • View Profile
    • Digital-Jeweller
Re: hole macro help please :)
« Reply #7 on: May 10, 2009, 03:42:17 PM »
thanks man.. gave it a whirl and got syntax error..




some of the code is huge!  i will have to brush up a bit or manually load code for now.. occurs to me it should be easir to insert a section of gcode into a macro?

thanks for all the help man :)

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: hole macro help please :)
« Reply #8 on: May 10, 2009, 05:08:21 PM »
You may be able to call the code from a macro, sort of like calling a sub but afraid I dont know enough about that.
Hood

Offline Chris.Botha

*
  •  488 488
  • wine me.. dine me.. tram my mill for me...
    • View Profile
    • Digital-Jeweller
Re: hole macro help please :)
« Reply #9 on: May 11, 2009, 02:36:44 AM »
thanks man thats kinda what i was hoping..

been a while since i coded too.. think Pascal/Fortran/C on a 4.77mhz pc/xt..  so long ago.. before i had a beer gut.. and guilt..

lol.. actually i learned to machine code on a commodore vic20..  man im old....