Machsupport Forum

Third party software and hardware support forums. => Promote and discuss your product => Topic started by: stephanbrunker on July 02, 2015, 04:00:20 PM

Title: Free G76 Macro Helping program for Mach3 Turn
Post by: stephanbrunker on July 02, 2015, 04:00:20 PM
Hello,

I just have released a beta version of my Mach3 Threading Helper. To actually cut a thread with Mach3 and the G76 macro, you need a couple of parameters, the numer of passes etc. For metrical threads, Mach3 comes with the G76_thread.exe. My application is far more sophisticated: i lets you select a thread from several standards or let you create your own size. The important feature is, that the tolerances are calculated given to standard and size, that it fits. Then you can simulate the cut - means you can try some number of passes to get the increment you need. Finally, the program generates the GCode which you can copy & paste in your file. So far, my threads had a perfect fit. And it's Open Source.

The supported Threading standards in version 0.10:

When supported, you can cut threads with multiple starts, too.

I've also made a throughly improvement of the G76, G77 and G78 macros and fixed the bugs there as far as possible.

The Sourceforge page:
www.sourceforge.net/p/mach3threadinghelper (http://www.sourceforge.net/p/mach3threadinghelper)

Try it out and report if you find any bugs ...
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: derek on July 03, 2015, 06:39:19 AM
With all the crap going on with sourceforge injecting malware into downloads you may want to use a different repository.
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: stephanbrunker on July 03, 2015, 07:03:50 AM
Thank you for the advice ... but until now I never had any issues with Sourceforge, and I just checked the download with a MAC and it's exactly the one I've uploaded - it hasn't been tampered with.
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: derek on July 03, 2015, 07:46:42 AM
I would imagine they are targeting more popular downloads. Can't be too careful though.
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: stephanbrunker on July 03, 2015, 09:27:12 AM
So, just for information:

My application is fully portable, it doesn't need an installer. The *.zip contains the G76 Macro Helper.exe, which needs only the settings.ini in the same folder to run and looks there for the two Help files (EN and DE). So, it's as small and transparent as it gets - most of the 300kb of the archive are the images. And, if I get 100 downloads, that would be a lot. So, there's nothing really to tamper with. And, contrary to the FileZilla project, I never expect to get any money from my project and so I surely doesn't agree to any Adware.
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: Rimmel on August 31, 2015, 10:07:06 AM
With all the crap going on with sourceforge injecting malware into downloads you may want to use a different repository.
Hello,

I just have released a beta version of my Mach3 Threading Helper. To actually cut a thread with Mach3 and the G76 macro, you need a couple of parameters, the numer of passes etc. For metrical threads, Mach3 comes with the G76_thread.exe. My application is far more sophisticated: i lets you select a thread from several standards or let you create your own size. The important feature is, that the tolerances are calculated given to standard and size, that it fits. Then you can simulate the cut - means you can try some number of passes to get the increment you need. Finally, the program generates the GCode which you can copy & paste in your file. So far, my threads had a perfect fit. And it's Open Source.

The supported Threading standards in version 0.10:
  • M - Metric in medium (6g/6H) and fine tolerance (4g/4H)
  • G - Withworth Pipe
  • R/Rc - Tapered Withworth Pipe
  • BSW & BSW Withworth
  • UNC, UNF, UNEF
  • M keg - tapered Metric

When supported, you can cut threads with multiple starts, too.

I've also made a throughly improvement of the G76, G77 and G78 macros and fixed the bugs there as far as possible.

The Sourceforge page:
www.sourceforge.net/p/mach3threadinghelper (http://www.sourceforge.net/p/mach3threadinghelper)

Try it out and report if you find any bugs ...


I am using mach3 turn R3.043.063 and I don't have a m1076 to replace. Also can't make head nor tail of the program - can't get a simple M10x0.75mm thread working :-(
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: Rimmel on August 31, 2015, 10:30:40 AM
Seems to assume radius mode - when some people work in Diameter mode.
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: stephanbrunker on August 31, 2015, 12:25:23 PM
Answer to your questions:

I work with version 043.066, where the M1076.m1s file is in the root folder (not in /macros !! )

There is in the menu under Options/Parameter the X-Axis mode switchable between Radius and Diameter mode. (Documentated in the help file)

As for the G-Code header, take what you normally prefer for your work. For example, on my lathe with my tooltable the M10x0,75 program will look like (in radius mode):

Code: [Select]
g18 g21 g40 g90 g94 g80
t0404
s700
f85
m3
G77 r5 x4.953 k0.0 z-20.0
m5
s120
m0
f40
m3
G76 p0.75 r4.953 x4.396 h0.2273 i29.5 k-1.631 z-20.0 l360 q0
m5
m30

This will first bring the diameter down from 10 to 9.9 mm with a normal cutter, then request a tool change, and then cut the M10x0,75 with 6 passes (the first is 0.22 mm deep, which is okay even for a small HSS 60° cutter with a sharp edge. With some other tool you can probably cut it in only two passes ...). But the surrounding lines of code are very different for everyone, depending on the setup of the machine. The purpose of my software is in finding the initial dia (9.9 mm in this case), the depth based on the tolerance (0.2273 mm in radius), and to check the number of passes needed, which gives the depth of the first cut.

In Diameter mode, the two lines will change properly to G77 rXX x9.906 ... and G76 p0.75 r9.906 x8.792 h0.4546 ... that looks okay.

I found a bug, too - the steps for five passes aren't displayed properly, but that doesn't change the output.
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: stephanbrunker on January 03, 2016, 09:58:57 AM
Because I had to make all the testing alone and I didn't cut that much threads, there were some bugs in v0.10 to fix. If you look closely at the code I've posted above, in the G76 line both the k and z values were negative. But the k value should be positive to have a run-up. That was the biggest bug to fix. Unfortunately, the version 0.11 then wasn't extractable from the zip-file, but that was due to an windows7 bug (if you copy & replace something in win7 into a zip-file, the file gets corrupted). Today, I've uploaded v0.12, and that one should work properly. I've made an M5x1.5 p2 and a M14x1 and in both cases bolt and nut matched perfectly at the first try - awesome.
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: RICH on January 04, 2016, 06:42:03 AM
Be nice if it was also for imperial units. Some just don't use Metric.

RICH
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: Overloaded on January 04, 2016, 08:25:48 AM
Be nice if it was also for imperial units. Some just don't use Metric.

RICH

other than that, what do you think of it Rich ?

Going to Lebanon ?

Russ
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: stephanbrunker on January 04, 2016, 08:52:10 AM
The diameter and pitch input is accordingly to the Thread in Millimeters or Inch. Do you mean the Input for the Length and the Output for the diameters and tolerances? That is doable, because it's just everything divided  /25.4 and shown in a format "0.####"  But to avoid confusion, I'd put the selection on the settings page because then the output would be accordingly. It would be also better to put a "G20" or "G21" in the GCode output to make it destinguable.
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: RICH on January 04, 2016, 06:20:06 PM
Russ,
I didn't test it, and looks like a winner.
If Stephan adds the metric or imperial into the settings page  that would be great.
I would want any input and output to be in imperial units if that is was I set the program to.
I did something similar in my screen set for basic calc's when using the Threading Wizard.

Yep we will be at the show and will give a yell before then.

stephanbrunker,
Think I answered your questions. Good going but keep going...... :)

RICH

Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: stephanbrunker on January 04, 2016, 07:38:51 PM
The imperial option shouldn't be a problem. It should be doable in a few days to convert all User Input and Output from mm to inches according to a setting. I'll report if it's ready.
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: stephanbrunker on January 15, 2016, 06:14:08 AM
The relase of version 0.20 is delayed a bit because I discovered major differences between threading with an parallel port and an ESS. With the first, you need a bigger run-up, but you can change the core of the M1076 macro, with the last, the feed run-up is much smaller, but you cannot change the core of the macro. At the moment, I'm asking for solutions at warp9 ...
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: Tweakie.CNC on January 15, 2016, 07:19:09 AM
Have you now settled on using Mach3 version R3. 043.062 for both Parallel Port and ESS operation. ??

Tweakie.
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: stephanbrunker on January 15, 2016, 08:06:09 AM
ATM, I'm trying both versions of Mach3. But as far as i can tell, there is no difference regarding threading.
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: stephanbrunker on January 24, 2016, 11:34:00 AM
It took me a while longer, but now version 0.20 is online. You can now work in either millimeters or inches and of course output in both formats. I also figured out how the M1076 macro in every last detail works and improved it. I added a second macro which is called from inside to make runtime displays of the cut depth and set the S-word to true rpm and some minor improvements. I was asked on another place what my program can do what the existing solutions couldn't, and I can answer that like this: You get an improved set of macros for G76, G77 and G78. Then you can generate the code for a very wide range of threads in seconds and you can simulate the number of cuts. For the thread generation you basically only need the Thread type, the pitch and nominal diameter. Everything else like the depth of the cut and the tolerances is calculated for you. As far as I know, this is not provided by any other free solution for Mach3. And if you want to check your thread there is also a tool to calculate the flank diameter if you measure it with three wires.
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: RICH on January 24, 2016, 01:02:37 PM
Stephan,

I am sure the extra time was worthwhile. Thanks for sharing your work.
I'll check it out and give you feedback.
I'll be using  Mach3 version R3. 043.062 since that is the basis for my screen set.

BTW, It's nice to have someone do some lathe work.

RICH
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: stephanbrunker on January 25, 2016, 04:41:42 AM
If you are using your own screenset, the threading diag DROs have changed a little bit:
SetUserDRO 1240, StartX       
SetUserDRO 1241, EndX         
SetUserDRO 1242, StartZ         
SetUserDRO 1243, EndZ           
SetUserDRO 1244, Pitch         
SetUserDRO 1245, Taper           
SetUserDRO 1247, Number of passes total
SetUserDRO 1249, Total_Depth
and set while threading is running:
SetUserDRO 1246, actual passnum
SetUserDRO 1248, acutal cutdepth
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: RICH on January 25, 2016, 11:13:35 AM
COMMENTS:

1. Would be nice if the following fixed sizes were included in the
the Thread Spec:
   #0 to #12 UNF
   #1 to #12 UNC

   Also American National Standard Taper Pipe Thread
   1/16 to 2 NPT.

2. If leaving the range of the thread tables......
   What kind of unpredictablity may happen?

3. What if one wants to cut a Class 3A thread?

4. Here is something to consider, that's different / not found in most of these
    kinds of helpers and works nicely if you have an accurate lathe:
    Use Cut type 1, reduce the depth of cut, and you can end up with a nice Acme thread
    that can be done on a less powerfull lathe with a sharp v tool!

5. I do have a concern, I am wondering if fooling with the macro or whatever is going to screw up the threading
    .........as the threading cycle was designed when fixed. Spindle slow down, averaging, and sampling may be affected.
    Need to re-read  your notes more than just a quick read. Maybe Newfangled didn't want your help for an undisclosed reason.

Just some feedback,
RICH
 
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: stephanbrunker on January 26, 2016, 04:29:52 AM
Hello,

adding NPT, Class3A and the small UNF/UNC is simple. Because I'm from the millmeters and metric following, I simply don't know which of these - for me exotic - threads are mostly used. I've a table with #1 - #6, #8, #10 and #12, they have fixed sizes in fractions of an inch and not something like  the x/2^n for the other imperial threads? Does this subgroup has a special name, because I've to make a new entry for them in the drop-down list.

And "if you leave the tables": Basically, what I do for the tolerances is converting the tables to third-order equations. For the range of the tables, I've minmized the difference between the equations and the tables to less than 1/100 mm. But I don't know how the equations behave outside. For 10% more, it should be no real difference, for a diameter 10 times the biggest one in the tables, the values are surely wrong. I did it that way to have the ability to generate threads that aren't in the tables. If you enter 216/1000 inch with 24 TPI for the #12 UNC, you get the right values, I included that range.

Do you have any data for the Acme thread?

Basically, at Newfangled they said that they don't want to change anything at Mach3 anymore, 066 is definitively the last release forever, more or less end-of-life'd it.  And for Mach4, it's not a community project but that of a professional software company which simply does all the work itself and not revealing a scrap of the source code to any outsiders - or have any contributions from them. And about fooling with the macro: Basically, it wasn't programmed very clean. The macro only generates a code of G0, G1 and for the tread G32 moves and that you can change how you want. You can check that out with activating test mode, in this mode it outputs the generated code in a file. The only secret is the special threading mode, entered with two G32 concatunated to chain the retraction move to the previous G32. And that I've tested thoroughly. The threading itself as in the G32 move cannot be tampered with, that's completely internal.
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: RICH on January 26, 2016, 06:48:02 AM
Stephan,

Can you send me a personal message with your email address. I have some reference material / standards, but, I can't post them for the general public.

RICH



Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: RICH on January 26, 2016, 09:17:20 AM
No special name for the #0 to #12. See the attached chart for what belongs to UNC and UNF.
These size threads are used a lot by a lot of folks. Forget about cutting  internal threading for them.
The tolerance on these small sizes are very tight.

Just for info, the tolerance on pitch for Mach threading was based on comparing the pitch over an actual cut length.
There is a chart in the Threading On the Lathe write up (page 26).

I will get you data for the Acme threads and NPT. 

Some practical info on the Acme threads:
- It takes some HP to cut the thread, and a wimpy lathe is not going to do it.
- Most folks will use proper insert ( single or even chasing) and most amateurs will never grind a cutter for it properly.
  ( before someone barks! ) the generated code must assume a properly ground cutter and accurate enough cnc lathe to do the work,
  thus, it's not about the nut goes  on and life is good....enough said.

So what code is generated depends on what method and tool you will use to cut the Acme thread.
Maybe just provide another Tool input / choice for something like: Sharp V  or  Acme Insert.
Just a few thoughts for your consideration.

RICH
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: stephanbrunker on January 26, 2016, 09:55:51 AM
The table I've found has these threads in it, also NPT/NPTF and NPSM/NPSC. So that is no problem. There I've also the tolerances for the UNC. My code outputs the middle of the tolerance field, so in that case for UNC #12 the flank diameter would be 4.84 mm with a margin of 4/100 mm to each side, thats for class 3A and part of why I left these small ones out. More practiable to use a screwing die. The smallest tool I own for inside threads work from bores of 3 mm upward ...

And for the ACME or the Tr ... trapeze threads:  Perhaps it would be possible to cut a TR with 30° flank angle and a sharp 30° tool, but for that, I'd have to change the M1076.m1s macro on a fundamental basis to cut to the right depth in the first step and then wide it in pitch direction. Possible, but for an clean implementation, the GCode Interpreter of Mach3 has to be changed to add a new variable, and that is - see above - not possible as much as I'd like it to - think of the bugged T-Word. With the right cutter, it is only the depth to respect. So, I think it's going too far. If a change in Mach3 would be possible, I'd do it, but as it now looks, a clean solution is impossible.
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: RICH on January 27, 2016, 09:15:14 AM
Quote
And for the ACME or the Tr ... trapeze threads:  Perhaps it would be possible to cut a TR with 30° flank angle and a sharp 30° tool, but for that, I'd have to change the M1076.m1s macro on a fundamental basis to cut to the right depth in the first step and then wide it in pitch direction. Possible, but for an clean implementation, the GCode Interpreter of Mach3 has to be changed to add a new variable, and that is - see above - not possible as much as I'd like it to - think of the bugged T-Word. With the right cutter, it is only the depth to respect. So, I think it's going too far. If a change in Mach3 would be possible, I'd do it, but as it now looks, a clean solution is impossible.

No problem on not doing the Acme as many folks probably will never use it.
All one needs to do is  use the alternate flank cutting with a sharp V tool but define the proper X end in the Simple Threading Wizard.
The program doesn't know what tool you are actually using and thus it stops the cutting at x end. The tool will just alternately
remove material based on pass depth, doing one side and then the other and stop at Xend. I will add that the cnc lathe needs to be accurate
as it is the equivalent of doing multiple start thread.

I though I had the ASME Standard for ACME thread somewhere but can't find it! Only have ANSI / ASME B1.20.1

Thanks what you doing as I appreciate it,

RICH
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: stephanbrunker on January 27, 2016, 05:27:09 PM
I'm head first in the threadtables now. I corrected one big bug ( threads in full inches had dia 0) and I'm thinking about the tool radius because - that was also wrong - for some threads it's allowed for the tool tip to be sharp, and for some others, not. For BSW and BSF the inside thread can be sharp, but the outside thread has to be rounded at the bottom, there is a minimum value defined. Now I'm thinking how to realize that. For NPT, the value given is the width of the chamfer and not an radius. So, basically you can have two kinds of tools: some with an radius and some with an chamfer - and the limit calculations are different, of course. And, to get it all together, the trapeze treads are kind of in this too. I've broken some tools, especially thin ones. So, a sharp 30° tool is likely going to break. But you don't need a full set of tools for every trapeze thread if you have some with a chamfer more than half of the width at the bottom of the thread, cut alternating flank and shift the other flank for the missing width of the tool.
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: RICH on January 27, 2016, 07:00:06 PM
Quote
I'm head first in the threadtables now.

May the one above give you patience.

There are so many standards relative to threads and one dosen't know how ill educated they are until you really get into it.
I found hard copy of a few ANSI standards I had. You need to purchase the standards as they are not free from the different organizations.
I know your having fun and learning a lot also.

In the end sometimes "the nut goes on" does have a practical meaning in terms of tolerance. Frankly, I try to do a Class 3 and if it doesn't spec,
well, then I have a class 2. For an NPT, it takes some care in all that one does, since in the end most will be only able to check how many turns it takes to lock up and that the threads all make contact at lockup. What is important from a design perspective is what the thread needs to accomplish, and that ends up having all of these different standards to address the different needs.

Oh, BTW, there no such thing a sharp V tool since every threading tool will have a radius of some value and that needs to be taken into account.
Even if you do grind the tool on a grinding machine it has a silly radius at the point, and if it is say only 0.001" rad that tip radius will break off
in short order.

Just some insights for those following this thread,

Have fun,

RICH


Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: Denford Miracle on March 03, 2016, 10:42:56 AM
Anyone,

When I try the G76 thread helper, I get the following:
G20
G77 r XX x0.6175 k0.0 z XX
G76 p0.0909 r0.6175 x0.4828 h0.0426 i29.5 k0.3525 z-0.5 l360 q0

in MachTurn I use the macros that come with the G76 thread helper when you download and Mach gives me an error at the G77 line.  Does anyone know whats wrong?
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: stephanbrunker on March 03, 2016, 11:14:25 AM
The G77 (Turning) is to bring the material to the outside diameter of the thread first - in this case 0.6175''. But it cannot know from which chunk of material this is. So, you have to replace the "XX"es for r with your start dia. For example, you can start with a 0.75'' dia and bring it to 0.6175''. The length z should also be greater than the 0.5'' of the thread to avoid a collision with the uncut part. So, put in there your values or if you do it manually, just delete the G77 line. In either case, you have to change your tool between the two lines, because you will use different tools for roughing and thread cutting ;-)

So, a full code may look like this:
Code: [Select]
g18 g21 g40 g90 g94 g80
s350
f40
t0202
g0 x12 z2
m3
#101 = 1.7899
G77 r5 x3.94 k0.0 z-7
g0 z30 x20
m5
t0404
s120
f15
m3
#101 = 1.7899
G76 p0.75 r3.866 x3.297 h0.232 i29.5 k3.141 z-5.875 l540 q0
m5
m30
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: Denford Miracle on March 03, 2016, 12:26:03 PM
ok, got it.  the material size has already been taken care of before threading.  so ill just take the G76 line and try it again.

thanks  :)
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: Denford Miracle on March 03, 2016, 04:36:07 PM
#&*$%*$#&%$*#@*@!!!!!!!!!    I just spent time to write up a post and then its all lost from uploading too large files.  so all text is lost!  bummer!!!!

brief description of pics:
1st machine position before cycle start
2nd screen before cycle start
3rd machine position after moving
4th screen after moving has stopped. notice the graphics, the green live is what the machine does. it moves a little then a little jog in and over and then stop.   that's it.
5th the program

any ideas what I should do?
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: Denford Miracle on March 03, 2016, 04:37:00 PM
more pics
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: Denford Miracle on March 03, 2016, 04:37:33 PM
one more
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: stephanbrunker on March 04, 2016, 04:12:49 AM
Hmm, can't say much to that. But the G76 line (that's whats my  program is for) is basically independent from the M1076.m1s macro, as it is described in the Mach3_Threading.pdf. Did you try that? And which Mach3 version do you use? The macro basically expands the G76 line into single G0/G1/G32 moves. If you set the test=false line to test=true, then the output is written to ThreadTest.tap so you can check the expanded code.

So please try the original M1076.m1s macro to check if it's an error in the macro.

!!!!!!!!!!!!!!!!!!!!

Saw it on the bottom of the screen: Threading does not work with the demo version!! You need the full version, otherwise it wouldn't work. That is written in the description of the demo version ...


Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: Denford Miracle on March 04, 2016, 10:05:11 AM
Stephan,

I was using .066 verison, but I saw in a lot of thread's that an older version for threading works.... so I installed .057.

I never thought about putting the license file back into the installed directory.  youre right, it does say demo at the top of the screen "Mach3 CNC Demo"    I never noticed that.

I will reinstall .066 and then redo the license and xml and everything and try again.

I feel like an idiot, but I guess we all make mistakes once in a while.

thanks.   ill post back what happens.
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: Denford Miracle on March 04, 2016, 12:16:57 PM
Stephan,

Thank you very much for helping me with my problem. It looks like the only thing wrong was Demo mode!!!!  I feel like such an idiot. I completely forgot about the license file when changing between versions of Mach3.

I am currently running:  3.043.066  and I am using all 4 macros(M1076, M1077, M1078, M1176) that you include with the G76 Thread Helper download.

so far, with only a few thread programs, it works REALLY well.  I don't see any problems yet.  all there is left to do is dial it in and see how good of a thread it makes.

Thanks again.
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: stephanbrunker on March 04, 2016, 12:43:52 PM
It happens. In Version 0.20 there is a bug if you enter a thread in full inches, like 1 0/0'' . I overlooked there the div/0 problem. I'll fix that in the next version, until then enter like 0 1/1'' ... such things simply does happen.

And that was the idea: Dial the thread to get the G76 line or lines for multiple threads and check how many passes you need. And get a part which is within the tolerance fields because the code aims in the middle of the tolerance so you have maximum error margin.

At my todo list are the trapzeoid threads, but that is not easy. If you have for each pitch a new set of cutters, the mathematics are easy, but it's hard for your lathe. If you want to make more than one pitch with one cutter and simply wide it, that is not so simple ...
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: stephanbrunker on April 13, 2016, 01:35:27 PM
Version 0.30 is now online. I have included most of the requests, UNC/UNF/UNEF in Class 3, NPT,NPTF,NPSC,NPSF,NPSM threads and extended the tool tip functionality. Now, you can select rounded or chamfered tool tip and according to the thread, it calculates the minimum and maximum values for the tool tip. Did some bugfixes too. Because I could only spot checking for all the data, take care. Even in my datasheets were some typos and I simply don't know how many bugs are there left to find. If you find some, open a ticket on sourceforge, I'll fix it as soon as I can. I left out the trapeze threads, because you either need a tool for each pitch there or a totally different approach to threading.

Code: [Select]
Changelog
---------

v0.30
-----
- corrected some little bugs in the tolerances for UN.. and R
- big bug: Cut depth for UN_ inside was 1/8 H too deep
- big bug: X start value for Taper was equivalent of 1 pitch wrong
- Diameter for full inches was wrong
- minimum tool radius for outside BSW,BSF
- shifted infeed formula to settings page
- added tooltypes: chamfer or rounded
- added NPSM,NPT,NPTF,NPSC and NPSF threads
- added 3A/3B (fine) tolerances for UN.. threads
- added display of the taper value
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: RICH on October 16, 2016, 10:11:52 AM
Note:

The latest version is v0.30v2

After one downloads the program ( link is the first page of this thread ) open the read me text file for the change log.

RICH
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: stephanbrunker on March 10, 2019, 07:57:06 PM
I had a special request and because of that, I tackled the quest of threading trapezoid or rectangular threads. For this, in most cases multiple Z passes per depth have to be cut. This could only be done by a total rework of the M1076.m1s macro, but after 40 hours of programming, the rectangular threads are working already. I still have to do some bugfixing for the trapezoid threads and after that, I have to extend my Helper program to generate the code for ACME and Tr threads. So, this functionality is coming soon if I can make the time. Even with a careful approximation, I'll need 200 more hours of programming for that.

See the attached picture: A rectangular thread with 2.5 mm groove width, cut with an 1.5 mm tool, additionally in a tapered version.
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: Rimmel on March 11, 2019, 06:12:57 AM
Stopped using program ages ago, for most instances it's too complicated for general use, I spent more time messing about with the tip radius setting than anything else (not actually using  the setting just trying to get numbers that worked in it for different threads). 
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: stephanbrunker on March 11, 2019, 07:29:35 AM
Too complicated for general use …

You can use it or not … unfortunately, threads are really complicated and my approach is a very much simplified one. I didn't make all the norms about tolerances and thread profiles and allowed tip forms but tried to make it as simple as possible. Of course, you can ignore that and calculate everything per hand - which is even more complicated. Or you can cut and try until both pieces fit together. Everyone should do what he likes most.

Just now, I read an old article that the seemingly straight flanks of threads aren't really straight because the pitch angle of a thread has an influence and that angle is different on the outer and inner diameters, especially for large pitches relative to the diameters (e.g. multi-pitch-threads) . To do it perfectly, you'd need a precision grinded tool for every diameter / pitch combination …

For example, I added an calculator to make a three-wire-measurement of the flank diameter. That one is much simplified, because other calculators want an input for the deforming of the wires because of the measurement force and that small error because of the pitch angle. I ignored all that because these factors are in the range of only few 1/100 mm and less and I didn't expect to be so precise. But basically, that approach is wrong ...
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: TomWh on June 05, 2019, 11:19:31 PM
If any one is following this thread I could use some help.  New to the cnc game and just got mach 3.  Will be doing some simple threading and ran accross this thread.  I down loaded the zip file and pasted into mach 3 on the hard drive.  I can not seem to get it to come up in mach 3 turn.  Also can not get g76 to come up anywhere.  Thought I would try this and the wizard that is on the mach 3 turn. 

Thanks Tom
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: stephanbrunker on June 06, 2019, 06:54:03 AM
There should be a m1076.m1s file in the /mach3/ main directory, while all the other macros are in the /mach3/macros/%yourprofile% subfolder. Just replace that macro and the g76 command should work. All I did was to improve that file.

I also just published a hotfix for that macro at 
https://sourceforge.net/projects/mach3threadinghelper/files/
because there was a nasty sign error which resulted in a wrong Z Start value.

This version of the macro also contains an extension for trapezoid threads like Tr or ACME or threads with flank angle 0° like in the attached picture which need multiple passes per increment in X. I did that because of an request for these threads by someone. Said someone also said he would sponsor that development, but he bailed after I put more than 40 hours into that code and he got the result. Because he switched to Mach4, I also rewrote the macro into a code generator for Mach4.

To fully utilize the possibilities of that macro, the GUI has to be extended as well to generate the code for that extension for a lot of Tr.. or ACME threads. But so far, I never got any positive reviews of my work which tells me that seemingly nobody needs that piece of software. Because I don't need that functionality for myself and as Jack-of-all-Trades I have more than enough projects to work on, I am reluctant to put the needed (likewise 40-100) hours into that project. I will happily work for free, but only if it gets a reasonable number of users.
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: rcaffin on November 30, 2019, 09:35:55 PM
Hi Stephan

I tried downloading the hotfix version, but it seems to still have that sign error on K. At least, as far as I can see! Certainly with K3 in the g-code, it seemed to start with -ve Z rather than with z=+3.

VERY strangely, the display under Mach3 SEEMS to have the right value, with the threading starting 3 mm away from the chuck, while the actual cutting started 3 mm towards the chuck.

Mach3, 0.062, ESS with latest driver, W7,  in Sandvik mode

Also, the Help file seems to have zero contents, despite its size.

Any chance of some help here?
Cheers
Roger
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: rcaffin on December 01, 2019, 06:37:33 PM
Hi Stephan, or anyone else who knows:

"If you are using your own screenset, the threading diag DROs have changed a little bit:
SetUserDRO 1240, StartX       
SetUserDRO 1241, EndX "

Yes, but what do these DO? Where are they defined? Why are they even in the M1076 code?
For that matter, where do the variables such as tXStart() and tEndX etc come from?
I really would like know! Is there a magic book somewhere which I have missed?

Equally, in M1076.m1s there is the following:
npass = GetUserDRO(1022)

Where is UserDRO(1022) defined?

I am sorely puzzled.
Cheers
Roger
PS: previous query about the K variable has been resolved.

Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: stephanbrunker on December 02, 2019, 04:52:48 AM
Hello Roger,

Windows Help (*.chm) showing up empty: This is due to Windows security settings. Go to the *.chm file, select properties and remove the security block.

The User DROs:
Mach3 shows all numeric output in DROs, one for every value. That might be the Feed Rate or the X-Axis Position … everything. In the screenset shipped with Mach3 (not a customized one) there is a tab "Diagnostics" with a section about threading diagnostics. What this does: It shows information about the threading like StartX, EndX, StartZ EndZ, Pitch, Taper, Total Passes, Current pass and current depth. That means: you can switch to the diagnostics tab and see on what pass you are and how many to go. And because the Gcode is "compiled" (kind of simulated) after loading it into Mach3, I needed the additional macro 1176.m1s to show the current values when the code is running because this macro is called on every pass and updates the DROs. Otherwise it would show the last value from the compiling run.

If these DRO numbers reserved for threading (1240 - 1251) are not in your sceenset, nothing happens. Simply as that. What I did was just to reorganize the DROs used by the original screenset to show the important data, so I switched these a little bit around. Because of that, I changed the screenset as well to change the labels of the DROs accordingly and included that in the package. The changes aren't critical, #1248 showed Depth of First pass before and shows now the current depth for example.

I happily answer your (relevant) questions.
Regards,
Stephan
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: rcaffin on December 02, 2019, 03:25:34 PM
Hi Stephan

For your reply many thanks. Really.

Help file now active, and extremely useful.
Your Help file is the only place so far which has explained the difference between Sandvik mode and 'ordinary' mode. Any other references for explanations? Just curious.

DROs now understood. I was using the standard screenset plus some extras. For my own use I have added some DROs at the bottom for general diagnostics - same idea. I will have to explore your version.

What I don't yet understand is why a G01 following a G32 has to wait for an Index pulse. Is this something in the Mach3 source code? If so, what was Art trying to do here??? We may never know.
Anyhow, why must one use a G01 at the end of the G32? Could one not use a G00 and simply pop out of the thread as fast as possible? That way all the worries about Retract_Dis would (mostly) go away.

Background:
I have a solid mill, not a router. I am having problems with an M4x0.5 thread in brass. The profile I am getting is not good; asymmetric and curved on one side. I don't think it is a mechanical problem because my backlash is very low and other machining is very precise, and previous work with M4x0.5 used to be nice and clean. Very strange.

I am using an ESS (W7, with .062) using the latest driver, which has been update to handle a 512-line encoder wheel on the spindle for threading. This is new, and only in the latest (last) release. It seems to work fine - I think. At the moment I am assuming that the Index pulse is passed through as fast and as reliably as before. I have not (yet) checked this as per the Mach3 Threading PDF: I may need to do so.

So I thought I would play with the M1076 macro and simplify it down to handle my normal needs: fine threads in aluminium or brass so radial infeed and  no taper (ever). Also I have changed the G01 after the G32 to a G00 to see what that does. This works fine on the screen in my office, but I have yet to see how well it works on my mill. I will update here.

Cheers
Roger Caffin
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: stephanbrunker on December 03, 2019, 04:09:11 AM
Hello Roger,

the G32 / G01 is in the source code. I found that out only through trial and error, in that case the original M1076 macro was directly coded to interact with the Mach3 source code. More precisely: Two G32 after another unlocking the threading feature and G80 exits it. I exploited that in a way that the G32 do the same move as the G0 positioning move and then the next G1 is synchronized and does the threading. Simply put you can just use that one G1 and then a G0 to pull out. You just have to check what happens to the next G1 move because it expects to make the pullout as a G1 as well while keeping the synchronization.

I expanded the M1076 for trapezoid threads for someone and he had also issues with an encoder on the spindle axis. This seems to be deep in the interaction between the motion controllers plugin and Mach3. I don't know more about this, just that a single index pulse seems to work well, especially when the spindle speed is fixed like with an old school asynchronous motor.

Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: rcaffin on December 03, 2019, 06:23:36 AM
G01: Well, we will find out, won't we?   :)
Double G32: OK.  I will test that too.
I have the time.

Debugging the CypressBasic macro is a pain. The tools available are 'not good'. Never mind, work in progress.
I wonder whether Lua is better?

Cheers
Roger
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: Rimbaldo on February 25, 2020, 08:59:19 AM
Hi!

I want to give it a try on your program, but whichever thread I try, it generates a buggy gcode, in the G77 line:

G77 r __ x18.893 k0.0 z __

It always comes with these r___ and z___

How can I fix it?

Thanks a lot!

Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: stephanbrunker on February 25, 2020, 10:44:51 AM
Hello Rimbaldo,

two lines of code are generated. The first line is for preparing the bolt or nut with the M1077 macro, turning it to the right diameter and length. For example, the outer diameter of an M10 ist not 10.00 millimeter, but only 9.85. But the program cannot now your starting diameter and the length you wish, so I made underscores you can replace with the values of your stock material. Of course, you will need an different tool for this turning operation, but I supposed anyone can copy the line in his favorite gcode template. For tapered threads, it will actually make the tapered bolt in the right dimensions. Because of that, the M1077 macro is included in the package.

The second line is the actual G76 threading line for usage with an V-shaped tool.
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: Rimbaldo on February 25, 2020, 11:53:58 AM
Stephan, thanks for your quick answer!!

I have some more installation doubts... maybe some are dumb...

The new macros supposed to be in the  mach3 “Macros” directory, should be put on the root “Macros” or in “Macros/Turn” directory? I put in the “Turn” subdirectory. The “Macros” directory has no macros and only the mill, turn and plasma subdirectories and no files in it.

The new screenset, and new 1076 macro are still compatible with the normal threading wizard? I tried the threading wizard and it gave my an error in line 199 (divided by zero)


Thanks!!





Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: stephanbrunker on February 25, 2020, 02:21:07 PM
The macros are updates of existing ones. The m1077 and m1078 should be in mach3\macros\%yourturnprofile%\  with the subfolder named after the name of your turning profile. This folder should not be empty. I only improved these macros and by the way, i use them for most of my turning operations because you more or less for most operations turn from diameter a to b on length c. m1077 (G77) is turning, m1078 (G78) is facing. Far easier than using the wizards. The documentation of the variables is on the beginning of each macro.

m1176 is a new addition and allows the display of the current cut values on the diagnostics page. Because the labels of the DROs didn't match i fixed them and that is why the screenset is included. So this also doesn't change the functionality. I had to do this with an extra macro because the Gcode from G76 is precompiled and cannot display information on runtime. It simply calls m1176 and that displays the information.

Only the m1076 is different, because you can find it at the mach3\ root folder. Here I also improved only the inner workings of the macro and did not change its interface.

The only source of problems can be if you use the variables #101 following parallel because i needed them for additional input.

So everything should be compatible with existing features because all changes (except the variables) are internally for each macro.

Code: [Select]
'==============================================
' M1076 UNIVERSAL MACH3 THREADING MACRO
'==============================================

' This macro implements the G76 call inside Mach3 to cut a wide variety of
' threads. Because some features aren't supported by the G76 letters,
' this macro also uses # variables.

' USAGE:
'--------
' #121=   (Taper in degrees)
' #122=   (Trapezoid Tool width or 0 for V - Threads)
' #123=   (Trapezoid Tool widening)
' (122 + 123 together are the width of the trapezoid bottom)
' #124=   (Trapezoid Flank Angle: 0 - vertical, ACME - 14.5, Tr - 15 )
' #125=   (Flank sizing)

' G76 X~ Z~ Q~ P~ H~ I~ R~ K~ L~ C~ B~ J~
' R - XStart
' X - XEnd
' K - ZStart
' Z - ZEnd
' Q - Spring Passes (optional)
' P - Pitch
' H - Depth of first pass
' I - Infeed angle
' L - Retraction in degrees (360 - one full turn)
' B - Depth last pass (optional)
' J - Minimum depth per pass (optional)
' C - Clearance (optional)

' From Mach3- Turn Options:
' - Minimum depth per pass
' - Cut Type: 0 - righthanded / 1 - lefthanded / 2 - alternating from inside / 3 - alternating from outside
' - Infeed Type: 0 - equal chip area / 1 - Sandvik formula (only for V - Threads)

' The controlled point of the tool for all threads is in the Z center position

' This macro is based on the original m1076.m1s macro from the Mach3 Installation,
' but heavily extended and reworked by Stephan Brunker

' IMPORTANT: Usage changes against previous versions:
' Cut type alternating and lefthanded are now switched
' Lefthanded always cuts against the Z-Axis movement, independent of Z-Axis direction


Code: [Select]
'G77
'(Xx.*********x XDia NEEDED)
'(Zx.*********x End Z NEEDED)
'(Fx.*********x Feedrate)
'(can be Set In the settings page:)
'(Hx.*********x Depth of cut)
'(Cx.*********x Clearance In the X)
'(Qx.*********x Clearance In the Z)
'(Kx.*********x ZStartpoint)
'(Rx.*********x XStartpoint)
'(#101 = Taper in Deg)
'(#102 = Taper Anchor Mode 1 or 2)
'There're different ways to anchor the taper
'Mode 1 anchors the Taper End at EndZ and StartX
'   and will turn parallel, then tapered and correcting EndX if neccessary
'Mode 2 anchors the Taper at StartZ and EndX
'   and reduces the dia first, then turns the taper, corrects EndZ if neccessary
'default is Mode 1
'refer to attached TaperModes.png for illustration

Code: [Select]
'G78
'(Xx.*********x XDia NEEDED)
'(Zx.*********x End Z NEEDED)
'(Fx.*********x Feedrate)
'(can be Set In the settings page: 'Hx.*********x Depth of cut)
'(Cx.*********x Clearance In the X)
'(Qx.*********x Clearance In the Z)
'(Kx.*********x ZStartpoint)
'(Rx.*********x XStartpoint)
'(#101 = Taper in Deg)
'(#102 = Taper Anchor Mode 0 or 1)
'There're different ways to anchor the taper
'Mode 1 anchors the Taper End at EndZ and StartX
'   and will turn parallel, then tapered and correcting EndX if neccessary
'Mode 2 anchors the Taper at StartZ and EndX
'   and reduces the dia first, then turns the taper, corrects EndZ if neccessary
'default is Mode 2
'refer to attached TaperModes.png for illustration
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: Rimbaldo on February 25, 2020, 04:46:59 PM
Thanks Stephan!

I was just making sure everything was alright.

Should I edit something in yours m1076.m1s file?

The screenset is ok, DROs are correct.  If I try your G76 line or the threading wizard's G76 it just goes to the other line and doesn't even begin to thread. G76 doesn't even begin to move.


If I go back to the original m1076.m1s file, then yours G76 line and the wizard's G76 works normally apparently.  I'm cutting air for testing, so I can't check number of passes yet. Just checking if spindle get's turned on and synchronizes with the axes and makes the threading moves.



So.. do I have to do something else?

Thanks for your support!




Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: stephanbrunker on February 25, 2020, 05:12:28 PM
If nothing happens, look into the macro. There is a line

test = true (or false) .

If this option is set to true, the output is dumped into a ThreadTest.tap file and nothing else happens. I just saw that this was the case in the 0.33 version of the macro, remaining from my debugging. Just change that to test = false and the code will be run instantly as usual.

(You can also load that ThreadTest.tap file to see all the code generated by the macro)

Sorry for that oversight!  :-[
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: Rimbaldo on February 25, 2020, 06:51:35 PM
Thanks Stephan!

As I’m not in the lab anymore, i tried over my laptop in the demo mode. Indeed it was set to true.

I changed to false and mach3 generates the number of passes accordingly and simulates correctly the code generated by your macro!

But when trying to generate the code using the threading wizard, it gets back to that error in line 199 of the m1076.m1s file: it says divided by zero and doesn’t work.

Apart from that, you could also save all last user inputs of your program. Everytime I turn it on it gets back to the first thread of the list. It could go back to the last one used. For instance, I’ll try the UNF 3/4 16 TPI and it resets to metric when restarting.

Also, is it possible to set the depth of the first layer at will, or it’s always automatic?

Thanks again for your quick support!
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: stephanbrunker on February 25, 2020, 08:08:12 PM
How convenient that it shows the line where the error occurs. I presume that the wizard is not very clean programmed and inputs a retraction of zero which then makes that div/0 error. It is just not possible to retract instantaneously. To circumvent that bug, the simplest solution is a default value for the L-word, like 360 degrees - one full turn.

Insert before line 116
Code: [Select]
RetractZ = Retract_Deg * Pitch / 360
this line
Code: [Select]
If Retract_Deg = 0 Then Retract_Deg = 360
I looked into the original file and there the retraction value in Z was allowed to be zero. So it coded an instantaneous retraction in X while Z ist still moving … the result is a very unclean cut which has very likely an offset in Z for each pass, but more or less unpredictable. I cleaned that up and now the retraction follows exactly the pitch and constantly reduces the depth to zero and that with the same increment like the main thread.

-----

I decided against an automatic saving of the last used thread because the thread selection is just two clicks. And it seemed unlikely that you would make a lot of only slightly different threads in multiple sessions. More likely are very different threads.

-----

The depth of the first pass (not the last finishing one) is determined in the formula like all the others. There are two strategies: Equal chip area and the Sandvik formula. You can change that in the Mach3 Turn options (Infeed Type 0 and 1) and in the options of my Program to get the same values. The Sandvik formula uses a smaller first pass and increases the following ones.
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: rcaffin on February 25, 2020, 08:54:02 PM
Tricky stuff, threading.
I created my own M1076 macro from the original.
I stripped all the taper thread stuff out: I never turn a taper thread.
I stripped all the Sandvik/other stuff out and do a simple radial feed (mainly Al & brass).
I stripped all the Test stuff and other variables out.
(If I want any of these, I can revert to the original of course.)
What is left is the hard core of threading, and it works.

Then I tweaked the ESS settings in the very latest driver to improve the sync, since I have a 512 line encoder on the spindle. With Mach3 you can't do PID control successfully, so don't bother trying. (Warp9 endorse this.) Instead of telling the driver to use 512 pulses per rev and a prescaler of 1, I now use 32 pulses per rev with a prescaler of 16 (32*16=512). The prescaler stabilised the sync pulses so the Mach3 RPM DRO became very steady, and it now gives me a nice clean thread on a semi-production basis. (You could go 16/32 instead: it makes little difference.)

Background theory: with a prescaler of 1 you are at the mercy of any noise or line-to-line variations, and this noisy signal gets sent to Mach3 - which cannot handle it properly. That means Mach3 is wandering all over the place with the starting sync position and with the RPM. Erk.

Cheers
Roger
Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: Rimbaldo on February 28, 2020, 07:08:58 PM
Hi Stephan! Today I managed to do some real tests with your macro and thread helper! In plastic yet...

But the 3/4 16 TPI thread I tested (not the fine one, the other one) worked perfectly and fit my bolt in the first attempt. I’ll test in brass over the weekend.

A doubt: I chose Z = 0 as the start and Z= 6 (-6) as the end of an external thread.

It begins the thread at 5.17 (or something like it) and stops before the -6. I had to make it to -7.5 to actually get to -6 in Z

The clearence in Z is 0.2mm

My settings are metric, Z-, 0.2 in clearence in x and z, parallel port for now...



Title: Re: Free G76 Macro Helping program for Mach3 Turn
Post by: stephanbrunker on February 29, 2020, 03:51:54 AM
It should have the -6 at the very end of the pullout. I did that to prevent collisions if you have a tiered bolt (and it was so originally). So if you have 360 degrees pullout, you have to add a full pitch to get the length of full thread you want.

The 5 - something is around three pitches run-up to stabilize the sync between spindle and Z-axis. The parallel port takes longer to stabilize than the Smoothstepper, so i made that an option (smoothstepper is one pitch plus clearance).