Hello Guest it is April 25, 2024, 05:37:01 AM

Author Topic: Fusion 360 and issues with Mach 4 G-Code  (Read 2479 times)

0 Members and 1 Guest are viewing this topic.

Fusion 360 and issues with Mach 4 G-Code
« on: January 02, 2021, 09:58:53 PM »
Hey Guys,

I'm pretty new to this, so please bare with me.

I've got a custom built CNC, using Smooth stepper ESS, and Mach 4.  I did my Design and CAM in Fusion 360.  Today was the first day I got it up and running, and I wanted to find out if there are a few things that I could do to streamline the setup of a G-Code file, and perhaps shed some light on an issue I'm having.

I've attached my G-Code, but the below changes won't reflect in the code.

First, I'm new to G-Code, so I did a lot of research to do these small adds.  First, since I'm zeroing the work area, and I found that if you're not exactly where you zeroed the work area the machine will run with some amount of offset that you started at.  So, what I did was added a "G0 Z3" to ensure that where ever the X and Y axis take me, the spindle won't collide with hold downs.  I also added a 10 second pause "G4 P10000" to give me a little mind reset for what's to come.  Next comes the spindle command "s20000 M3" and I added a 4 second pause to allow for the spindle to get to speed "G4 P4000."  The rest runs as is until I get to the end.  This all runs great, with no issues

Problem #1
About 7/8 of the way through the G-Code I run into an issue.  I think it's around line 301 in the attached file.  For some reason, when I have my soft limits enabled (They're set to .5 inches on X and Y and 14+ and 12+ inches respectably) I get an "Error: X Axis commanded over softmin."  I've tried moving the workpiece and work area to the center of the machine with no luck, so that's a mystery to me.  I'll run the G-Code without softlimits and it runs fine.  If someone has insight into this, I'm all ears.

Problem #2
Line 325 in my attached G-Code when we get to the G28 commands, some weird thing happens.  Instead of returning to the work area starting point X0y0, the G-code is sending it to the Machine coordinates, thus tripping my limit switches...  Does anyone have an explanation why that is?

My solutions: Remove line 325 - 327, and after G90 I insert "G0 Z3" to raise the spindle to clear any fastners, and then on the next line I add "G0 X0 y0" to return to the work area coordinates I started at, and then followed on the next line: "S0 M5" to shut down the spindle.


Am I reading all this wrong?  Do I have something else set up wrong where this isn't working as it's intended?  To get this far it took me a better part of the day, but it's definitely something I can repeat fairly quickly with other G-Code.  I would rather this just be done in the CAM software though....

Attached you will find "A3_Test_G_Code" which is the original from the CAM software.  "Revised A3_Test_G_Code" will be the version I revised that does what I want it to.
Re: Fusion 360 and issues with Mach 4 G-Code
« Reply #1 on: January 03, 2021, 12:37:52 PM »
I’m not sure about problem 1. I’ll think on that more.
Problem 2, however, is not a problem; it is doing exactly what G28 is supposed to do.  It moves to the machine zero position. A better option is to use the G30 that I asked autodesk to add to the mach4 post processor.
Setup variables/register 5181,5182,5183 x,y,z positions respectively. Put a machine coordinate position in these #VARS so the machine will move to your desired position instead of the machine home position.   You must put something in these variables or it will act just like G28.
Haas Automation has a good video on this on their YouTube channel. Also, read up on the G28-30 in the mach4 manual.
Chad Byrd
Re: Fusion 360 and issues with Mach 4 G-Code
« Reply #2 on: January 03, 2021, 04:34:15 PM »
Hi,
I don't like the Fusion generated G28 either, I use the drop down menu box in Fusions Post page to not use G28 but to go
to the prevailing work zero, ie the origin of your workpiece.

As for problem 1.........How are you homing your machine? Soft Limits are declared in machine coordinates and only make sense
if the machine coordinate zero is at some defined and repeatable location.

Try this analogy.

Imagine the XY extents of your machine to be a rectangular paddock. When you turn your machine on all that Mach knows is that you're somewhere
in that paddock. Lets say however there is one tree in this paddock, it does not really matter where it is, but obviously it does not shift.
So you drive Mach to the trees position and declare that position as 'Home'. Now you can declare that the Northern boundary fence is 52 yards
North of Home, the Eastern boundary fence is 74 yards to the East of Home....etc. These declarations of distances to the boundary are the
equivalent of Machs Soft Limits. You could now set an automatic lawn mower to mow the paddock and it would know how to avoid banging into the
fence by using the knowledge of the boundary distances.....but only if it knows where 'Home' is.

Homing your machine to a define and repeatable location is essential to use Soft Limits.

Craig
« Last Edit: January 03, 2021, 04:36:09 PM by joeaverage »
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Fusion 360 and issues with Mach 4 G-Code
« Reply #3 on: January 03, 2021, 07:13:29 PM »
I’m not sure about problem 1. I’ll think on that more.
Problem 2, however, is not a problem; it is doing exactly what G28 is supposed to do.  It moves to the machine zero position. A better option is to use the G30 that I asked autodesk to add to the mach4 post processor.
Setup variables/register 5181,5182,5183 x,y,z positions respectively. Put a machine coordinate position in these #VARS so the machine will move to your desired position instead of the machine home position.   You must put something in these variables or it will act just like G28.
Haas Automation has a good video on this on their YouTube channel. Also, read up on the G28-30 in the mach4 manual.

That’s a helpful tip, and I’ll have to try that.  I like the idea of sending my machine to the far side after a cut so I can clear the material.

Thanks
Re: Fusion 360 and issues with Mach 4 G-Code
« Reply #4 on: January 03, 2021, 07:23:18 PM »
Hi,
I don't like the Fusion generated G28 either, I use the drop down menu box in Fusions Post page to not use G28 but to go
to the prevailing work zero, ie the origin of your workpiece.

As for problem 1.........How are you homing your machine? Soft Limits are declared in machine coordinates and only make sense
if the machine coordinate zero is at some defined and repeatable location.

Try this analogy.

Imagine the XY extents of your machine to be a rectangular paddock. When you turn your machine on all that Mach knows is that you're somewhere
in that paddock. Lets say however there is one tree in this paddock, it does not really matter where it is, but obviously it does not shift.
So you drive Mach to the trees position and declare that position as 'Home'. Now you can declare that the Northern boundary fence is 52 yards
North of Home, the Eastern boundary fence is 74 yards to the East of Home....etc. These declarations of distances to the boundary are the
equivalent of Machs Soft Limits. You could now set an automatic lawn mower to mow the paddock and it would know how to avoid banging into the
fence by using the knowledge of the boundary distances.....but only if it knows where 'Home' is.

Homing your machine to a define and repeatable location is essential to use Soft Limits.

Craig

Thanks for the reply Craig.  I home using switches on the negative x and y axis.  Those same switches act as x+ and x-, and y+ and y- limit switches.  I home every time I start up the machine and even occasionally between cuts (which has only been a handful so far).  That’s why I mentioned I was even getting the error in the middle of my machine. 

So it boggles me why soft limits would even be addressed.  Like I said, when I turn them off it runs flawlessly, but I’d prefer to have them on.

Lastly, I stumbled on a video by warp 9 (I’m using a smooth stepper ess) and they go about setting soft limits in a round about way.  I’m curious if there is some issue in how I set mine up.  I used only the Mach 4 interface, aside from activating them in the warp 9 plugin.  Setup can be quite confusing jumping from one setup menu to another for the same purpose....

Regardless, my soft limits worked when manually testing them, but I wonder if some automation aspect has issue with how they are set up.  The video I found is 2 years old: https://youtu.be/laLrcg_RbNw

I didn’t follow this procedure when setting up mine, but this seems more complicated than it needs to be.
Re: Fusion 360 and issues with Mach 4 G-Code
« Reply #5 on: January 03, 2021, 08:13:19 PM »
Hi,
so what data are you populating the SoftLimits page with?.

If you are using X- and Y- as home switches then at least one, say SoftXMin=0 or SoftXMax=0 must be true for each axis

For instance my existing mini-mill has 180mm x 180mm x180mm of travels. The X home and Y home switches occur with
the tool at x=0, y=0, and the Z axis home switch is at the top of travel, Z top=0. My SoftLimits are:

X    min=0 max=180
Y    min=0 max=180
Z    min=-180 max=0

Craig




'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Fusion 360 and issues with Mach 4 G-Code
« Reply #6 on: January 03, 2021, 08:46:38 PM »
Hi,
so what data are you populating the SoftLimits page with?.

If you are using X- and Y- as home switches then at least one, say SoftXMin=0 or SoftXMax=0 must be true for each axis

For instance my existing mini-mill has 180mm x 180mm x180mm of travels. The X home and Y home switches occur with
the tool at x=0, y=0, and the Z axis home switch is at the top of travel, Z top=0. My SoftLimits are:

X    min=0 max=180
Y    min=0 max=180
Z    min=-180 max=0

Craig

That’s essentially what I have.  Since I have my machine back off the switch .5 inches, I have my soft limit min set to .5 and my max set at the machine max prior to activating the limit switch.

I’m confident those settings are correct, what I’m unsure about is which I use to set my homing... do I use the ESS plugin or do I do it in Mach 4 control?
Re: Fusion 360 and issues with Mach 4 G-Code
« Reply #7 on: January 03, 2021, 09:09:15 PM »
Hi,
homing is a shared activity.

Mach provides the basic data, for instance the homing direction each axis is to take, the homing order, the offset (if any), the homing speed
and softlimits.

The homing procedure itself is a realtime procedure and must perforce be done by the controller.The homing axis is set in motion and is meant to stop
when the switch activates. The ESS can do this immediately whereas if it reported back to Mach it would take tens of milliseconds, way too slow, the machine
will have crashed into the stop before then.

In the ESS plugin:
PinsConfig: is where you assign a pin to each of your home switches
InputSignals: is where you map each pin to its logical event, Motor0Home for example, and enable it
Homing: any pins and/or events you have enabled in the InputSignals tab will be replicated in this tab and you can attach more data, like
approach speed, backoff speed and whether you are going to use index homing.

So there are four pages that you need attend to set up homing, the Homing/Limits tab in the Mach Control plugin
and the three (PinsConfig, InputSignals,Homing) tabs in the ESS plugin.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Fusion 360 and issues with Mach 4 G-Code
« Reply #8 on: January 03, 2021, 09:40:21 PM »
Hi,
homing is a shared activity.

Mach provides the basic data, for instance the homing direction each axis is to take, the homing order, the offset (if any), the homing speed
and softlimits.

The homing procedure itself is a realtime procedure and must perforce be done by the controller.The homing axis is set in motion and is meant to stop
when the switch activates. The ESS can do this immediately whereas if it reported back to Mach it would take tens of milliseconds, way too slow, the machine
will have crashed into the stop before then.

In the ESS plugin:
PinsConfig: is where you assign a pin to each of your home switches
InputSignals: is where you map each pin to its logical event, Motor0Home for example, and enable it
Homing: any pins and/or events you have enabled in the InputSignals tab will be replicated in this tab and you can attach more data, like
approach speed, backoff speed and whether you are going to use index homing.

So there are four pages that you need attend to set up homing, the Homing/Limits tab in the Mach Control plugin
and the three (PinsConfig, InputSignals,Homing) tabs in the ESS plugin.

Craig

Craig, again you're schooling me in the little things I don't know.  Thanks for that insight about how the ESS and Mach work together.  As for what you have listed, that's exactly how I've set it up, and the only thing that doesn't have information is for the Index pin section of the ESS plugin.
Re: Fusion 360 and issues with Mach 4 G-Code
« Reply #9 on: January 03, 2021, 09:54:12 PM »
Hi,
are you going to use index homing?

I never bothered and with good quality roller plunger snap action microswitches I can get 0.02mm repeatability from session to
session without index homing, and 0.02mm is close enough for me.

If you don't want index homing, just don't enable it. If you do then you'll have to assign pins, input assignments....all the usual stuff for
inputs but for three new index inputs.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'