Quantcast
Channel: CNCzone.com- Largest Forums for CNC Professional and Hobbyist alike!
Viewing all articles
Browse latest Browse all 72891

840D programming questions (loops, variables, etc)

$
0
0
Hello again,

I'm looking to create some generic parametric programs for various tasks, which I've never really done in NC code before, though I know many programming languages (LISP, c, c++, Java, c#, etc..)

Basically, I want to be able to create 'x' amount of holes of 'x' size at 'x,y' locations based on an array, and send those values to the "hole" routine.

I have the hole routine, but need some help figuring out which way to do it. I don't want to (yet) use sub programs, but instead just want to have a program that keeps running a portion of code 'x' number of times, and then end or whatever.

something Like:

DEF REAL DIAMETER=3.5
DEF REAL CUTTERRADIUS=.25
DEF REAL CENTERX
DEF REAL CENTERY
DEF REAL HOLESX[4]=SET(12.3 6.3 3.4 5.6)
DEF REAL HOLESY[4]=SET(6.6 3.4 5.6 6.5)

DEF INT I

FOR I=0 TO 3
CENTERX=HOLESX[I]
CENTERY=HOLESY[I]
CUTHOLE
ENDFOR

G0 G40 G90
T0 D0
SUPA G0 Z0
SUPA G0 Y0
M2

...

;(CUT HOLE)
CUTHOLE:
G0 X=CENTERX+(DIAMETER/2)-(CUTTERRADIUS*2) Y=CENTERY
G42 X=CENTERX+(DIAMETER/2)-CUTTERRADIUS ;(CUTTER COMP MOVE)
.... (etc etc for the circle program)

Viewing all articles
Browse latest Browse all 72891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>