Machsupport Forum
Support => Downloads => MACH TOOL BOX => Topic started by: vmax549 on March 28, 2009, 10:13:07 PM
-
Here is a macro for drilling Bolt circles. TO use it move to the center point of the bolt circle then call the macro and include the required Arguments to program the macro
IE: M2223 #26=0.0 #18=3.0 #7=0.5 #1=0 #11=4.0 #3=83 #9=5 #17=0.05 #19=1500
Var assignments
#26= Z Top of Material
#18= Radius of Bolt Circle
#7= Depth of drilled HOLE
#1= Start Angle (0=3oclock position)
#11= Number of Holes
#3= Drill Cycle Type ( 73,81,83 or any of the Reamer cycles as well)
#9= Drilling Feedrate
#17= Peck depth if required in cycle(73,83)
#19= Spindle Speed
CODE EXAMPLE:
'Macro M2223 Bolt circle Drill
Sub main()
Dim P101 As Integer
Dim P11 As Integer
Setvar(24,GetDro(0))
SetVar(25, GetDro(1))
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" #104=[#26 + 0.1]" ' Constant For rapid approach plane
Code" #105=[#26 - #7]" ' Constant For Z bottom position of hole
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" M3 M8"
Code" G#3 X#110 Y#111 R#104 Z#105 Q#17 F#9 S#19(Machine current hole)"
Code" G80 (Cancel cycle)"
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"M5 M9"
Code "M30"
End Sub
End
-
Hello TP,
What do I do when the arguments over run the MDI entry window ?
Are they accepted anyway ? It doesn't appear so.
Thanks,
RC
-
HUM good question the MDI should take a full line of input 255 chars ??? I'll test it (;-) OK it does not take it here either
SO, until I can talk with Brian about it you can always break the Vars up into several lines if needed. Just input the Vars before you call the Macro
I know it will work in a Gcode file(;-) as a single line.
MDI input:
#26=0.0 #18=3.0 #7=0.5 #1=0 #11=4.0 (enter)
#3=83 #9=5 #17=0.05 #19=1500 (enter)
M2223
OR (;-) I can make it ask you for the data via a VB question box and you just fill in the box and hit enter(;-)
(;-) TP
-
I like the idea of the VB Qusestion Box.
Would it have the Var #'s and the descriptions there too ?
That would be handy.
Thanks TP,
RC
-
OW about this (;-) It is a programable front end to the Macro M1234 Drill bolt circle
Code EXAMPLE:
'Macro M2223 Bolt circle Drill
Sub main()
Dim P101 As Integer
Dim P11 As Integer
Begin Dialog DiaLogName1 60,60,175,150, "Drill Circle"
TEXT 10,10,80,10, "#26 Z TOP "
TEXT 10,22,80,10, "#18 Bolt Circle Radius"
TEXT 10,34,80,10, "#7 Hole Depth"
TEXT 10,46,80,10, "#1 Start Angle"
TEXT 10,58,80,10, "#11 Num of HOLES"
TEXT 10,70,80,10, "#3 Drill Cycle "
TEXT 10,82,80,10, "#9 Drilling Feedrate"
TEXT 10,94,80,10, "#17 Peck Depth "
Text 10,106,80,10, "#19 Spindle Speed"
TEXTBOX 85,10,35,10, .Ztop
TEXTBOX 85,22,35,10, .RadBC
TEXTBOX 85,34,35,10, .DepthH
TEXTBOX 85,46,35,10, .Sangle
TEXTBOX 85,58,35,10, .Nholes
TEXTBOX 85,70,35,10, .DCtype
TEXTBOX 85,82,35,10, .DrillFR
TEXTBOX 85,94,35,10, .PDepth
TEXTBOX 85,106,35,10, .Sspeed
OKBUTTON 85,129,35,12
End Dialog
Dim Dlg1 As DialogName1
Dialog Dlg1
Setvar (26, Dlg1.Ztop)
Setvar (18, Dlg1.RadBC)
Setvar (7, Dlg1.DepthH)
Setvar (1, Dlg1.Sangle)
Setvar (11, Dlg1.Nholes)
Setvar (3, Dlg1.DCtype)
Setvar (9, Dlg1.DrillFR)
Setvar (17, Dlg1.Pdepth)
Setvar (19, Dlg1.Sspeed)
Setvar(24,GetDro(0))
SetVar(25, GetDro(1))
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" #104=[#26 + 0.1]" ' Constant For rapid approach plane
Code" #105=[#26 - #7]" ' Constant For Z bottom position of hole
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" M3 M8"
Code" G#3 X#110 Y#111 R#104 Z#105 Q#17 F#9 S#19(Machine current hole)"
Code" G80 (Cancel cycle)"
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"M5 M9"
Code "M30"
End Sub
End
-
I think that is MUCH better TP.
This way I don't need to memorize or keep a list of the arguments.
GREAT work.
Thanks.
Now to check our Greg's example.
-
HARSH.MPF
N10 G90 G71 G94 F100 ;
N20 G75 X0 Z0 ;
N30 M06 T02 D01 ;
N40 M03 S1000 ;
N50 M08 ;
N60 G00 X0 Z5 ;
N70 CYCLE 81 ( 5 , 0 , 2 ,-30 , 0 )
N80 G00 X150 Z5 ;
N90 G75 X0 Z0 ;
N100 M05 M09 M30 ;
More examples..........!!!!
DESCRIPTION OF MAIN PROGRAM
HARSH.MPF - Name of main program
N10- Program is absolute co-ordinate system , metric input ( all dimension in mm) , feed rate per minute 100.
N20- Home position command ,where X0 and Z0
N30- Tool change command , select tool no 2 , tool offset no 01
N40- Spindle on clockwise , speed is 1000 rpm
N50- Coolant ON .
N60- Rapid action command , where X0 and Z5 (Tool take position )
N70- Drilling cycle put value
RTP = 5
RFP = 0
SDIS= 2
DP= -30
DPR = 0
N80- Rapid action command , where X150 and Z5
N90- Home position command ,where X0 and Z0
N100- Spindle OFF , coolant OFF , main prog. end ........................................... WWW.HDKNOWLEDGE.COM