Machsupport Forum

Mach Discussion => Mach4 General Discussion => Mach4 Toolbox => Topic started by: Chul Kim on June 17, 2022, 07:10:04 PM

Title: When changing from mm to inch unit
Post by: Chul Kim on June 17, 2022, 07:10:04 PM
When changing from mm to inch unit

I bought a machine4 and have been working only with mm units from the beginning
I'm going to work on the inch unit this time.

Can't we just change from Mach4 configuration-control to inch?
After changing it like that, if you restart and go 1", it only goes 1mm.
What is this phenomenon? What's the solution?

Win10
Mach4 Ver.4809 + ESS
Title: Re: When changing from mm to inch unit
Post by: Steve Stallings on June 18, 2022, 10:13:54 AM
To work in alternate inch and metric systems, you do not need to change the configuration of Mach itself.

Indeed the configuration setting only affects how the steps per unit parameter in the configuration is understood by Mach while doing the initial axis configuration.

To work in alternate measurement systems you should insert a G20 command in your-G code file to tell Mach to treat dimensions as inches, or insert a G21 command in your G-code file to tell Mach to treat dimensions as millimeters.

Mach does have a group of startup settings to select the default mode. It sounds like your default is millimeters. The startup settings are one line of G-code that is automatically run before starting any job.
Title: Re: When changing from mm to inch unit
Post by: Chul Kim on June 18, 2022, 10:21:31 PM
Hi, Steve

Thank you for the detailed explanation.

However, I posted it because I tried as you explained.
Eventually, we had to change the counters/nuit value of the motor by changing it in inches.

If it works just as you say, is there a problem with my CNC configuration (Mach4+ESS+MB3)?
Is your explanation not working only on Mach3?

Thank you for your interest.
Title: Re: When changing from mm to inch unit
Post by: Steve Stallings on June 19, 2022, 08:26:29 AM
The G20 and G21 commands are supported in both Mach3 and Mach4.

Have you confirmed that the Inch mode file that you are running actually contains a G20 command line at the beginning?

If you are trying to be in Inch mode while jogging you may need to use an MDI command to execute the G20 command before jogging.
Title: Re: When changing from mm to inch unit
Post by: Chul Kim on June 19, 2022, 06:22:28 PM
Hi Steve

I'm sorry, but have you changed the unit and implemented it yourself?

Don't you have to change the value of the motor adjustment according to the unit?

It is common sense to insert G20 or G21 depending on the unit.

* Just in case, I also tried to run it on Mach3. It's the same.
I don't want to confuse others who read this.

Simply changing the unit in the unit change column of Mach3 or Mach4 only goes to the value of the previous distance in the XYZ direction.

Thank you for your interested reply
Title: Re: When changing from mm to inch unit
Post by: joeaverage on June 20, 2022, 01:03:08 AM
Hi,

Quote
Don't you have to change the value of the motor adjustment according to the unit?

No, you do not change the motor settings with a change in units of a job.

Choose your machines native units. These units will be what Mach uses internally. You adjust the steps  per unit value to suit your chosen unit....and then leave it alone
for the life of the machine. You should never need touch them again.

The ancient Greeks used a unit called a cubit, approximatelty the length of your arm from elbow to wrist. Not very scientific but it might help to illustrate how Mach works.

Lets say that Mach had the opportunity to use cubits as native units. Further lets say that the machine takes 3427 steps to travel one cubit. Thats what you would enter in
the motor tuning page.

Lets also assume that mach knows there are 300mm in a cubit or 11.811 inches in a cubit.

When someone gives you a job say in millimeters then put a G21 at the top of the code. Mach now knows to machine a straight line of 78.4mm say, but it also knows there
are 300mm in a cubit, its native unit, so 78.4mm/300=.261333 cubits and so the trajectory planner knows to issue 0.2613333 x 3427 =895.589 steps. As the trajectory planner output is integer
it will be rounded to 896 steps.

Now let guess the same job was given to you but in inches, so 78.4mm becomes 3.0866 inches. Mach calculates 3.0866/11.811=0.261333 cubits or 0.26133 x 3427= 895.589 steps just as before.

Mach converted whatever number its was given to its native units, and then calculates the number of steps required. It does this internally.....so really it does not matter what native units you use.
My machine has metric ballscrews, 5mm pitch, so it makes sense to use metric native units. My servos are set up to require 5000 steps to rotate precisely on turn, and the axis would move precisely 5mm.
My steps per unit is 5000/5 =1000 steps per unit. So easy. If you had inch ballscrews, say 0.200/rev or 0.25/rev then using inch units would make sense. Does not matter to Mach, it does not get
confused like you or I.

Craig

Title: Re: When changing from mm to inch unit
Post by: Chul Kim on June 20, 2022, 03:39:10 AM
dear craig

First of all, I am always grateful to know a lot about Mach4 through you.

Especially this time, it was very good to know interesting knowledge about cubit units.

The question about this unit change, as I mentioned at the beginning, I thought that the measurements were automatically substituted.

I'm not used to this job because I haven't had to work in inches at all.

So I thought I just had to change the unit and restart it in the mach4-configure-control-machine setup modes. In this age of technology, it seemed to have to be that much again.

However, that is not the case. I thought I missed checking somewhere else at first.

Therefore, after changing the unit to inch, the step of the motor was inevitably modified to fit inch.

Of course, after that, of course, the dimensions fit well, so I worked on it.

By the way, I don't know if you two didn't understand what I meant or if it would work.

I've actually done it several times and posted it on the forum. I even tried it on Mach3.

It is difficult because the advice of experienced people does not fit my reality.

So I copy and use the folder separately for each unit.

We can only use it as it is now, right?

Thank you for your advice.
Title: Re: When changing from mm to inch unit
Post by: joeaverage on June 20, 2022, 04:08:33 AM
Hi,

Quote
So I thought I just had to change the unit and restart it in the mach4-configure-control-machine setup modes.

No need, leave the machine setup units alone, do not adjust the steps/unit value....just apply a G20 or G21 and run the code.

I really only used cubits to demonstrate that Machs underlying units do not matter, Mach converts whatever Gcode, inch or millimeters,
you feed it to those underlying units. They could be cubits, or parsecs, or Astronomic Units, or mile-o-meters or the length of you know what!
All that is required is that you establish the correct steps/unit value, and you need never go back there again.

Mach, being US made, has always tended to be in inches. Over the years there have been a number of bugs where say the machine behaves
normally in millimeters but when jogging in moves in inches....and faults of that nature. I have not seen that bug occur in Mach4 for at least
five years.

Craig
Title: Re: When changing from mm to inch unit
Post by: Chul Kim on June 20, 2022, 07:19:30 AM
Dear Craig


I'm sorry to you who will be frustrated with me.

The attached photo was implemented immediately after receiving a reply.

As you can see, the unit was changed, restarted, and the G20 was inserted from the MDI (this part is already supported under the screen of the mach4) to draw a 2-inch square.

However, only 2mm squares are drawn very quickly.
When looking at the motor state in inches, it is the same as in mm.

Is there something in the ESS or in the BOB MB3 that is preventing the conversion of mm and inch for some reason?

I'm just frustrated, too.

Title: Re: When changing from mm to inch unit
Post by: Stuart on June 20, 2022, 07:23:21 AM
Tonge firmly in cheek , I thought the USA used bananas for measuring at least that's what Kurtis at CEE thinks
anyway my thoughts on mach 4 setup and mach3 for that matter

1 what are the ball screws imperial or metric
2 if metric set the machine up in metric on the setup page the calls are easy
3 ditto for imperial

then use the Gcode 20/21 to tell mach4/3 how to interpret the code

my cnc mill has metric screws therefore its set up in metric ( as are the rest of my machines and my head )
I have do not have any problem with other people  Gcode I just hand code it to suit my setup

just seen your comment the machine DRO will always display the machine setup unit not the Gcode preference
Title: Re: When changing from mm to inch unit
Post by: joeaverage on June 20, 2022, 07:49:29 AM
Hi,
do not change the default units. Leave them alone. Now close Mach, I mean shut it right down so that all the data
gets flushed to the .ini file. Now restart.  You need to power cycle the ESS so that it reads the new firmware.

Run the code with a G20 and then with a G21. Make sure that there are no other G21/G20 commands anywhere in the Gcode file.
You should not at anytime have to revisit the motor tuning pages nor the default units page, they should stay the same.

Craig
Title: Re: When changing from mm to inch unit
Post by: Chul Kim on June 20, 2022, 08:28:06 AM
I think I'm the only one who's crazy.

[Image 1] So I brought the inch version that everyone is using.
And I drew a 2-inch square exactly.

[Image 2] In that state, I changed it to metric units.
And restart.

[Image 3] MDI ordered the operation, but it looks 2mm in DRO
The real moving distance drew a 2 inch square.

Isn't it strange that I'm the only one like this?

Then is there anyone who can tell me what the problem is?
Title: Re: When changing from mm to inch unit
Post by: Chul Kim on June 20, 2022, 08:32:48 AM
I just uploaded and joeaverage replied.
I'll be right back after trying it out.
Title: Re: When changing from mm to inch unit
Post by: Chul Kim on June 20, 2022, 09:11:18 AM
When I came back and tried to correct it, the reply time passed.


Unfortunately, I've tried many refreshes
The change in the unit shown in the DRO was only formal.
In the meantime, the license code flew away.
(often happens)

I rebooted the computer, turned off the controller with built-in ESS, and restarted it, but the symptoms did not change.

I think I'll have a headache again tomorrow and be very tired.

I thank everyone for their attention!
Title: Re: When changing from mm to inch unit
Post by: Stuart on June 20, 2022, 10:22:24 AM
with reference to your last post "the licence code flew away often happens "

that comment made me think that you have a pc system fault

please tel us your pc specifications
ie windows ver other software running

back to basics when you change any setting in the mach4 setting drop down or the mach4 plug in you MUST power your mill down and exit mach4 ( preferably then turn off the power to both )

you say the licence "flew away" please try to tell us what happens is this because of a system crash 


now please do not take offence at this question but where did you get the licence for Mach4 from ? if it is not licensed correctly it will randomly shut down and not save its INI file correctly , it will run in sym mode but not when a motion controller is attached
Title: Re: When changing from mm to inch unit
Post by: Chul Kim on June 20, 2022, 07:31:59 PM
dear Stuart

The reply is late because there is a one-day time difference with South Korea.

It's early in the morning, and I was looking forward to it because I switched from Mach4-control to inch before I went straight to CNC and turned off the power.

There's something I haven't cared about so far.
It changed to Demo Version and PCID.
Of course, it didn't even work as an inch unit.

I changed to mm unit again and rebooted and came back to Hobby.
Of course, it worked well with mm.

Change to inch again, turn off the mach4, turn off the controller, and a little later
I turned on the controller again and ran Mach 4, but it was marked inch only on the DRO, and it became the same as the previous one.

It's a situation that you won't understand, but it's happening here.

It was officially licensed and purchased Mach4.

CNC has also been using high-quality parts for years to make woodworking crafts.

I don't feel the need to work in inches, because I was curious about the simple transition that you described.

Now, if you want to use it, you have to make a folder dedicated to "mm" or "inch" with motor tuning as shown in the attached picture.

I'm leaving the forum now because it seems to be wasting more time for everyone.

I hope the health and well-being of everyone who has paid attention.
Title: Re: When changing from mm to inch unit
Post by: Chul Kim on June 20, 2022, 07:36:34 PM

I'm adding it because the picture doesn't go up any more.

And machine.The conversion of the G20/G21 was not found in the ini

Should I go through another .ini file? It's really hard ^^
Title: Re: When changing from mm to inch unit
Post by: Stuart on June 21, 2022, 02:11:50 AM
g20/21 is found in the gcode from your CAM software


something in your pc is corrupting the setup files hence the licence changes you mention

and yes your English is 1000% better than my Korean

can you tell us what version of mach4 you are using the version on the download page has a few problems
Title: Re: When changing from mm to inch unit
Post by: compewter_numerical on August 26, 2022, 10:17:55 PM
I think I'm the only one who's crazy.

[Image 1] So I brought the inch version that everyone is using.
And I drew a 2-inch square exactly.

[Image 2] In that state, I changed it to metric units.
And restart.

[Image 3] MDI ordered the operation, but it looks 2mm in DRO
The real moving distance drew a 2 inch square.

Isn't it strange that I'm the only one like this?

Then is there anyone who can tell me what the problem is?

No, you aren't crazy. I've experienced this working with a company on their machine before.

They wanted to sell international and we were using imperial for the entire screenset the whole time we were developing the code for operation.

When we switched to metric, we had to change the counts per unit, velocity and acceleration for each motor in the motors tab of the Mach4 configuration.

The formula for calculation steps per unit is the giveaway here, as you need to put in the intended distance traveled to calculate it. (current steps * distance intended) / actual distance. That calculation WILL NOT be the same if you are using a different unit.

Just changing the units you are using in Mach4 DOES NOT change the steps per unit. It would be a nice additional feature to change it automatically for each motor if you choose to change the units, but I know from experience it DOES NOT.

The DRO's are just a GUI form element so you might need to go into the screen editor and change the way the DRO displays either inches or mm.

I posted a newer 'easier to use' wizard for calculating the steps per unit here:
https://www.machsupport.com/forum/index.php?topic=43830.msg281953#msg281953

The latest revision of that wizard is in the 5th post down on that forum post in a zip file. Just put it in your wizards directory in Mach4 and the wizard is called stepsCalc 

Title: Re: When changing from mm to inch unit
Post by: Chul Kim on August 26, 2022, 11:33:45 PM
I wish I'd known more in advance.
When I change the unit from mm to inch,
Automatically, the values such as step and counter acceleration of the motor used in the existing mm units did not change to fit in inch units.
I hope that his explanation will be a good guide for those who have told me in the meantime.

Thank you - compewter_numerical^^