Hello Guest it is December 09, 2023, 04:41:07 AM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - stephanbrunker

Pages: 1 2 3 4 5 6
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).

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.

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!  :-[

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]

' 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.

' #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]
'(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]
'(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

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.

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.

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.

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 
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.

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 ...

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.

Pages: 1 2 3 4 5 6