Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: DerekJ on February 07, 2021, 07:38:02 AM

Title: Font Engrave wizard X shift
Post by: DerekJ on February 07, 2021, 07:38:02 AM
Hi All,

I'm just trying out the font engrave wizard for the first time.
I position my cutter at the correct XY location and zero both axis before I start.
I set everything according to the video and the engrave works fine.
Problem is that if I then go back into the wizard and reload without changing anything the X axis shifts.
This shift increments each time I reload so the text is pushed further off the bed.
I've put the starting lines of the first and second engrave runs below and you can see that the starting X has shifted by 326 mm??

The machine and work coordinates don't move and I can use G0 X0 Y0 without problem.

I must be missing some reset command but I can't find it.
Anyone got any ideas?

First Engrave Gcode
(Font Engraving)
G90 G80 G49 G55
G0 X0 Y0
S10000 M3
G00 Z1.0000 M8
X-39.5300 Y35.0150
Z0.2500
...
Second Engrave Gcode
(Font Engraving)
G90 G80 G49 G55
G0 X0 Y0
S10000 M3
G00 Z1.0000 M8
X286.7100 Y35.0150
Z0.2500



Thanks
DerekJ
Title: Re: Font Engrave wizard X shift
Post by: Brian Barker on February 07, 2021, 08:07:27 AM
It is using the G55 offset , Delete G55 in the Gcode and see if you like that better. Clearly we need to take that out so it will run with your current fixture offset. I think we did this so it would not mess with your current fixture to do some engraving but I think we may have been doing a little over thinking ;)
Title: Re: Font Engrave wizard X shift
Post by: DerekJ on February 07, 2021, 08:21:01 AM
Thanks for the reply Brian.

Even if it's using the G55 work offset, the X value should not increment each time I save and re-load the Gcode from the wizard without changing anything? The offset should be constant, or do I misunderstand it.

Thanks
DerekJ
Title: Re: Font Engrave wizard X shift
Post by: Brian Barker on February 07, 2021, 08:57:49 AM
Mine is not doing that here. I remember we had early versions that would shift the position of the after every engraving so you could keep engraving. We can rip that out :)
Title: Re: Font Engrave wizard X shift
Post by: DerekJ on February 07, 2021, 09:11:21 AM
My version is
4.2.0.4300
Build
4300

Downloaded not so long back.

Title: Re: Font Engrave wizard X shift
Post by: Brian Barker on February 07, 2021, 09:15:20 AM
Are you seeing the X position change after you press the save and post Gcode ?
Title: Re: Font Engrave wizard X shift
Post by: DerekJ on February 07, 2021, 09:32:09 AM
Hi Brian,

Yes, the original top few lines of Gcode in my original post were made like this:-

1)   Exit Mach4
2)   Start Mach4
3)   Home the machine
4)   Move to centre of bed
5)   Zero work coords
6)   Enter the FontEngrave wizard, all values saved from last time including text start X & Y.
7)   Press Save and Load, copy the Gcode to post here.
8)   Close Gcode File
9)   Enter the FontEngrave wizard, all values saved from last time including text start X & Y.
10) Press Save and Load , copy the Gcode to post here

Please note that I'm very new to Mach4 and CNC in general so it's probable I'm doing something stupid!

DerekJ


Title: Re: Font Engrave wizard X shift
Post by: Brian Barker on February 07, 2021, 09:36:02 AM
I have 4385 on my laptop that I have with me that I am testing with. I am not running parts but I have had it make the gocde over and over. I have done it changing the file name and not. I will upload a new lua file for you to put in your Modules\AddOns\FontEngraving directory.

I did some digging and nothing is setting the X position other than when you open the dialog it gets the position of the last time you ran it. I don't see anything doing math on that so I think this one is all good. I don't work on this code :( I only did the original layout for it so I have to dig a bit.
Title: Re: Font Engrave wizard X shift
Post by: Brian Barker on February 07, 2021, 09:38:34 AM
I can tell you that you are not doing anything stupid, I need to figure out what is causing you issues and make it go away :)  My issue is I have done this for so long I frankly have forgotten what it was like to learn this. That is why I am here :) Looking for what it causing issues and fix them!
Title: Re: Font Engrave wizard X shift
Post by: DerekJ on February 07, 2021, 09:41:27 AM
Thanks Brian,

I'll try that later on when I get my machine back on line.  Baking a cake at the moment :-)  How random is that!

Thanks for the help
Derek
Title: Re: Font Engrave wizard X shift
Post by: Brian Barker on February 07, 2021, 09:46:23 AM
:) About as random as I am firing up the snowmobile for the kids. Its Sunday!

Tell me how you make out and if you need me to remote in to look I am more than happy to do so.
Title: Re: Font Engrave wizard X shift
Post by: DerekJ on February 07, 2021, 02:08:08 PM
Hi Brian,

How did the snowmobile outing go?
My cake was Soooo Gooood   :-* Chocolate sponge with black cherry Jam (jelly?) mixed with cherry brandy as a filling.

Anyway serious stuff...
I replaced mcFPanel.lua in C:\Mach4Hobby\Modules\AddOns\FontEngraving with the module you gave me to download.
Started Mach4 and selected Simulation Device as the motion Device as I'm not at my CNC at the moment.
Restarted Mach4
I did not bother with zeroing the machine etc.
Opened "Select Wizard\FontEngrave"
Don't change anything, just hit "Save and load"
Point to a save file to save it in
this is the start of the Gcode that was loaded...
(Font Engraving)
G90 G80 G49 G55
G0 X0 Y0
S10000 M3
G00 Z1.0000 M8
X-39.5300 Y55.0150
Z0.2500

Close the Gcode file
Just repeat the above procedure to get this Gcode.
(Font Engraving)
G90 G80 G49 G55
G0 X0 Y0
S10000 M3
G00 Z1.0000 M8
X286.7100 Y55.0150
Z0.2500

The difference in the first X position is 326.24.
My soft X limit is 320 so the second shot at engraving is almost in the same position just one bed size over.

I'm not in any kind of rush to get this resolved so enjoy whatever is left of your weekend with the kids. :-)

Thanks for the support over a weekend!
DerekJ

P.S.
I tried to attach some cake for you but it made a mess on my computer keyboard when I tried to push it in :-(
DJ

P.P.S.
Should have said that the two lua files are the same size ((443,511 bytes)
Title: Re: Font Engrave wizard X shift
Post by: Brian Barker on February 07, 2021, 03:26:07 PM
Well I never closed the wizard ! That was the trick!

I got some of the cake on this end ... just enough to screw up the keys LOL.

Let me dig and see if I can make that go away! (this shifting that is)
Title: Re: Font Engrave wizard X shift
Post by: Brian Barker on February 07, 2021, 05:12:56 PM
WOW did you ever put me down a rat hole!

I think I found the issue!
Title: Re: Font Engrave wizard X shift
Post by: DerekJ on February 08, 2021, 09:29:36 AM
Hi Brian.

Did you solve this issue? Is there a LUA file to download?

Sorry for spoiling your Sunday.
Derek
Title: Re: Font Engrave wizard X shift
Post by: Brian Barker on February 08, 2021, 09:58:27 AM
I fixed it once and didn't like how I did it so I am doing it over. I have been working on this thing for the entire morning! It has to do with global and local libs that where used. I am trying to clean all that up now :)
Title: Re: Font Engrave wizard X shift
Post by: DerekJ on February 08, 2021, 11:15:56 AM
OK thanks, don't rush for me if you have more important stuff to do.

Just so long as I didn't miss a download link or something in the previous post.

DJ
Title: Re: Font Engrave wizard X shift
Post by: Brian Barker on February 08, 2021, 12:13:50 PM
Well I think I got it how I like it .. You get to test it! LOL

Shifting gears to doing LUA is a struggle for me. In C++ I know exactly how I would make this happen. In Lua it will make things and you don't even know it! You think your looking at the same object but your not! Anyway I have a new way of doing things that was simple to pass the functions down for posting.


Title: Re: Font Engrave wizard X shift
Post by: Brian Barker on February 08, 2021, 12:15:43 PM
Here you are.. if it works I am ready for a stiff drink LOL
Title: Re: Font Engrave wizard X shift
Post by: DerekJ on February 08, 2021, 12:38:36 PM
Hi Brian,

Works for me!  :)
I replaced the entire FontEngrave folder in C:\Mach4Hobby\Modules\AddOns with the contents of your ZIP.

Below are the Gcodes collected in the same way as my previous post.
You can see that the X position is the same in both so enjoy that drink!

Thanks again
Derek


(Font Engraving)
G90 G80 G49 G55
G0 X0 Y0
S10000 M3
G00 Z1.0000 M8
X-39.5300 Y55.0150
Z0.2500


(Font Engraving)
G90 G80 G49 G55
G0 X0 Y0
S10000 M3
G00 Z1.0000 M8
X-39.5300 Y55.0150
Z0.2500
Title: Re: Font Engrave wizard X shift
Post by: Brian Barker on February 08, 2021, 12:57:27 PM
Will do!!!  Gosh I had not had a struggle like that in a long time. This will be put into release soon
Title: Re: Font Engrave wizard X shift
Post by: DerekJ on February 08, 2021, 01:50:29 PM
LOL :-)

Before I retired, I spent 15 years as a programmer.
It's hard to explain to someone why you have worked your donkey* off for a week and only produced 5 lines of working code. Most people don't see the 100 pages of abandoned code-tests and dead-ends.
BUT the WORST, the ABSOLUTE WORST, is to spend days trying to debug some code, only to find an obscure reference on the Internet that says "this behaviour is by design".  So I know how you feel. :-)

Best
Derek

* donkey.... a kind of ass :-)


Title: Re: Font Engrave wizard X shift
Post by: Brian Barker on February 08, 2021, 03:16:19 PM
My real issue is that in lua you can't pass pointers to objects, well sort of.. I had to take the posting class and after I did a require of the font take and jam the posting class into it's Metatable. I was trying to do it like I would in C because that is how I think... NOT SO! But we got it and at the end of the day it was simple once I got my stubborn head around it.

One good thing about making code is that you sure do feel good for about 20 min after it works ... Then you get the next problem and it starts all over again !