What's new
What's new

Getting Started with Macros on a Haas/Most useful Macros to be Using

Johnny SolidWorks

Hot Rolled
Joined
Apr 2, 2013
Location
Rochester
As I do more research into all the cool and useful things that can be done with macros, I feel more and more like I've been missing something obvious the entire time I've been programming a machine. I've tried to work through the macro section in the Haas manual (2001 VMC) but the lack of practical examples makes my eyes glaze over after just a little while.

Is there a good primer/manual out there for macros specific to Haas? I know there are a handful of books and guides available for Fanuc macros, but didn't know if there was anything worthwhile specific to Haas.

What macros are you guys running that are the most helpful? The only one I'm using right now, if it could even be considered a macro, is for safe tool changes when I have a long tool or tall setup in the machine, which is an aliased M code. I feel like I'm missing out on a ton, and doing a lot of things the wrong way because of my ignorance.

Thanks all!
 
Macros are really just algebra where you take some known values and solve for an unknown. The logic is the same for all controls, the syntax is a little different.

Both of my Haas VMCs are 4 axis. I have a macro that will read the XYZ coordinates of a previously set WCS and calculate the the new WCS at any angle I choose.

I've always wanted to write a macro that would set the P-Cool nozzle at the correct setting based on TLO.
 
Get NCPlot. It's a toolpath backplotter that handles macros, offsets, 4 axis mill and 2 axis lathe. I've used it to verify and debug some fairly complex macros including a serial number engraving program that would scale, map on arcs, and project onto cylinders.
 
I've always wanted to write a macro that would set the P-Cool nozzle at the correct setting based on TLO.

Something that has been on the project list is to drive the P-COOL directly and modify my SolidCAM post to have the nozzle directed at the tool/stock interface. This would require custom macros in order to sync two, but we are modifying the post anyway. Basically a simple MCU device (e.g., Arduino) with a serial port that receives a DPRNT from CAM to give rate/limits/etc. and drives the nozzle asynchronously. On the CAM side you would need to model the P-COOL device as part of the tool holder and then calculate the vector from tool tip to nozzle. Vector modification from tool depth to interface plane is simple since it is just a Z offset. The devil is always in the details, but it would be a fun project if I ever run out of more important things to do...
 
Something that has been on the project list is to drive the P-COOL directly and modify my SolidCAM post to have the nozzle directed at the tool/stock interface. This would require custom macros in order to sync two, but we are modifying the post anyway. Basically a simple MCU device (e.g., Arduino) with a serial port that receives a DPRNT from CAM to give rate/limits/etc. and drives the nozzle asynchronously. On the CAM side you would need to model the P-COOL device as part of the tool holder and then calculate the vector from tool tip to nozzle. Vector modification from tool depth to interface plane is simple since it is just a Z offset. The devil is always in the details, but it would be a fun project if I ever run out of more important things to do...

I think you just exploded my head.:eek:

I figured I'd do something like read the TLO and if its between 2"-3" set nozzle at position 14.
If it's between 3"-4" set nozzle at 12... etc.

The system variables are in the Haas owner's manual.

Then at the beginning of the program G65 P9xxx. I don't have a need for it to be graphically represented in my CAM.
 
There's an aftermarket device called SpiderCool (spidercool.com) which sounds similar to the item you're describing. Check it out for an idea of the implementation.

Anyway, on the macro side, over the years I've written a few quick parameter-based programs for things like peripheral squaring, facing, etc. but I don't use them very often in a production setting. Those programs are useful for one-off runs and other situations where you're only cutting one type of feature.

You can use macros in the production side, but it becomes very application-specific. THe biggest case is when making families of parts with small differences between them, like bore size or groove depth or something. But whether or not the macro is cost-effective depends on the time it saves from programming the workpiece via CAM, since you could spend 4 hours writing a super complex variable-based program, but if you're making one part then it's somewhat of a time waste. (not to say you shouldn't do it, definitely not! just be aware of the actual benefits aside from expanding your own knowledge)

Some other example cases:
- Custom drill cycles using your own variables passed using a G65 call
- Serial number engraving (newer Haas controller can do this internally, but options are limited for font/etc)
- Compensating for workpeice flex on a lathe (if cutting multiple parts off the same bar operation)
- On non-Haas machines, people have written macros for things like the G150 or G12/G13 that can be ran on other controllers
 
I've always wanted to write a macro that would set the P-Cool nozzle at the correct setting based on TLO.

Haas has a tip of the day on the subject.

I just added my own to the end of O9995 (in a sub prog actually) so each time a tool is set, the P-cool setting is done as well.

Something like:
IF [ #[ 2000 + #3026 ] GT 1.4 ] THEN # [ 3400 + #3026 ]= 6
IF [ #[ 2000 + #3026 ] GT 2. ] THEN #[ 3400 + #3026 ]= 7
etc.

Of course it isn't the same for each machine, so you'll have to do some measuring. I just put a piece of Ø1/4" round bar in a stub holder with sharpie marks at every 1/2" gage length. Wasn't too bad to figure out.
 
Johnny, there's also some good stuff in this thread http://www.practicalmachinist.com/vb/haas/haas-helpful-tips-tricks-292831/

I use the tool-break check macros as M-codes sometimes.
Also aliased a g-code to a simple program for measuring 'drills' on the OTS. We used that for setting tools anything smaller than 3/8" Pretty quick to just punch in one G-code in MDI to measure your (smaller) tools.

user nc.PieceMaker made a neat macro to use the spindle as a screw driver.
 








 
Back
Top