PDA

View Full Version : CnC macros? got one to share?



Dawai
01-14-2009, 10:59 AM
ONE supplied and modified, as of yet untested.. SHOULD run only in Turbocnc.. the ask and Say commands get it in Mach3.



; TurboCNC 4.0 program to g81 polar holes
M97 O8000 ;Jump to the main program
; *** Subroutine to Drill Polar array ***
N0100 #1005=[#1005 + #1004] ;Increment the angle
SAY #1005 ;Current angle (Stop at 360):
#1006=[#1000+(#1002/2)*COS(#1005)] ;compute new X position
#1007=[#1001+(#1002/2)*SIN(#1005)] ;compute new Y position
G81 X#1006 Y#1007 ;Drill the hole each increment
IF #1005 LT #1031 M97 O0100 ;Jump if array not complete
M99 ;return from subroutine
; *********************************
; * Main Program *
; *********************************
;Parameters for the circle (get the center from the operator)
N8000 ASK #1000 ; What is the X-coord of center (inches):
ASK #1001 ; What is the Y-Coord of center (inches):
Ask #1034 ; Enter number of holes
Ask #1030 ; Enter start degree of the polar array
Ask #1031 ; Enter End Degree of the polar array
Ask #1032 ; Enter the Z depth
Ask #1033 ; Enter the R Clearance
Ask #1035 ; Enter feedrate
#1002=1 ;Diameter of the circle (inches)
#1003=[1031-1030] ;# of steps for a full circle
;computed variables
#1004=0 ;delta (angular increment)
#1005=0 ;theta (current angle)
#1006=0 ;next X position
#1007=0 ;next Y position
;setup
F20 ;set feed rate
#1004=[#1003/#1034] ;compute theta (TurboCNC 4.0 Total degree swing/number of holes increment
; trig functions are in degrees)
#1006=[#1000+(#1002/2)*COS(#1005)] ;compute starting X
; position
#1007=[#1001+(#1002/2)*SIN(#1005)] ;compute starting Y
; position
G81 X#1000 Y#1001 Z#1032 R#1033 F#1035 ;Drill center hole for axle
G00 x#1006 y#1007 ;locate the first hole?
N9100 M98 08000 ;jump to cutting subroutine
G80 ; release the g81 command to normal
SAY #0 ;clear display
M02 ;End of program G81_tcnc.cnc




Anyone got a face off macro, a spiral cut to finish size?
Change the Say and Ask commands to something valid "274", it looks like the same kind of code format used by other programs.

Evan
01-14-2009, 11:27 AM
Go to my site download box at vts.bc.ca/misc and download Spiral Pollygone.vbx

It's a script I wrote for CamBam that makes all sorts of spirals and related stuff that CamBam will turn into a toolpath.

http://metalshopborealis.ca/pics4/spg1.jpg

Dawai
01-14-2009, 09:19 PM
I am working on the spiral cut - spiral bore with smaller endmill. It's a wizard in Mach3. Not so in other two programs here.

Variables.. Radius,Xcenter,Stepover,Ycenter,Ztop, Zdepth,Zincr,Feedrate,G02 or G03, endmill diameter

Plunge z past ztop zincr..
Loop this till final circle dimensions.
Name quadrant moves, P1, P2 P3, P4 CCW quadrants logic..
P1 xposition=xposition + stepover -Endmill radius, Ycenter
P2 Xcenter, Yposition=Yposition+stepover-endmill radius
P3 Xpositon=xposition+stepover+endmill Radius, Ycenter
P4 Xcenter, Yposition=Yposition+stepover+endmill radius
Move to x,ycenter
Move stepover increment if Less than Radius-Radius endmill
if zdepth is not made, loop back up to zincr plunge..

I might do this in Python to start with, then Turbo basic or Turbocnc 274 gcode?

edit:
Evan: Cambam looks ever bit as good as the lower releases of Bobcad... and cheap enough to learn with.