Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: jdoeren on November 07, 2021, 12:19:36 AM

Title: Mach4 g54 work cordinates trouble help please
Post by: jdoeren on November 07, 2021, 12:19:36 AM
so when I load my machine the first run is fine after that the night mare begins. ive been ucing Mach3 for over 10 years now and I have to go to mach4 but what im seeing is when I load material and the zero my cordinates along with my tool touchoff . the first run works good and then when i put in a new piece and then go thru the same process evetually I lose the correct Z. thought i was loosing steps and ythats wasnt it.
then eventually I figured out the g54 was automatically saving the work cordinates wrong, right for it wrong for me lol.
so I have a 3 axis rotary machine the rotary is the A axis  the linear axis is X and the Z axis the spindle. and I used the ceter of the material for my zero, but i zreo using a touchoff plate and compensate on the touch off tool. the problem is. if I home in place or home with proximity switch the offset for zwill be a - number. and im not very smart or I would have figured this out months ago. I have mach 3 on a bunch of the machines and mach3 doesnt care I always home in place and have never homed any of those machines and they work flawless run them 24-7. how do I get mach4 to work the same or what is the work around?  Im sure there is an easy solution if more info is needed let me know please.

I assume it works the first time because the machine and computer are a fresh boot up sp there is no data in the table offsets

thanks in advance JD
Title: Re: Mach4 g54 work cordinates trouble help please
Post by: jdoeren on November 07, 2021, 01:12:09 AM
so what I did was changed the G54 in the code to G55 and it still logs everything but isnt adding the offset to the work. before it was adding the machine and work together. I  think.
Title: Re: Mach4 g54 work cordinates trouble help please
Post by: jdoeren on November 07, 2021, 02:58:21 AM
ok I lied it didnt work . I atached some photos , you can see the third time i ran it the 3d file is inverted/reversed. at that point i have to rehome all axis and then try to clear machine cordinates again. its a real pain
Title: Re: Mach4 g54 work cordinates trouble help please
Post by: Graham Waterworth on November 08, 2021, 05:48:53 PM
Have you got a spurious G52 or a G10 in the code that is close to the end of the file?

Are you allowing the file to complete or stopping it mid run?

Or

Is the Z axis hitting the end stop at the end of the program by a few thou?


Offset will only work if you have a G43 Hnn in the program


Can you post the file so I can see what happens here.

Title: Re: Mach4 g54 work cordinates trouble help please
Post by: jdoeren on November 08, 2021, 11:32:13 PM
( Generated by SprutCAM )
( DATE: 11/7/2021 )
( TIME: 6:17:04 PM )

(Tool) (1) (Diametr)(0.875) (.875) (Operation) (Rotary Roughing 875)

N10 G90 G64 G50 G54 G80 G17 G40 G49
N20 G20 (Inch)
(Rotary Roughing 875)
N30 M998
N40 T1 G43 H1 M6
(.875)
N50 S18000 M3
N60 G0 G93 X-44.7375 Z5.9214 A-144.152
N70 G1 Z4.1714 A-144.151 F114.29
N80 Z4.1731 A-140.4 F732.2
N90 Z4.1685 A-137.702 F1018.07
N100 Z4.1732 A-135.005 F1018.42
N110 Z4.1685 A-132.302 F1016.16


N280340 Z3.4484 A1378.8 F615.67
N280350 Z3.4488 A1384.198 F615.58
N280360 Z3.4491 A1389.6 F615.06
N280370 Z3.4491 A1395.002 F615.02
N280380 Z3.4491 A1400.4 F615.48
N280390 Z3.4488 A1405.798 F615.52
N280400 Z3.4484 A1411.2 F615.11
N280410 Z3.4478 A1416.602 F615.21
N280420 Z3.446 A1421.342 F701.37
N280430 Z5.196 F200
N280440 M5
N280450 M998
N280460 M30
%



here are the start of the code and the end of the code and it does look like there is a G43 in there if you want all the code I can send it to you.
Im not a machinest by any way shape or form so thanks for your help. I know mach3 runs this code no issues mach 4 is whatr im having problems with .
Title: Re: Mach4 g54 work cordinates trouble help please
Post by: thosj on November 09, 2021, 06:26:25 PM
I think Mach4 is more "strict" with Gcode that Mach3 was so if you have a program that ran fine under Mach3 there may be something in there that is "wrong."

Three questions from a guy who doesn't know for sure!!

What's the G50 in line 10? If the answer is "I don't know.", remove it and try.

What is M998?

I've never personally seen the G43 stuff in the same line as an M6. I've always used one line, T1 M6, to change the tool, then a line like G43 H1 Z1. or something. Not sure if they can all be on one line like that.

Just some suggestions really, I don't know:)

Tom

Title: Re: Mach4 g54 work cordinates trouble help please
Post by: Graham Waterworth on November 09, 2021, 09:53:12 PM
I think we need to see the M6Start.m1s and M998.m1s macros to see what they are doing.

Title: Re: Mach4 g54 work cordinates trouble help please
Post by: jdoeren on November 27, 2021, 02:51:48 AM
Ive had to go to california for some work and im back and working on this problem again. i will post the m6 script later.
what im wondering is since the zero for the z is the center of my rotay as thats my a axis. and im doing the hight touch off from the head stock and added the diference from the center to the touch plate offset. could that be why im getting a negative instead of a postive in the g54 Z? it homes up to the top. I removed the m998 as it is for tormach specific m code. if I home my machine in place and and zero to the center of the a axis then load my material the roughing pass works great and sometimes but not always the finishing pass will work but alot of the time I actually have to restart my computer and start over.

and what im talking about with the z axis is i set it at 4.3118 and if I look at the table offset the z will be -4.3118 so when cycle start and it hits the g54 it changes the z to zero and well obviously that doesnt work. shouldnt the G54 stay at 0 like G54 X0 A0 Z0 ? 
Title: Re: Mach4 g54 work cordinates trouble help please
Post by: thosj on November 27, 2021, 08:25:14 AM
G54, and really ALL G54-G59, is the distance from machine coordinate zero to work position zero. So if you set G54 Z0 to some number, say your 4.3118, they MDI in G0 G54 Z0, the machine moves there. Clicking the Machine Coordinates button will alternately show 0 and 4.3118.

Homing in place I don't do and don't know how it really works. Having limit switches eliminates that, machine coordinate zero is always the same place.

The really odd thing here is one tool runs fine and the next "sometimes" does not. Are both roughing and finishing passes using the same tool?

Another thing, in a "normal" situation, with Z homing at the "top", all the way UP, and Z direction set right, G54 would be a negative value.

Tom
Title: Re: Mach4 g54 work cordinates trouble help please
Post by: jdoeren on November 27, 2021, 07:27:01 PM
I do understand what your saying, and I tryed homing with my switches and in place and cant seem to get the same results everytime.
this is my m6 script Im using. i want to thanks to you guys that are trying to haelp as this is so confusing for me. my other machines run mach3 are running smooth and making the switch is super frustrating.

function m6()

   local inst = mc.mcGetInstance()
   local selectedTool = mc.mcToolGetSelected(inst)
   selectedTool = math.tointeger(selectedTool)
   local currentTool = mc.mcToolGetCurrent(inst)
   currentTool = math.tointeger(currentTool)
   
   if selectedTool == currentTool then
      mc.mcCntlSetLastError(inst, "Current tool == Selected tool so there is nothing to do")
   else
      --Remove this line if you would not like the Z axis to move
      --mc.mcCntlGcodeExecute(inst, "G90 G53 G0 Z0.0");--Move the Z axis all the way up
      mc.mcCntlSetLastError(inst, "Change to tool " .. tostring(selectedTool) .. " and press start to continue") --Message at beginning of tool change
      mc.mcCntlToolChangeManual(inst, true) --This will pause the tool change here and wait for a press of cycle start to continue
      mc.mcCntlSetLastError(inst, "Current tool == " .. tostring(selectedTool) .. "   Previous Tool == " .. tostring(currentTool)) --Message that shows after Cycle Start
      mc.mcToolSetCurrent(inst, selectedTool)
   end
end

if (mc.mcInEditor() == 1) then
   m6()
end
Title: Re: Mach4 g54 work cordinates trouble help please
Post by: Graham Waterworth on November 27, 2021, 10:46:49 PM
When you change tool, have you got offsets set for the tools in use. Each tool will need its own because if you are using G43 with a H value its going to offset the tool height by the amount in the H offset.  If the tools are different lengths they will be in the wrong position if all the tool offsets are set to zero.

Title: Re: Mach4 g54 work cordinates trouble help please
Post by: jdoeren on November 27, 2021, 11:53:22 PM
i have them set to 0 because I dont have a toolchanger so i do a manual tool change and then use a touch off to set the z hight.
Title: Re: Mach4 g54 work cordinates trouble help please
Post by: jdoeren on November 28, 2021, 12:15:14 AM
this may be a stupid question but if I touch off when I change my tool and the height or Z is from the tip of the tool what does the tool offset actually do? in my mind i think if it adds the offset or subtracts it it will change my z position making my part either to big or too small. keep in mind I have been using Mach3 for over 10 years I think maybe longer and I have gotten way to comfortable I guess. lol time for me to put on my big boy pants and learn.
Title: Re: Mach4 g54 work cordinates trouble help please
Post by: thosj on November 28, 2021, 08:56:55 AM
If you touch off every tool, you change the G54 Z zero, right? NOT the tool length.

But.........it seems whatever you're doing in Mach3 SHOULD work in Mach4. So the problem seems to be tool lengths. Be sure there are all zero's in the tool lengths.

Is this what you do? Touch off tool 1, zero the Z DRO, run the program. Load tool 2, touch off the tool in the same place, zero the Z DRO, run the program. Is that it?
Title: Re: Mach4 g54 work cordinates trouble help please
Post by: jdoeren on November 28, 2021, 11:44:04 PM
yes thats pretty much what I do, but if you go to the table offsets and pull up the g54 it will have offsets for the x,A,and Z .then when you go to cycle start it will pull up or add the offsets in. if I stop before any movement and zero a,x and put in the z height from zero 4.3118 , reset and then cycle start it will work fine. i know its putting the work offsets and the machine offsets together by adding them to gether it comes out to exactly what shows up in the dro. is it possible I have some bad script in the start up somewhere? is there script for that ?
Title: Re: Mach4 g54 work cordinates trouble help please
Post by: thosj on November 29, 2021, 08:49:23 AM
Have you ever said here which version of Mach4 you're running? Are you running Mach4 stone stock other than motion controller plugin and ports/pins for your setup or do you have a bunch of screen edits to customize? If pretty stock, even if NOT, you can rename C:/Mach4hobby to something like C/Mach4hobby_OLD and reinstall, then copy stuff in Screens, Plugins, Licenses, Profiles, Modules, over to the new install. But........if you or someone else has written some bad script in the screenset, they're going to come along!!

Again, if you go to the Offsets tab and click Tool Table and Fixture Table, there's nothing in there you don't expect?
Title: Re: Mach4 g54 work cordinates trouble help please
Post by: jdoeren on December 02, 2021, 02:04:52 AM
Im running build 4612 with a smoothstepper rev.2 I do have a couple rev. 3 smooth stepper boards but they are for a couple other machines but from my understanding rev.2 isnt a problem.

Title: Re: Mach4 g54 work cordinates trouble help please
Post by: jdoeren on December 25, 2021, 12:55:53 PM
Merry Christmas

I have solved my problem and since thereisnt alot of people doing what im doing with my cnc Im going to post a video when I get time to my you tube channel. relitivly simple solution and now it works pretty much the same as the mach3 only better.

thanks for all the help guys.