Hello Guest it is February 07, 2023, 07:12:45 AM

### Author Topic: Macro, Drilling, Bolt circle with MANUAL quill and spindle  (Read 20316 times)

0 Members and 1 Guest are viewing this topic.

#### vmax549

##### Macro, Drilling, Bolt circle with MANUAL quill and spindle
« on: March 28, 2009, 10:27:13 PM »
Here is a macro to drill Bolt circles using a MANUAL quill and spindle. It will hold at each drill point and let you drill the hole then hit OK and it will move to the next location  and so on.

To use Move to the CENTER POINT of the bolt circle and call the macro and program the Arguments

NOTE: We are using Macro arguments directly into the macro with the PQR (;-)

IE: M2224 P4 Q0 R4      ( moves to 4 locations starting at 3 oclock at a 4" radius from the centerpoint stops anmd waits for you to drill then you click on OK to continue)

Argument assignments

P= Number of Holes
Q= Starting angle (0=3 oclock)

CODE EXAMPLE:

'Macro M2224  Bolt circle Drill Manual Quill/SPindle
Sub main
Dim P101 As Integer
Dim P11 As Integer

' M2224 Pxx Qxx Rxx
' R = Radius of Bolt Circle
' Q = Starting Angle (0= 3oclock -- Neg = CW)
' P = Number of HOLES
SetVAR(24,Getdro(1))
Setvar(25,Getdro(2))
Setvar(11, Param1())
SetVar(1, Param2())
SetVar(18, Param3())

Code" #101=0 (Initialize counter)"
Code" #102=#1 (Initialize current angle To A)"
Code" #103=[360 / #11] (Constant For incremental angular distance between holes)"
Code" G0 Z#104 X#24 Y#25"
N1:
Code" #110=[#24 + COS[#102] * #18] (Calculate X position for current hole based on current angle)"
Code" #111=[#25 + SIN[#102] * #18] (Calculate Y position for current hole based on current angle)"
Code" G0 X#110 Y#111 (Machine current hole)"
MsgBox "Drill HOLE    " &" Then Press OK to continue"
Code" #101=[#101 + 1] (Step counter)"
Code" #102=[#102 + #103] (Step current angle)"
P101= GetVAR(101)
P11= GetVAR(11)
While Ismoving()
Wend
If P101 <= (P11-1) Then GoTo n1 Else GoTo N99
N99:
Code" G0 Z#104 X#24 Y#25"
Code "M30"
End Sub
« Last Edit: March 28, 2009, 10:29:42 PM by vmax549 »

• 4,914
##### Re: Macro, Drilling, Bolt circle with MANUAL quill and spindle
« Reply #1 on: March 28, 2009, 11:20:15 PM »
Now THAT is just slicker n' snot on a doorknob.
Just ran it in simulation...If I had Z set up on the knee I'd be using the heck out of this.
Thanks Mr. Parker,
RC

#### vmax549

##### Re: Macro, Drilling, Bolt circle with MANUAL quill and spindle
« Reply #2 on: March 29, 2009, 02:49:51 PM »
RC I work for a living like everyone else( not a MR or a SIR)

MOST just call me TP(;-)

(;-) TP

• 4,914
##### Re: Macro, Drilling, Bolt circle with MANUAL quill and spindle
« Reply #3 on: March 29, 2009, 03:07:44 PM »
Thanks TP......keep up the good work.
RC

#### Greolt

• 956
##### Re: Macro, Drilling, Bolt circle with MANUAL quill and spindle
« Reply #4 on: March 29, 2009, 06:21:19 PM »
I have edited this post so as not to clutter up TP's excellent thread.

This is my attempt to alter TP's code to have it ask for the parameters.

I have blatantly used TP's other threads as a guide.

The good parts are all TP's.  The not so good bits are mine.

This is simply a learning exercise for me.

Thanks again for your efforts TP.

'Macro M2224  Bolt circle Drill Manual Quill/SPindle
Sub main
Dim P101 As Integer
Dim P11 As Integer

Begin Dialog DiaLogName1 60,60,80,150, "Drill Circle"

TEXT 10,10,100,10, " Number of Holes"
TEXT 19,70,100,10, "Start Angle"
TEXT 18,82,100,10, "0 = 3 oclock"
TEXT 15,94,100,10, "CCW   0 - 360"

TEXTBOX 20,22,35,10, .Nholes
TEXTBOX 20,106,35,10, .Sangle

OKBUTTON 20,130,35,12
End Dialog

Dim Dlg1 As DialogName1
Dialog Dlg1

SetVAR(24,Getdro(1))
Setvar(25,Getdro(2))
Setvar(11, Dlg1.Nholes)
SetVar(1, Dlg1.Sangle)

Code" #101=0 (Initialize counter)"
Code" #102=#1 (Initialize current angle To A)"
Code" #103=[360 / #11] (Constant For incremental angular distance between holes)"
Code" G0 Z#104 X#24 Y#25"
N1:
Code" #110=[#24 + COS[#102] * #18] (Calculate X position for current hole based on current angle)"
Code" #111=[#25 + SIN[#102] * #18] (Calculate Y position for current hole based on current angle)"
Code" G0 X#110 Y#111 (Machine current hole)"
MsgBox "Drill HOLE    " &" Then Press OK to continue"
Code" #101=[#101 + 1] (Step counter)"
Code" #102=[#102 + #103] (Step current angle)"
P101= GetVAR(101)
P11= GetVAR(11)
While Ismoving()
Wend
If P101 <= (P11-1) Then GoTo n1 Else GoTo N99
N99:
Code" G0 Z#104 X#24 Y#25"
Code "M30"
End Sub

« Last Edit: March 29, 2009, 07:52:04 PM by Greolt »

#### Greolt

• 956
##### Re: Macro, Drilling, Bolt circle with MANUAL quill and spindle
« Reply #5 on: March 29, 2009, 06:33:02 PM »
I see TP has posted an example of how to do it with a single text box on the other bolt hole circle thread.

I have edited the above post so as not to clutter this thread.

Greg

PS:  How do I have it enter a default value for a text box?  EG, zero for angle.
« Last Edit: March 29, 2009, 07:19:20 PM by Greolt »

#### TDAY

• 165
##### Re: Macro, Drilling, Bolt circle with MANUAL quill and spindle
« Reply #6 on: July 31, 2009, 12:34:47 PM »
Hello all,
I put the edited code into a button and this is VERY nice!
Was wondering if there is a way to maybe...."edit" this macro and others, and have it post a Gcode somewhere?
Or maybe a way to save what you entered before. So when you push the macro button and window pops up, everything you entered before would be there.
Troy
« Last Edit: July 31, 2009, 01:16:56 PM by TDAY »
"I try to put forth the effort,before asking a dum question"
http://homecncstuff.elementfx.com

#### vmax549

##### Re: Macro, Drilling, Bolt circle with MANUAL quill and spindle
« Reply #7 on: July 31, 2009, 11:14:10 PM »
Troy the beuaty of Macros are they do not need to generate a separate Gcode file THEY are the gcode files with vars to define the function changes needed.

Yes you can store the variables MACH HAS A SECTION OF var #500-600 THAT ARE PERSISTANT and will stay put after mach shuts down. So it is possible.

AS to your idea, (;-)  Yes it can be done. Can you explain how you would use it?

#### TDAY

• 165
##### Re: Macro, Drilling, Bolt circle with MANUAL quill and spindle
« Reply #8 on: August 11, 2009, 07:54:01 AM »
Sorry, for just now responding but i didnt receive a email notifier,got it set to do it.
Anyhow,the reason to generate and store a Gcode, so if i have a small production run i dont have to re-enter the macro for every part.
Troy
"I try to put forth the effort,before asking a dum question"
http://homecncstuff.elementfx.com

#### darlly01

• 26
##### Re: Macro, Drilling, Bolt circle with MANUAL quill and spindle
« Reply #9 on: September 11, 2012, 03:03:04 PM »
Hi to all,
this forum has a lot of experts. I'm new and getting all information to keep going with my projects. I need a help to do a Macro.
I found a macro to run a Powerpoint slides. It is working fine. It execute the slide show perfectly.
This is what I want to do: Computer showing the slides and when cylcle start button is pressed the slide show stop and the gcode is executed, when finish the gcode it start the slide show again. Please any help will be very great. thanks