IGGY - Pocket Drilling

I am talking about subroutines, not canned cycles.

You write your own G-code subroutines. And you can modify them at will any time you want.

Using subroutines allows you to write code that is easy to read and modify.

The whole point is that you write your own. I wrote some subs for myself that do the same pocketing and ramping down.

not bad

Did He give any explanation? I am writing them right and left and am very happy.

i
Reply to
Ignoramus4779
Loading thread data ...

Codesmith meets metalmuncher?

Joe Gwinn

Reply to
Joseph Gwinn

My program was a bit different, instead of passing parameters to the subroutine, I was offsetting the work coordinate system each time before calling the subroutine. So, I would do : G01 X1.2345 Y3.456 O100 call G01 X3.456 Y4.567 O100 call ..... and the subroutine had :

O100 sub N01 G55 N02 G92 X0 Y0 N03 G01 F45.0 X0.0725 Y0.0725 N04 Z0.01 .....

The first problem I had was an unspecified Z offset was changing without my specifying it. I was assuming that if I didn't specify a Z offset in the G92 that the Z offset would not be changed.

The fix for that was to use G10 L20, and to specify all axes in the command. This all got discussed on the EMC developer's list on 5/14/2010. Up to this point, I think the entire problem was my fault in not understanding how G92 works.

But, then, I ran into the "run from line" problem, where I could not restart the program in the middle. It wasn't until 5/17 that John Kasunich made the immortal "it is evil. don't do it" statement, but he actually said that Run from line was evil, not subroutines! Sorry for my mis-remembering exactly what he said.

Anyway, I don't think there was ever a concrete explanation of what was wrong, or if there was any fix. The program is still up on pastebin, at

formatting link
you want, you can try it out. It defines a subroutine, then moves to the first slot corner and calls the subroutine, moves, calls it again, etc. The subroutine shifts the G55 coordinate system with G10 L20 P2, then changes to the G55 system and machines a slot, then goes back to G54 and returns. At the end of 24 slots, it does some different cutouts with linear program steps. If you interrupt the run after the first subroutine, and then try to run from line, it will skip the 24 subroutine slots and perform the last cutouts perfectly. You can try this in air and watch the Axis preview to follow what it is doing. It didn't do anything wild, it just skipped over a huge part of the job.

Jon

Reply to
Jon Elson

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

O sub # = #1 (X offset) # = #2 (Y offset) # = #3 (Safe Z) # = #4 (length of the cross) # = #5 (depth of cutting)

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

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

O 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.

I also have subroutines where I pass other subroutines into them. I use one to perform a multipass deep cut based on a shape performed by the parameter subroutine. This is how I made a complex shape cutoff on my spindle adapter.

It was as easy as pie. Here's a sub that performs a deep cut defined by a subroutine number that I pass in as a number:

O sub # = #1 (Subroutine to do whatever is needed) # = #2 (Safe Z) # = #3 (Depth to go, usually negative) # = #4 (Z Step, positive) # = #5 (Feedrate)

# = #

O while[1] # = # O if [ # - # LE # ] # = # # = 1 O else # = [# - #] # = 0 O endif

O[#] call [#] [#] [#] [#] [#] [#6] [#7] [#8] [#9] [#10] [#11] [#12] [#13] [#14]

O if [ # LE # ] O break O endif O endwhile O endsub

and then to cutt of that shape I would use a sub like this

O sub # = #1 # = #2 # = #3 # = #4 # = #5

# = #6 # = #7 # = #8 # = #9 # = #10

F#

# = [[#-#]/2]

# = [#/2]

G0 Z# G4 P0 G0 X# Y[#+#/2]

G40

G0 Z#

O if [ # LT 0 ] G42.1 D# # = 3 O else G41.1 D# # = 2 O endif

G# X[# + #*# ] Y[# - #] R[#] G1 X[# + #*# + #*#] G1 Y[#] G1 X[# + #* # ] G# X# Y0 R[#]

G0 Z# G4 P0

G40

O endsub

O call [101] [#] [-#] [#/3] [#] [-1] [#] [#] [#] [#] O call [101] [#] [-#] [#/3] [#] [+1] [#] [#] [#] [#]

This cuts left and right semicircular shapes with lips etc, on both sides. -1 and +1 define their orientation.

i
Reply to
Ignoramus1469

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!

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.

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

Reply to
Jon Elson

I'm rather envious of the time Iggy seems to have available to play around and experiment. What's your secret Iggy? Got yourself a clone or two out earning the paychecks so you can play?

Bagged a 2.6GHz Dell today with half a gig ram and LCD for $15 at a yard sale. So now I have a computer available to play with EMC or Mach3. Decisions, decisions...

Jon

Reply to
Jon Anderson

When you try EMC, subscribe to emc-users mailing list.

i
Reply to
Ignoramus1469

The secret is I sleep less than I would like. Plus I have EMC installed on many computers and work on it on train, etc.

Reply to
Ignoramus1469

Well, if you do something new, you can try. EMC G-code is a full featured programming language, with conditionals, loops, and subs.

i
Reply to
Ignoramus1469

Like the classic "IF: Then: Else:" programming?

I may just have to look at EMC2 g-coding again.

Reply to
Bob La Londe

What is the card make and model?

You can post output of lspci command.

It will probably work. Myself, I only rely on wired networking for anything important (like CNC machines).

I can hopefully walk you through the wireless card setup.

Can you use a wired connection at least while you set up your wireless card?

i
Reply to
Ignoramus478

Downloaded and burned the ISO disk, just playing been playing with it, but I'm about to hit the install button... Unbuntu and EMC2 have come a LONG way since I played with the Brain Dead Install CD years ago.

One thing I want to do ASAP is get Unbuntu running with the wireless internet card, as some of the docs are online, and makes it much easier to track the EMC list right where I will certainly be needing it!

Drivers for the card were not installed, might have to pull the card to see exactly what it is, then see if I can find drivers for it under Unbuntu.

Jon

Reply to
Jon Anderson

I remember being able to get away with that...

Jon

Reply to
Jon Anderson

The Dell should have an on-mobo wired ethernet port. I use only wired ethernet for a variety of reasons: mostly security and reliability in a high-noise environment (we have nearby cell towers, and of course, CNC machines). I think all 3com cards and chips will be supported.

Jon

Reply to
Jon Elson

I know about that, and worked through a multipass threading code which I used to debug the spindle sync functions a few years ago.

Jon

Reply to
Jon Elson

Quick question, do you have your EMC computer networked, and if so, via wire or wireless? What card are you using? I looked up the Linksys card in mine and it's not well supported. Looking for compatible cards, I see a whole host of issues, including lack of WEP support in some. I therefore assume there's other cards that will also have issues with security. I could run a cable, I think I have one long enough. But will have to research and see if the 3Com cards I have are compatible...

Thanks,

Jon

Reply to
Jon Anderson

Do you know how to make a RJ-45 ethernet cable?

You want some CAT-5 cable (at least two pair, likely four pair).

You want a *good* RJ-45 crimper. (Some of the cheap ones tend to fold the connector blades over instead of properly crimping them. I like the AMP RJ-45 crimper, but some others are pretty good. Look for crimpers in which the punch travels in a straight line instead of swinging in an arc towards the blades.

You want several new RJ-45 connectors. (Two at the absolute minimum, but if you have only two, you will almost certainly not shove the wires in far enough to make a good connection on at least one pin. Use an ohmmeter or a continuity tester between the ends to make sure that they are good. (There are test units which cycle through the pairs at one end and flash LEDs at the other end -- green if not reversed, red if reversed. But you probably don't want to spend that money. I make a lot of cables over the years, so I picked up the test unit and use it regularly.

Hold the connector with the hole for the cable towards you, and the connector blades up and number them from left to right:

1 2 3 4 5 6 7 8 +---------------------+ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Locking clip on underside as it is held here | | | | | | | | | | | | | | | | | | +------+ +------+ | | | | | | | | | |
Reply to
DoN. Nichols

Linksys WMP11, V4.

There is, apparently, ONE driver that should work, but it's $20.

Nice thing about where I live, nobody close enough to scarf into my network. To try and hack it, one would have to be in my driveway, and I'm home 98% of the time (geez, that's depressing now that I think about it!). Network security isn't a big issue for me here.

I can go wire once I'm up and running, but right now I have this computer upstairs while I'm reading the manuals and such. Really have nowhere in the shop to setup another computer right now. -Might- be able to snake a cable down through the floor and down to the router.

Thanks,

Jon

Reply to
Jon Anderson

BTW, the Dell has built in Ethernet port, I'm hoping it shouldn't be any huge deal to get Unbuntu to recognize that...

Jon

Reply to
Jon Anderson

You mean Ubuntu, right? It should work.

i
Reply to
Ignoramus478

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.