Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: greenene on April 25, 2009, 01:47:54 PM

Title: how to go to z without traveling dagonally
Post by: greenene on April 25, 2009, 01:47:54 PM
At times , the tool will hit the fixtures unless the tool travels first to the y coordinate and then to the x coordinate on its way to a fixture. Is there a way to make this happen? Currently, the tool wants to always go the shortest distance, which is diagonally.  I don't have much Z travel on my CNC machine, thus the need to have this option, especially when I have two tools of very dissimilar lengths.
thanks in advance.
tc
Title: Re: how to go to z without traveling dagonally
Post by: Hood on April 25, 2009, 02:55:30 PM
If going up to safe Z first then to X and Y together is no use for your setup then you could write either a short macro or have the VB in a button similar to the Go To Z button.
 You would need something like this in either the button or the macro

code("G0")
Code("G53Z0")
While IsMoving()
Sleep(10)
Wend
Code("G0Y0")
While IsMoving()
Sleep(10)
Wend
Code("G0X0")
While IsMoving()
Sleep(10)
Wend
Code("G0Z0")
While IsMoving
Sleep(10)
Wend


Hood

Title: Re: how to go to z without traveling dagonally
Post by: MachineMaster on April 25, 2009, 03:12:20 PM
Another way would be to just program the moves you want in your G code file.
Title: Re: how to go to z without traveling dagonally
Post by: simpson36 on April 26, 2009, 03:19:22 AM
Thats what I was thinking, too.

G1 X10 Y5     moves diagonally

G1 X10
     Y5           moves first in the X and then in the Y


Title: Re: how to go to z without traveling dagonally
Post by: Hood on April 26, 2009, 03:34:33 AM
Often it is handy to have a button as a lot of the time you may have halted your code and want to go back to zero, you may have just homed and want to quickly go to zero etc etc.
Hood
Title: Re: how to go to z without traveling dagonally
Post by: simpson36 on April 26, 2009, 04:01:29 AM
Good point, Hood!


How difficult would it be to make a button (or command useable in a program) that would cause the A axis to run continuously?

Title: Re: how to go to z without traveling dagonally
Post by: Hood on April 26, 2009, 04:06:28 AM
As far as I know you cant make the A run continuously unless you dont want to have any other axis move.
 You can use Swap Axis and have the spinlde and A swap and thus any S commands would go out to theĀ  A Axis pins, you could then have a VB button that does theĀ  swap axis, or of course a macro called from code to do the same.
Hood
Title: Re: how to go to z without traveling dagonally
Post by: simpson36 on April 26, 2009, 08:43:08 AM
I don't know where this iidea comes from that no other axis can  move while A moves.

G1 X1 A3600 cuts dandy 10tpi threads

G1 X1 X72000 turns at .005 feed

I run the A 'continuously' now by calcing the number of turns I want, feeding that in with a G command and then clearing the A.

Unfortunately, my little power supply kicked the bucket before I could get video on the nifty face off and then thread program I had working.

This already works fine, I'm just looking for a better way. Swapping axis won't work for me becuase I still need the X,Y, and Z active.

The grand scheme here is to make a mini-machining  center . . of sorts. I have it working, it's just down to refinement.

What I would like is

1) simply a way to reset A to machine 0 rather than just work offset 0. SO far this has not been a practical limitation for what I am doing becuse I've gotten machine A into the 10s of millions, so there is enouh headroom for my simply programs.

2) a simple script or brain that would use the stored feedrate variable and use it to convert the A travel to whatever number of degrees reqwuired for rotations to accomplish the feed for the distance commanded and pass that to the G command as an A number.

Example: Mach has stored somewhere the feed per rev of say .004. I want to turn .020 off a workpiece for a distance of .6 inches. All of the data is availble for Mach to calculate the number of turns (in degrees) the A axis needs to move accomplish the cut. It is just going to have to wait until I have time to dig into the scripting and/or brains of Mach unless I can find a willing guru in the mean time to help out. 
Title: Re: how to go to z without traveling dagonally
Post by: Hood on April 26, 2009, 09:05:52 AM
I dont have time to reply at the moment other than to say why would swap axis affect X Y or Z as you would be swapping the spindle for the A, nothing whatsoever to do with X Y and Z, they would still be X Y and Z.

Will reply further later.
Hood
Title: Re: how to go to z without traveling dagonally
Post by: simpson36 on April 26, 2009, 09:19:01 AM
1) Suppose I wanted to have the X and Y moving and the mill spindle spinning an endmill cutting a workpiece held and slowly rotated by the A axis?


2) the A axis is driven by a servo motor. How is that going to resond to being treated as a spindle by mach? That is sot of the whole problem to start with: Mach inability to spin a servo continuously via a single command.


3) The question was how to do what I want to do,  not if I  should want to do it in the first place.  ;)
Title: Re: how to go to z without traveling dagonally
Post by: Hood on April 26, 2009, 09:34:04 AM
Please explain to me how your previous example is what you are asking for. What you said was you wanted the A Axis to run continuously, ie like a spindle. What you have in your example is an A move combined with a X move, when the A and X get to where the code has told them to go what happens?
Well as far as I can see the A stops rotating so in no stretch of the imagination can that be classed as the A axis continually rotating.
Hood
Title: Re: how to go to z without traveling dagonally
Post by: simpson36 on April 26, 2009, 10:10:16 AM
Did they ever have Abbott and Costello on TV or movies in Scotland?  This is just like their famous "Who's on First" routine      LOL!!

I know this is confsusing, but I am at a disadvantage because the conventional terminology does not cover what we are discussing, and I think we are interpreting differently my awkward attempt at selecting the closest reasonable description. 

Please note how I wrote the word thus: 'continuously' meaning this is as close as I can come to the description because of the symantics issue.

Obviously, unless I am just amazed by shiny objects and can't dress myself without help, I have no desire or need to just have the A axis sitting there spining madly away while nothing else is happening . . .  >:D

OK, seriously, in practictice I use feed per rev, so all I need to do is start the spindle and command an x move and Mach calculated the required motion for the axis based on the speed of the spindle. No such facility exists between two axis, that I know of in Mach. 

It seems obvious to this observer that the A axis is not indended to be a 'spindle' and cannot be 'turned on' with Mach calcing the needed axis move to accomplish the feed rate based on the A 'spindle speed'. I'm sorry I can't help but trip over terminology here because there is overlap in definitions, I suppose.

Given that there is no way currently to accomplish the above described scenario, the only practical work-around that I came up with for 'continuous' revolution of the A axis to accomplish the desired cut is to use what is available which is huge azimuth numbers. Fortunately, so far I have not hit the wall with what Mach will put up with in this devious trickery . . .   :P

Feel free to pick a term for "rotation of the A axis in one smooth continuous movement sufficient to accomplish the desired cut using whatever toolls we actually have to do so" . . and I'll be happy to use that term so that we both know "Who's on first" at the same time.



Title: Re: how to go to z without traveling dagonally
Post by: vmax549 on April 26, 2009, 12:34:13 PM
SIMPSON, what Hood is trying to explain IS you cannot do what you want in the conventional sense.  AND he offered you a work around. The only options you have is

Do all the motion using Gcode as you are currently doing or

Use swap axis to make the A axis a spindle temporarily then switch back as needed, BUT you cannot have everthing as you wanted this way. As soon as you swap axis you loose the interpolation of the A axis to xyz and the loose the conventional spindle. IF you wanted to use the convential spindle at the same time it would be a problem as MACH does not support live spindles other than Z and then only as a free spindle not a live spindle .( live spindle can turn as rpm or turn as deg)

Now it would be very simple to create an A drive that could be switched VIA a macro that could run the Axis as a free spindle when needed then be swtiched back as required. You would just have to resync A (home the Axis) as it came back online

You just have to think outtside the box. (;-) TP

Title: Re: how to go to z without traveling dagonally
Post by: SteinarN on April 26, 2009, 12:55:34 PM
I'm a totally newbie to practical machining with cnc machines and G-codes but I nevertheless give a try on a solution

I have a couple suggestion to how to accomplish "continuous" rotation of the A-axis to do some specific machining operation.

First example: Milling a radial slot 360 degrees in 4 pass with gradual plunge of the tool. One final rotation of the work piece with the tool not plunging further.
The last example have only 120 degree final cut due to the plunge taking place in the first 60 degree move

(Tool in place Z0)
G1Z-1A(CW)360
Z-2A360
Z-3A360
Z-4A360
A360
G0Z0

The same operation making a zigzag slot:

(tool in place Z0Y0)
G1Z-1A(CW)60Y10
A60Y0
A60Y10
A60Y0
A60Y10
A60Y0
Z-2A60Y10
A60Y0
A60Y10
A60Y0
A60Y10
A60Y0
Z-3A60Y10
A60Y0
A60Y10
A60Y0
A60Y10
A60Y0
Z-4A60Y10
A60Y0
A60Y10
A60Y0
A60Y10
A60Y0
A60Y10
A60Y0
G0Z0

Edited the G-code. Some lines were duplicated.
Title: Re: how to go to z without traveling dagonally
Post by: SteinarN on April 26, 2009, 02:22:52 PM
I see my previous post probably was an answer to a question nobody have asked......

Back to the continuous run question.

I don't know how fast an indexing board type axis can spin, probably not that fast due to the gear ratio. If so, not well suited to turning small diameter pieces.

But here is what I'm thinking on. Maybe a complicated system.....

Setup:
A turn spindle with a 3-phase motor and an encoder connected to a board receiving position signal from Mach3 and controlling the VFD with say a Hz signal. A Hz signal is probably the most accurate type of signal due to its precisely controlled frequency. Another encoder connected to Mach3 for visual control of the rotational position with high accuracy.

Control:
When requiring continuous rotation for turning, make a button in Mach3 sending a 5V signal via a BOB to the VFD. This VFD input is configured in the VFD to place it in "Continuous rotation mode" regulating the spindle speed from a spindle speed signal from Mach3. That should be easy to configure Mach3 to do.

Shifting back to "Rotational position control" is done by manually by hand or by manually driving the VFD to a position where the encoder in Mach3 is ending at 20, 40, 60 or 80.0000 degrees. A mark on the spindle indicates which of these rotational position is the original "zero" position. When this position is accurately achieved then zero the A position and switch off the button sending the "Continuous rotation mode" signal to the VFD. These two operations should be done by one single button with a VB script.

Edit:
It is also necessary to reset the encoder board controlling the VFD when shifting from Continous rotation to Rotational position control. Or possibly better remove the power from the board when shifting to Continous rotating mode and reconect the power when entering Rotational position mode.

In this way it is possible to run in "Rotational position control", shifting to "Continuous rotation mode" and back to "Rotational position control" without missing steps or position.
Say first milling some keyways, then do some turning and then do some more milling while retaining the exact same rotational position as when milling the first keyways.

The only thing is I don't know if it exists a board with an encoder input and a Hz or PWM output.
Title: Re: how to go to z without traveling dagonally
Post by: Hood on April 26, 2009, 02:57:56 PM
Quote
Given that there is no way currently to accomplish the above described scenario, the only practical work-around that I came up with for 'continuous' revolution of the A axis to accomplish the desired cut is to use what is available which is huge azimuth numbers. Fortunately, so far I have not hit the wall with what Mach will put up with in this devious trickery . . .

Is that all you are wanting? ie a means to stop the axis reaching the magic number?

Hood
Title: Re: how to go to z without traveling dagonally
Post by: MachineMaster on April 26, 2009, 03:10:29 PM
To set the A axis to machine zero all you have to do is put

SetMachZero(3)

in a macro and any time it is called A axis will be set to machine zero.
Title: Re: how to go to z without traveling dagonally
Post by: SteinarN on April 26, 2009, 03:24:48 PM
If there is an additional index slot (one slot per revolution) on the spindle it should be possible to make a macro doing the "homing" to Rotational position mode automatically. It should be possible to make a macro shifting to Continuous rotation mode also.

In this way it should be possible to do some milling with Rotational position control, call a macro in the G-code shifting to Continuous rotation mode for turning and calling a new macro in the G-codes shifting automatically back to Rotational position mode for more milling without loosing the exact rotational position.
Title: Re: how to go to z without traveling dagonally
Post by: SteinarN on April 26, 2009, 03:42:52 PM
One thing I forgot to consider is the max speed of the encoder pulses. For any degree of accuracy it is necessary with a high count encoder, possibly via a gear system to achieve the required resolution, say 3600 pulses per turn. 2000 rpm gives 120,000 pulses per second. I suppose this is way beyond the capabilities to Mach3 and the parallel port?
Title: Re: how to go to z without traveling dagonally
Post by: simpson36 on April 26, 2009, 07:01:17 PM
Wow, awesome replies this time!

I must have finally explained it clearly enough becuse some of you are getting it now. It can be frustating when one askes how to paint their car red and the replies are not how to do it, but that red sucks and you should not want red.


SetMachZero(3) is the magic pill I was looking for. That should allow a program of any length to run.

Someone mentioned I could make a macro to create a 'continuous' run mode. That is exactly what I have been wanting some help with, as I am no Mach guru by any means. Until such time as Mach impliments such a feature, I have to go with work-rounds. I don't know how I can be more clear that swap axis is NOT an acceptable solution for my needs, so I am not going to discuss that any further.


Speed and the mechanics of the 4th axis is not part of the question. That is already worked out, tested and functioning fine. Mach seems to have homing for the A axis, so if that is functional (I have not tried it), then that is a non issue. I would be happy to answer any questions about the mechanical aspects of the existing (currently up for sale) or planned new 4th axis rigs, but I don't want to distract right now from what is at issue, which is the programming.

So, I feel that there is understanding of the objective now. Just down to discussing the best actual macro code. I am very familiar with programming and the concept of scripts, but I am a novice at G-code and Mach3, so that's where I would appreciate some guidance and assistance.

Actualy I now have enough pieces of the puzzle to complete what I need, but I wuld still welcome some more detailed discussion about the specifics and options if anyone feels so inclined.

One specific that was presented was code that repeated A360 over and over, but while that is valid, it would only work in incremental mode and it does not solve the problem of accumulation of machine coords for the A axis. The function SetMachZero(3) would theoretically solve that. That is the key piece of the puzzle.

So, for the scripting gurus out there, what needs to happen is to create a new command that reads the system variable that stores the feedrate in dist per rev. Then take the commanded X move and do the very simple math to calulate the number of degrees the A axis must turn to accomplish that feed rate over that distance and aseemble and pass the appropriate command to Mach.

The machine coord of the A axis could be zeroed after each move or the accumulation monitored by a brain (I think) and reset to zero upon reaching a specific number.

More sophisticated features would be to distinguish between a turning pass and a threading pass and force multiples of 360 for threading passes.









 



Title: Re: how to go to z without traveling dagonally
Post by: MachineMaster on April 26, 2009, 08:28:56 PM
You could set A axis to linear. then set the number of steps for one revolution to one inch. then a command
G01 A36 X1
should give 36 threads per inch. 
Title: Re: how to go to z without traveling dagonally
Post by: SteinarN on April 26, 2009, 11:46:18 PM
I see now that my crappy G-code does nothing but crashing the tool in absolute mode...... Would be an even more time consuming task to write the G-code in absolute mode by hand.
Title: Re: how to go to z without traveling dagonally
Post by: SteinarN on April 26, 2009, 11:50:28 PM
You could set A axis to linear. then set the number of steps for one revolution to one inch. then a command
G01 A36 X1
should give 36 threads per inch. 

I have been thinking the same. The problem is it is probably necessary to stop the spindle two times each pass as the Y changes direction.
Title: Re: how to go to z without traveling dagonally
Post by: MachineMaster on April 27, 2009, 12:08:42 AM
If you are threading, Why is Y changing directions?

As to the tool crashing, can you post something showing the fixture so we can see what you are trying to avoid?
Title: Re: how to go to z without traveling dagonally
Post by: SteinarN on April 27, 2009, 01:23:20 AM
I p
If you are threading, Why is Y changing directions?
Probably meant when X changes direction.
Quote
As to the tool crashing, can you post something showing the fixture so we can see what you are trying to avoid?
Actually I haven't connected to a machine yet.
What I meant is that I had the same position in every "A" move, 60 or 360 degrees. Not any rotational movement after the first 60 or 360 degrees rotation if running in absolute mode in Mach3. After that only -Z moves. That is the crashing of the tool into the work piece
Title: Re: how to go to z without traveling dagonally
Post by: MachineMaster on April 27, 2009, 01:30:30 AM
A axis in linear mode would fix that. You may have to change the rotational settings in general config also.
Title: Re: how to go to z without traveling dagonally
Post by: SteinarN on April 27, 2009, 01:42:29 AM
As I'm a noob in cnc work I think I will keep my mouth shut for a while now......
Title: Re: how to go to z without traveling dagonally
Post by: simpson36 on April 27, 2009, 02:50:48 AM
Picture is worth 1,000 words.

This is the current 4th axis mounted on the mini mill table. (I am building a new one now but it will be similar)

(http://www.thecubestudio.com/pictures/CNCmillConversion/4thAxisOnTableWEB.jpg)

As to the Y axis moving, To make the following part, after turning the barrel down. the 4th axis stops, indexes and the mill head cuts the flats across the Y axis

(http://thecubestudio.com/pictures/HingeCNC/ButtonInterfereAreaWEB.jpg)

Linear mode is an interesting idea, but I need A to be rotary axis.
Title: Re: how to go to z without traveling dagonally
Post by: Hood on April 27, 2009, 03:17:17 AM
First thing to say is I reckon your attitude stinks. You have had many threads over the last few weeks and in everyone of them you have complained that the info you are getting is confusing and varied and you blame everyone for giving you confusing and contradicting info. The reason for that however is, as you have said yourself, that your questions are not asking what you are really wanting, for example it took you many posts in this thread before you actually said what you wanted, if you had said that in your first question the reply you wanted to hear would have been there right away.
 You need to lighten up and realise that people here try to help one another the best they can, no one is out to get you.

Ok if you are still reading  its onto your question, I am not sure if what you are wanting would be the best way as you would need to make sure any motion had halted before you reset your machine coords for the A axis to zero, that would require a bt more complicated code in the macropump so that as soon as the DRO reached your set amount it wouldnt screw things up. It would be much simpler to either just press the Ref A button every now and then (presuming you dont have a home switch on the A) and the machine coords will be reset. You could also write a macro (rather than a macropump) and place it in the macro folder for your profile, if you named it M111.m1s, for example,  then every time you called M111 from code or MDI your macro would be executed. All you would need in that macro is
DoOemButton(25) 

or you could have

SetMachZero(3)

They would both do the same thing as far as machine coords for the A is concerned.


Now as for the linear axis, I am taking my life in my hands here again risking you complaining that I am giving you false info again. However you may be misunderstanding what has been meant and I will give you an example of my coil winder. I have the spindle of the coilwinder set as A Axis, I have it set as a linear axis, ie 1 rev of the motor equates to 1 unit in motor tuning. Mach doesnt know or care whether it is moving along a straight line or actually roatating, all it does is move it one unit when its asked to do so. If I want to do half a revolution I would comman G0A.5, 1/4 rev would be G0A.25, 100th of a Rev would be G0A.01 etc etc.
 Whether that would be of use to you I do not know but just thought I would try to clear it up.

Hood

 
Title: Re: how to go to z without traveling dagonally
Post by: simpson36 on April 27, 2009, 04:12:48 AM
Hood you are entitled to your opinion. I participate primarily in professional forums. Hobby forums tend to be more emotional and all about pals and personalities. The Mach forum is an interesting mix of both. I'm here for information, and to help others if I can, not to find a date. Personalities do not interest me in this venue.

If reply A says "green" and reply B says "No, BLUE!". That is a contradicion, in FACT. It is not me creating the contradiction, yet you seem to imply that I am somehow responsible for it, or that it is OK and how dare I question this. Well, every forum has it's "old guard" who have grown to believe that their opinion is law and they don't like to be challenged.  They are going to answer the quetion they think you SHOULD have asked, not what you actually did ask. It happens. It's a forum, it is what it is.

In any event, as I said earlier, someone has already provided the grand hint I needed to get underway. I've tried out the function and it does exactly what I want. I just need to spend the time now to dig into Mach's scripting capability. I have perused it quickly and I see in there what I need.

"Now as for the linear axis, I am taking my life in my hands here again risking you complaining that I am giving you false info again."

I normally do not find it neccessary to kill someone, being annoying is usually sufficient. No one has yet died from my whining and I do not recall saying that HOOD gave false info, quite the opposite I believe.

In any case, thank for explaining the linear thing. I already knew "what has been meant" by that and I'm sure it works well for some. It just does not interest me as I work in azimuth mostly so it would be an unnecessary conversion back and forth, and would compromise absolute positioning that I need.

 
Title: Re: how to go to z without traveling dagonally
Post by: vmax549 on April 27, 2009, 09:46:09 AM
Heck if that part is all you need to build you can do that with 3 axis. AND I am with HOOD hopefully some of the professionalism at the other PRO sites you are hanging out at will eventially rub off on you.

Poor form to constantly complain that everything is presented wrong when you are the NEWBIE to CNC ??????

Piece of cake, (;-) TP
Title: Re: how to go to z without traveling dagonally
Post by: vmax549 on April 27, 2009, 10:10:26 AM
OK , Did the original question get answered to his satisfaction???  The GOTOZ button is not for everyone. As you know you specific needs may preclude its use.

IF you always have a specific route you can take to safely get to 0,0,0 we can help you write the code to build a NEW button.

Lets us know, (;-) TP
Title: Re: how to go to z without traveling dagonally
Post by: Overloaded on April 27, 2009, 12:30:44 PM
By no means a Pro myself, this is the most professional forum I've seen.
Rarely is a thread hijacked the way this one has been.
Is that the "Pro" part of it ?
 
I hope "greenene" is still with us.
He had a very basic question, and it was his first post.
Hope we didn't scare him off.

btw.....where the heck is Bill C. ?
RC  :) (just a reflection of my general personality.....not interested in a date)
Title: Re: how to go to z without traveling dagonally
Post by: MachineMaster on April 27, 2009, 01:38:27 PM
Bill C. is probably off to a Blacksmith event.

In any case, thank for explaining the linear thing. I already knew "what has been meant" by that and I'm sure it works well for some. It just does not interest me as I work in azimuth mostly so it would be an unnecessary conversion back and forth, and would compromise absolute positioning that I need.


If you need to preserve the 360 deg aspect for resolution, just set the axis to linear by un-checking A axis angular box and set steps per to the current amount divided by 360.
Then G0 A1.0 would give you a 1 degree move. G0 A3600.0 would give 10 revolutions. No calculations.

I came into this thread late and didn't realize it had been Hi-Jacked. If you need more help, start a new thread.
Title: Re: how to go to z without traveling dagonally
Post by: MachineMaster on April 27, 2009, 01:48:32 PM
OK, I just re read the whole thread and realized that while I was answering the questions, I was not paying any attention to who was posting.

As to the part, unless the flats are already on the part and you just need to clean them up, any where the A axis stops should be fine for the first cut then rotate 1/2 turn for the second cut.
Title: Re: how to go to z without traveling dagonally
Post by: simpson36 on April 27, 2009, 04:18:42 PM
No problemo, guys. I can take a little heat.

This thread really was hijacked badly. On the other hand, notice the number of reads and that tells a story also.

"Heck if that part is all you need to build you can do that with 3 axis"  Brilliant deduction . . how do you suppose I made the one in the photo? I could make if from a block of steel and a file if I had the time . .  that's not the point.

Anyway, fellas, no new thread needed, I got all the info I needed, and today I wrote and tested the macro I wanted to automatically generate the G-code and pass it to Mach to make the threading or turing passes. Works great!

In spite my complaining and some of you guys sulking, in the end there was success and I do appreciate all of the time spent on my issue. I am a very happy camper . . .  except maybe for the sore butt . . lots of teeth marks down there . . . .  ::)