View Single Post
  #24   Report Post  
Posted to rec.crafts.metalworking
Jon Elson Jon Elson is offline
external usenet poster
 
Posts: 1,384
Default IGGY - Pocket Drilling

Ignoramus1469 wrote:
Jon, the way I write subroutines involves several things that help
me.

1. I write named subroutines and save them to files corresponding to
their names.
2. I use named variables in the subroutine.
3. I use offsets and named arguments

Yeah, since I've been using EMC(1) since 1998, I have developed habits
that prevent
me from exploring a bunch of new features that might make my life easier!
Ohelloworld sub
#x0 = #1 (X offset)
#y0 = #2 (Y offset)
#safez = #3 (Safe Z)
#l = #4 (length of the cross)
#depth = #5 (depth of cutting)

... perform operation ...
Ohelloworld endsub
M2 (M2 required at end of subroutine files)


THen to call it I just say in my main code or other subs

Ohelloworld call [1] [2] [0.03] [0.4] [-0.05]

It works really well for me and the resulting code is VERY EASY TO
READ. It is also easy to change.

Yes, I really need to learn how to use these features. Subroutines have
been in EMC
for some time, but named subroutines and named variables are pretty new.
I also have subroutines where I pass other subroutines into them.

Also cool stuff, I will have to learn some of your tricks. But, also,
you are exploring
a new world with EMC, I just have parts to make, often with programs
that were
written 5 years ago, and just make minute changes to them to tweak the
fit of
something. There rarely seems to be time to really explore things and
learn new
stuff.


Jon