# Machsupport Forum

## Mach Discussion => General Mach Discussion => Topic started by: sparkyengle on June 18, 2010, 02:07:01 PM

Post by: sparkyengle on June 18, 2010, 02:07:01 PM
Does anyone know of a cad program that can be used to design a wormgear that has a gradual increase in it's pitch the longer it is. The gear I am looking to design will have a 2" diameter, and be approximately 2' long. It will have a starting pitch of about 1/4" on one end and gradually increase to about 3/4" on the other end. Any design help would be greatly appreciated. Thanks...Andy.
Title: Re: worm gear cad design
Post by: Dan13 on June 19, 2010, 06:47:52 AM
Should not be a problem if you can write a mathematical expression for the helix you're describing ;)

Daniel
Title: Re: worm gear cad design
Post by: Tweakie.CNC on June 20, 2010, 06:58:17 AM
Can't help being curious but what would you use a variable pitch screw for please ?.

Tweakie.
Title: Re: worm gear cad design
Post by: RICH on June 20, 2010, 07:41:02 AM
You could create one using 3d of a cad program ( haven't tried ) ie. you do a helix with a decreasing end diameter.
Now to get the gcode to cut it is a different story.....Mach threading is based on a constant pitch,  set by  feedrate over a distance...
Noot sure a if a math expression applied to something would work...
I don't know ....just some thoughts!

RICH
Title: Re: worm gear cad design
Post by: Ya-Nvr-No on June 20, 2010, 08:04:55 AM
http://www.sosmath.com/algebra/logs/log4/log4.html
Title: Re: worm gear cad design
Post by: stirling on June 20, 2010, 12:17:05 PM
Here's a quick play around. X is axial and A is rotational Z gives the radius. The idea is that X moves in steps of a thou along the 2 in and the loop calculates the new rotation of A to vary the pitch. A starts at the .25 in pitch and finishes at the .75 in pitch.

pseudo code:

a = 1.44 (degrees)
x= 0.001 (inches)
G91
for int i = 0 to 2000
G1 Xx Aa
a = a - 0.00048
next

g-code:

#1000=1.44
G0 X0 Z1 A0
G91
M98 P1 L500
G90
M30
o1
M98 P2 L4
M99
o2
G1 X0.001 A[#1000]
#1000=[#1000-0.00048]
M99

Just kind of a starter describing the general idea. (I use two loops to give 2000 iterations because the limit in Mach of a loop seems to be around 998 or so).

Ian

EDIT: typo: I'd set Z to 10. Of course it should be 1 (as it now is)
Title: Re: worm gear cad design
Post by: sparkyengle on June 21, 2010, 06:20:33 AM
Thanks Sterling. I'm soon finding out this is going to be way over my head.(logarithms and such). Maybe after I study more on writing code I will try what you are talking about in your example. Thank you anyway. Do you have any good suggestions on where to start for a noob wanting to learn g-code basics?
Title: Re: worm gear cad design
Post by: Graham Waterworth on June 21, 2010, 07:52:31 AM
this might be a good place to start :-

http://www.amazon.co.uk/Programming-CNC-Machines-Student-Workbook/dp/0831133171/ref=pd_cp_b_2

Or here

http://www.amazon.co.uk/CNC-Programming-Handbook-Peter-Smid/dp/0831133473/ref=pd_sim_b_2

Graham
Title: Re: worm gear cad design
Post by: khaled on December 22, 2013, 06:39:15 AM
Hi there can anyone help me with G CODES FOR A 2 THREAD worm using ball end cnc milling its a 76mm diameter and the pitch is 27mm
Title: Re: worm gear cad design
Post by: RICH on December 22, 2013, 07:07:04 AM
Not what you asked for but consider using the lathe to do it using alternate flank infeed.
FWIW,
RICH
Title: Re: worm gear cad design
Post by: mrprecise44 on December 22, 2013, 01:34:45 PM
Here is a method that should make a variable screw without CAD. Per your description of beginning with a 1/4" pitch, and finishing up with a 3/4" pitch in 24", the following should work.

Since the screw will be 24" long, the average pitch length is .5" , and the approximate number of A revolutions will be 48
If you wrote a line of code, G1 A360 X.25, the mill setup will cut a single thread of .25" pitch. We want to repeat this action 48 times, and increase the X value a given amount for each revolution.
If you divide the average pitch length (.5), by 48, the incremental change =.010416" per single revolution of the A axis.

Now you can write a simple program that increments the X value .010416 inch for each 360 degrees of A axis revolution. You should be able to increment the A by 360 each iteration of the loop, as the change per revolution in X is pretty small.There are examples of incrementing values using G90 and G91 in the forum.
The loop repeat will be 48.

You should be able to write the code with varibles for X, A, and Z so you can make multiple passes.

John

Title: Re: worm gear cad design
Post by: khaled on December 22, 2013, 04:57:10 PM
someone on cnc zone sent me a short G code example of what i want to do i never did g codes before this is my first time using G code on mach 3 so im still trying to wrap my head around it ;D here is a sample would you approve it
g21 g90
m6 t1
h1 ( tool offset if your using it )
m3

{copy}

g1 z 50. f# ( move to above the part )
g1 x0.0 y0.0 a0.0 f# ( note if a is moving father then x,y distance feed in deg/ min. )
g1 z36. f# (depth of cut )
g1 x-270 A3600 f500 ( this cut will make ten rev to - 270 @ 500 deg/min)
g0 z 75
g0 x0.0 a 0.0 ( back to start )

{end copy}
{pasted}
g1 z 50. f# ( move to above the part )
g1 x0.0 y0.0 a0.0 f# ( note if a is moving father then x,y distance feed in deg/ min. )
g1 z35. f# (depth of cut ) {change this Z for cut depth}
g1 x-270 A3600 f500 ( this cut will make ten rev to - 270 @ 500 deg/min)
g0 z 75
g0 x0.0 a 0.0 ( back to start )

{end pasted}

m5 ( spindel off )

thankx alot
Title: Re: worm gear cad design
Post by: mrprecise44 on December 22, 2013, 06:49:16 PM
This works on my mill. Just had to try it!

(** Variable pitch Screw Cutting **)
(Screw #4)
(12-22-2013)
(Cuts an increasing screw pitch)
(X change =.1 per 10 degree rotation Axis)

G0 G20 G49 G40.1 G17 G80 G50 G90 G98
G00 X0.0 Y0.0 A0.0 Z.1
M6 T2
M03 S1800
G00 G43 H2 Z1.0

(set Parameters)
#10=[.1] (increment value of X axis feed)
#11=[10] (increment value of A axis feed)

G0 X0.0 Y0,0 A0.0 Z.1
G1 Z-.1 F10

M98 P1000 L9

G90
G0 Z.1 M9
M30

O1000
G91
G01 X#10 A#11 F200
#10=[#10+.1]
M99
%

Just change the values for #10 and #11 to make the screw pitch you want. Running this program, I did a feedhold every 10 degrees to see the increasing X distance. This only turns for 90 degrees, but the motion is smooth.

John

Title: Re: worm gear cad design
Post by: mrprecise44 on December 23, 2013, 12:00:34 AM
In the previous, I mis-labeled #10 as the increment value when it is the starting X value for the beginning of the loop. The increment value is the .1 value in the last line of the o1000 routine; #10=[#10+.1]

In the case of cutting the 24" leadscrew, the (Set Parameters) line would read:
#10 = [.25]
#11= [360]

and the line in the loop that does the actual increment would be;
#10=[#10+.01046]

The X axis increases in a continuous  progression as the A axis rotates.

and, the M98 line would read;
M98 P1000 L48

The first demo makes it easy to stop motion at 10 degree intervals to check how the X value is increasing. Also, if using a tiny step as the actual run would be, it would be difficult to see the actual increase just looking at the DRO; thus the larger values to test.

John

Title: Re: worm gear cad design
Post by: khaled on December 23, 2013, 01:20:33 AM
Hi there
Thank you so much for all your replies sorry went to sleep I think because of the time difference.
please im so sorry im very new to this I have no experience in this please bare with me,never did g codes before so really don't understand your method:-(
let me try and explain exactly what I need to do an please help.and does this mean that the g code programme I sent you is not correct ? and sorry im only used to mm measure
I would like to make a worm 2 float or 2 thread the lenghth would be 150mm
depth 6mm
the pitch 27mm
tool diameter 10mm ball end mill
so sorry man and thank you for your help
Title: Re: worm gear cad design
Post by: mrprecise44 on December 23, 2013, 12:39:56 PM
The original post was for a Variable Pitch thread, starting with a 1/4" pitch (6.34mm) increasing uniformly as the shaft rotated to 3/4" pitch (19.04mm) at 24"  (609mm) from the starting point.

My example is how to drive a rotary axis (A) in sync wih the linear (X axis) to  produce such a thread.  Such a thread is definitely unusual, which actually could be described as a Linear Cam, and not really a machine Thread.

The use of G90 and G91 make this possible in a continuous manner.  The G90 code means all dimensions are Absolute, i.e., if the mill is at X0, Y0, Z0, A0 and the first line of code in a routine is G90, followed by G01 X5 F20, the mill table will move from X0.00 to X5.000 Y0.0 Z0.0 A0.0.
If this code is in a routine, and is repeated, such as the loop in my example, the machine will NOT move again, because it is already at X5.000.

The G91 code means all dimensions are treated as an INCREMENTAL move, and every time a loop is read, such as the example, each time a value for X5 is read, it will move again that distance. If the loop containing X5 is read (4)times, the machine table will be at X20.000.

The difference in millimeters to inches is by a factor of 25.4.  To change from an inch dimension, divide the INCH dimension by .0394, which is the Inch Decimal equivalent of 1mm.  One inch divided by .0394 = 25.4

The .0394 value is rounded to 4 places for simplicity; 1 divided by 25.4 actually = .039370079

I suggest your question about a metric dimensioned screw be a new topic.

If you want to cut a thead using a rotary axis as my example shows,  you do not use an increment factor in the loop.

John
Title: Re: worm gear cad design
Post by: khaled on December 23, 2013, 03:16:59 PM
hi there thank you man you way too professional for me its great yes i see what you mean well sort off but i would like to make a double thread not variable sorry man im also not familiar with many of these phrase and codes but thank you so much for your great detailed explanations.
if i had to put in the g codes i posted to you will i achieve my result of the pictures i posted or can you please show me a small example of the details i sent you man this really tough for me im
jusT at the start everything is so new
thank you very much
Kind regards Khaled
Title: Re: worm gear cad design
Post by: mrprecise44 on December 23, 2013, 05:54:10 PM
khaled:

You want to make a 2-start thread with 27mm pitch and the length of the part is 150mm.
27mm does not divide into 150mm evenly. 150mm / 27 = 5.5555, so we make the distance machine travel an even multiple of 27mm.

6*27mm=162mm
6*360 degrees = 2160 degrees

Rotary axis turn 6 revolutions - X axis travels 162mm. This will produce a 27mm pitch using whole numbers.

Set your X0.00 5mm before the end of the 150mm length material. There must be clearance for the cutter. You can cut off the small diameter end stub in a lathe after the threads are cut.

A 10mm ball mill cannot cut full depth in 1 pass. You must make many small passes. The Z depth number must be input manually before each cutting pass. Run program as many times as it takes to achieve full depth.  Try 1 or 2 mm depth as a start.

This will allow the cutter to go to cutting depth and not break the tool. The bottom of a ball mill has no ability to cut in a straight down motion.

The cutting action will start before the part begin end, and finish travel past the end of part.

Touch-off surface of the part with 10mm Ball mill. This is your Z0.00

Sample program:

Step 1:

G0 G21 G49 G40.1 G17 G80 G50 G90 G98

G0 Z20.0 X0.0 Y0.0 A0.0   (move to start position, 20mm above part)
M3                                   (start spindle)
G1 Z-1  F#  M7                (feed down to Z depth and turn on coolant)
G1 X162 A2160 F500     (27mm pitch thread, 6 revolutions of A axis)
G0 Z20                            (tool clear of part)
M30                                 (end program)

Step 2:
Do not remove part from rotary axis, or change any X0.00 or Z0.00 positions.
After finish Z depth is reached, do:
MDI: G1 A180 F200
This will rotate the A axis 180 degrees from original A0.00
Re-set A axis to A0.00, now 180 degrees out of phase from first thread.
Repeat program until full Z depth.

You now have a 2-start, 27mm pitch thread part, with a 10mm ball form thread.

John

Title: Re: worm gear cad design
Post by: khaled on December 24, 2013, 01:22:32 PM
:)Hi there man thankx a million for your support and the programme with explanations , i understand alot more now youve really helped me i will try it out soon and post to you my results.
one more query before i do is there any specific settings on Mach3 that i need to set ex: the degrees/min or anything for the 4th axis? or anything else on mach3 settings
Thank you again.
Title: Re: worm gear cad design
Post by: mrprecise44 on December 24, 2013, 03:26:47 PM
khaled:

You do not set "Degrees per minute". The feedrate in Mach3 is "units per minute", and a UNIT is the system in use; INCH (G20) or METRIC(G21).
Since your system is metric, you just use a number after the "F" G-code, and Mach3 will drive the X axis and the A rotary axis correctly.
Mach3 uses the radius setting entered in "Settings", and the "Steps Per" in the Motor Configuration to co-ordinate the X and A axis.

When the X axis and A axis move together, as in the program line with X and A on the same line of code, they are moving in a VECTOR; meaning
a combined motion with both axis in SYNC. The two axis begin moving together, and arrive at their respective end points together, even though
the two axis motors are running at different speeds.

Settings page:
Insert the part RADIUS in the box upper right - A radius.
The "Axis Inhibits" box needs to check the X,Y,Z,and A box.

Config/General Config:
Upper left, check "A axis is angular

Config/Motor Tuning:
A axis, "Steps Per", set the number of steps for the rotary axis to move 1 DEGREE.
The "VELOCITY" and "ACCELERATION" settings will be much higher than the settings are for the X,Y,and Z.

Tune the rotary table to achieve best speed and smoothness.
Check the Steps per setting when you are finished, by doing an MDI, G01 A360 F200, and see that the rotary table
stops at the exact point that it started at A0.00
Take time to get best result for motor speed.

Re-start Mach3 to enable these settings.

Because a ball mill is a poor metal removing tool for roughing, you should use a 6mm cutter, and an 8mm cutter set to the appropriate depths to remove the bulk of material in the thread groove before using the ball mill. Any CAD program can show how deep each cutter can go without cutting into the 10mm diameter curve outline shape.

John
Title: Re: worm gear cad design
Post by: khaled on December 24, 2013, 04:50:02 PM
What a great explanation thank you i did the settings as above and i try to run the program as above
Step 1:

G0 G21 G49 G40.1 G17 G80 G50 G90 G98
and it says error in this line is there something wrong with this line of codes maybe error  on a setting
man im toubling you lots God bless you!!!!!! ;)
Title: Re: worm gear cad design
Post by: khaled on December 24, 2013, 04:50:55 PM
What a great explanation thank you i did the settings as above and i try to run the program as above
Step 1:

G0 G21 G49 G40.1 G17 G80 G50 G90 G98
and it says error in this line is there something wrong with this line of codes maybe error  on a setting
man im toubling you lots God bless you!!!!!!
Title: Re: worm gear cad design
Post by: mrprecise44 on December 24, 2013, 09:40:33 PM
khaled:

I rewrote this on my machine, and it loads with NO fault.
The post I sent for you to try, would not load on my machine either. Do not know why?

G0 G21 G49 G40.1 G17 G80 G50 G90 G98

G0 Z20.0
G0 X0.0 Y0.0 A0.0
M03 S1000
G1 Z-1.0 F10 M7
G1 X162.0 A2160.0 F500
G0 Z20.0
G0 X0.0 A0.0 M9
M30

If this gives trouble, retype the program on your computer by hand. If you copy/pasted the first
program, perhaps there were some Windows/Word letters that cannot be seen. I am using a brand new
computer with Win7, and there are some bugs to work out maybe. I specifically made sure this was saved
in plain text format. That is the only thing I can think of.

John

Title: Re: worm gear cad design
Post by: khaled on December 25, 2013, 01:08:18 PM
Good afternoon
thankx yeh i checked it could of been alphabet that i used also and now it works with this new Gcodes
could you please advise on the Rotary table settings on the method for 'steps per'
rotary pulley 40 teeth
the motor pulley 20 teeth
how would i calculate the steps per ; velocity and motor tuning?
Title: Re: worm gear cad design
Post by: mrprecise44 on December 25, 2013, 02:14:46 PM
Khaled:

What is the rotary table gear ratio ratio?
What are the steps per revolution of the motor driving rotary table?

John
Title: Re: worm gear cad design
Post by: khaled on December 25, 2013, 02:43:59 PM
The rotary ratio is 40 to 1
motor steps 200 per revolution.
Title: Re: worm gear cad design
Post by: khaled on December 25, 2013, 05:15:53 PM

The rotary ratio is 40 to 1
motor steps 200 per revolution.
Title: Re: worm gear cad design
Post by: mrprecise44 on December 25, 2013, 06:29:16 PM
Khaled:

If the rotary table ratio is 40:1, that means 40 turns of the input shaft of rotary table = 1 rotary table revolution, or 360 degrees.

1 turn of the rotary table equals 360 degrees / 40 = 9 degrees per 1 input shaft rotation.

This seems like a very large movement for a rotary table. Most rotary tables over 150mm diameter (about 6 inch) are 90:1 ratio, and rotary tables in the 100mm diameter (4 inch table diameter) are usually 72:1.

Please recheck if the table ratio is 40:1

Such a ratio is a very poor use for a CNC machine.

If that is true, then the timing belt reduction of 2:1 = 400 motor steps for 1 Table input shaft rotation.

The equation to calculate STEPS PER is:
Motor steps per revolution (200) * ratio of timing belt drive (2) * ratio of Rotary table (40)  = Total number pulses to go 360 degrees = 16000
Divide this number (16000) by 360 degrees = STEPS PER 1 degree = 44.44444

You cannot have a fractional STEPS PER except if it is an even fraction equal to micro-steps, like 1/2, 1/4, 1/8 micro-steps, then a fraction like .5, .25, .125 will equate to a whole number when factored with the multiplier of 2,4,8 in the final calculation.

If the larger pulley is a multiple of 9, then the STEPS PER will be a whole number for your 40:1 table ratio.

20:45 = 50 STEPS PER
20:54 = 60
20:63 = 70
20:72 = 80

400 motor steps / 9 degrees per table shaft rotation = 44.44444 steps for 1 degree table rotation.

The STEPS PER must be a whole number, and not some fraction unless it was 44.5 or 44.25, and in that case micro-stepping of 1/2 or 1/4 would work. These two examples would work because if micro-stepping 1/2, and using 44.5, the STEPS PER = 89, and micro-stepping 1/4, STEPS PER = 177.

If you use a 20 tooth pulley on the motor, the other pulley must be a factor of 9; 45, 54, 63 etc. to get a whole number for STEPS PER.

John
Title: Re: worm gear cad design
Post by: khaled on December 26, 2013, 01:17:26 PM
;)HI John
Thankx again for the explanation yes i have a 40:1 universal table maybe its old but i do have a VERTEX HV10 254 diameter which is 90:1 but it has a backlash which im not sure how to minimise! its mounted shaft to shaft so would the calculation 200* 90 =18000/ 360 = 50 steps per is this correct?
but my problem is this rotary table has backlash is there a way to minimise it on the table itself. i know its done on mach3 settings for backlash but dont see on the rotary table.
THANKX

Title: Re: worm gear cad design
Post by: mrprecise44 on December 26, 2013, 03:54:18 PM
Khaled:

The 254mm table, 90:1 ratio is a much better choice. However I  would still use a reduction from stepping motor to worm screw of table. Since the table worm shaft is much higher from the base, a 60t pulley or even an 80T woulld be better. If you used 20t to 80t timing belt reduction, the steps per would be exactly 200. This would make 1 turn of the motor = 1 degree of rotation. This will have much better torque, and the motor will be operating in its better range. The the cutting action will not be fast anyhow, as a 10mm ball cutter at full depth in the finish pass cannot be pushed fast at all. It also will require a quite LOW spindle RPM, as a great deal of cutter surface is in contact; it must be a slow, steady cutting action with coolant. So, the greater reduction all works for the positive.

As far as backlash, there is usually a means of adjusting the worm screw to ring gear to account for general wear. In addition to getting less backlash, if you put some kind of slight drag on the table with a friction material like a piece of leather, it will stay tight against one side of the ring gear; and the cutting force is a constant load in one direction only. You are not making a cut in a forward/reverse situation, like an X/Y axis anyhow. If you get it apart, you will probably find it needs lubrication if it has sat for a long time. The backlash will not be a problem if all things are setup correct. In rotary axis machining, having everything rigid is very important.

Testing the cutting action with a standard cutter of smaller diameter as I suggested, you can test how the cutting action works best by programming the cut from left to right, and then try cutting from right to left X axis motion. One direction may prove better due to the cutter forces, and backlash. When starting the cut, you can also do an MDI, moving the table and X axis backwards from the start position about 10mm, and then back to the start point, and all backlash will be out of both the X axis, and the rotary table. You can get all the correct settings, feedrate, best cutting direction on a test blank.

Once your mechanical motor setup is done, spend time getting the A axis motor tuning working smooth. There are some good trial and error tutorials in the forum how to get the best performance with stepping motors. The Velocity and Accel settings for the Rotory table will be quite a bit higher than the X or Y axis settings. Just keep increasing the numbers, and listen to the motor sound, and smoothness. It will eventually stall, or sound really bad. Back off the settings about 10 or 15%. You will get a feel after testing, what works best. It is all a trial and error unless you have the high-end drivers that have computerized analysis feedback.

John
Title: Re: worm gear cad design
Post by: Tony Bullard on December 27, 2013, 11:59:02 AM

"The equation to calculate STEPS PER is:
Motor steps per revolution (200) * ratio of timing belt drive (2) * ratio of Rotary table (40)  = Total number pulses to go 360 degrees = 16000
Divide this number (16000) by 360 degrees = STEPS PER 1 degree = 44.44444

You cannot have a fractional STEPS PER except if it is an even fraction equal to micro-steps, like 1/2, 1/4, 1/8 micro-steps, then a fraction like .5, .25, .125 will equate to a whole number when factored with the multiplier of 2,4,8 in the final calculation."

Won't Mach work with the 44.44444 but only stop on a whole number? Like 6 degrees (266.6664) would stop at 267 or maybe 266
Title: Re: worm gear cad design
Post by: mrprecise44 on December 27, 2013, 12:42:22 PM
Hi Tony:
I thought I made this point in my post about steps and degees of rotation. I did not say to use a fraction like 44.44444. I fully understand a stepping motor will go to either 44, or 45, not some interval in between, because we are dealing with a magnetic lock on 1 step out of 200 per revolution. I thought this was clear.

My reply was to explain how the STEP PER number is derived, and why it must be a whole number.

I am trying to explain things that are pretty fundamental to a non-English speaking person, who although new to Mach3, is serious about doing a fairly difficult machine job. His English is 100 times better than my ability to speak any foreign language.

Regards,
John
Title: Re: worm gear cad design
Post by: mrprecise44 on December 27, 2013, 01:02:46 PM
Hi Tony:
We cannot use a non-whole number, even though as you said it will stop on 267, or 266 because each revolution will be either too little or too much. I know in the case of 6 revolutions it doesn't  mean that much, but the original post which is not even the same topic was about cutting an increasing pitch in 24" of travel.

In the case of my explanation of how to make a repeating subroutine, each pass though the loop had to be an exact amount. If the loop was executed multiple times, the error would be accumulative.

If the error in 44.4444 degrees per step was used, each 360 degrees of rotation would be off about a half step for each degree, which way I do not know. The would equate to about 8 steps for each revolution. This is not totally bad depending upon what the end use is, but I tend to think of how to get all the numbers correct.

Now that you have me thinking, we could always lie to the program, and instead of writing the G-code to go say 3600 degrees (10 revolutions), just write 3602 or 3603, and now it all works. ;D

John

Title: Re: worm gear cad design
Post by: Tony Bullard on December 27, 2013, 02:21:15 PM

Thanks John, now I see what you mean in incremental mode.

I also have a very poor resolution rotary axis for pipe coping with plasma but it works quite well in absolute coordinates.

40.2777778 steps per degree.

G01 A .1 gets. .0993
10 = 10.0055
20 = 19.9862
3600 = 3600.0000

Sorry to have gotten off subject.

Tony

Title: Re: worm gear cad design
Post by: mrprecise44 on December 27, 2013, 04:04:43 PM
Tony:
Really not off subject, as the original post was about cutting a variable pitch screw 24" long, and then Khaled wanted info how to cut a 27mm pitch conventional thread, then things evolved into how to set STEPS PER with his gearing, ....... and so it goes. I suggested starting a new topic, but khaled is new to Mach3 and the forum, perhaps did not get my drift.

Never heard anymore about the original post. That was a really interesting problem.

I spent over 20 years doing prototype 4-axis CNC machining including all kinds of cams, so that post really got my attention.

John
Title: Re: worm gear cad design
Post by: Tony Bullard on December 28, 2013, 08:37:33 AM
Andy never said how many turns the worm was to make in the 24” but attached if a file that will generate a ten turn ¼ to ¾ variable pitch in 24”

You could edit the following BASIC code to generate anything you wanted.

Here’s the BASIC code I used to generate the file:

OPEN "VPITCH.TAP" FOR OUTPUT AS #1

X = 0
VPITCH = .5 / 3600 '=.0001333 pitch increased per degree
INC = 23.5 / 3600  '=.0065  pitch increased per degree
CLS

FOR I = 1 TO 3600 STEP 1

X = X + VPITCH + INC

'PRINT #1, "TEST"

PRINT "G01 X "; USING "####.####"; X;
PRINT " A "; I

PRINT #1, "G01 X "; USING "####.####"; X;
PRINT #1, " A "; I

NEXT I

CLOSE #1

Off subject. Is there any new easy way to write and execute code like this? This BASIC is at least 25 years old.

Thanks

Tony
Title: Re: worm gear cad design
Post by: mrprecise44 on December 28, 2013, 03:47:39 PM
Hi Tony:
Basic may be old, but for generating certain kinds of data, like your increasing pitch problem it works fine.  I made cam programs in basic that you could input the starting degrees, ending degrees, starting radius, ending radius, desired angular step size(like .1 degree per step) for different types of cam motion; Cycloidal, Harmonic, Parabolic etc., and it would crank out the data in seconds. The X,Y coordinates in the case of a flat plate cam, or X, A if the cam was machined on a rotary table. This is sort of "brute force" generating every point of motion by actual G-code X, and A steps. You can compile the Basic program, and have a bunch of little programs for each specific machining need. I should add, the code generated is to the "center of the cutter", not the cam surface. Depending on the size of the part, the program could be several thousand lines long. There are formulas in the math books for such motions, as well a curve fitting.

In the case of my increment example earlier in this post, making a loop, using G91 takes only a few lines of code. Mach3 does all the work adding numbers to the constantly changing X axis motion per the loop, and moving the X and A axis in sync accordingly.

It certainly is possible to write a Basic program that would read user input of starting pitch, ending pitch, and total length of shaft, that would do all the math and output a working G-code, G91 incremental program. But, it is most likely a one time job.

Sometimes just thinking about a given machining problem for a while will let you see a simple solution.

Regarding the 24" screw with variable pitch, there were enough "known" values to derive the "unknown" variable (pitch increase per 1 REV).

One place the Basic has been very useful to me, was writing code to calculate the offset from a NON-Linear line "Normal" to the line. There are cases where G41 or G42 get goofy, and will wreck the part, thus being able to create a "brute force" machine pass offset from a line in which there may be X,Y,A all moving together. Then following that line with a G40 (no offset) cutter will be a perfect offset. I am sure there are CAD programs that will do that, but they can run into the multiple thousands of dollars.

At the end of the day, simple is better. However, there is really no easy way. It all takes time; programming, setting up, test cutting in air (sometimes), special cutters, fixtures, setting  Zero's ....etc., and editing you code to fine tune the actual machining.

John
Title: Re: worm gear cad design
Post by: Tony Bullard on December 29, 2013, 07:38:42 AM

Hi John:

I too use BASIC to generate cams with uniform acceleration into a constant velocity curve with deceleration at the end. To deal with the cutter comp I have the program write a script to be read by AutoCAD or BobCad. Once in CAD I fit the spline and offset the curve by half the cutter diameter before generating Gcode.

I am comfortable in BASIC and wasn’t looking for an easier way just a newer way. I’ve tried a C++ consol application but can’t find a way to open and write to a file. The same for VB without doing a windows app which takes me forever. Is there a simple way to do this in C++ or VB?

I’m sure you noticed my Gcode output was completely wrong. It is a constant pitch and has nothing to do with what Andy was looking for. Oops!

Tony

Title: Re: worm gear cad design
Post by: mrprecise44 on December 29, 2013, 03:48:07 PM
Tony:
What matters is the method, or principle in the reasoning. Easy to make a mistake writing examples, in an online format. Sounds like you have gotten into some of the problems of Cam machining, and/or multi-axis prototypes. It's good exercise for the brain. The other side is, most people don't have a clue what your' talking about.

John