Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: Tony Bullard on January 08, 2011, 11:07:55 AM

Title: New program for pipe coping
Post by: Tony Bullard on January 08, 2011, 11:07:55 AM
I am writing a VB stand alone program to write g code to cope or notch pipes with a rotary axis plasma machine. I've attached a file (I think) to explain how it works. I don't have a machine up and running yet for this application and would like to try it on some Ginny pigs like you guys-- LOL. If you would send me the parameters for your jobs I will send you a g code file to try. After reading the attachment I'd appreciate any suggestions or comments on how I can make this better. Once I get it working I'd like to make a Mach wizard out of it.

Thanks,
Tony
Title: Re: New program for pipe coping
Post by: BR549 on January 08, 2011, 11:50:04 AM
 One problem you WILL run into is making sure that mach will sync up the feedrate based on the radius of the tube you are cutting. IF not you have a mess. SO in your code MAKE SURE there is a Macro call that updates the Radius correction DRO.

ALSO make sure the operator UNDERSTANDS that mach must be setup for 4th axis roatations in the proper plane for the toolpath AND that radius feedrate corrections are turned on.

There are already programs that can output DXF or Gcode for tube coping. NOT to cool your jets but to let you know(;-)

Waiting to see what ya got, (;-)TP
Title: Re: New program for pipe coping
Post by: Tony Bullard on January 08, 2011, 12:51:31 PM
Thanks TP,

All really good points. Writing the macro and calling it would be easy but I'm not sure from a stand alone program how I'd get the macro into the machines correct profile macro directory. I guess if I had it as a plug in or wizard that might be easier but right now I wouldn't have the vaguest idea of how to write one.

I guess if there's programs out there that every-ones happy with I might as well leave it alone.

Thanks again, Tony
Title: Re: New program for pipe coping
Post by: BR549 on January 08, 2011, 01:09:48 PM
HECK give it a whirl, we can always work out the particulars.

Like the old addage says , THE operator MUST be responcible for something(;-)

Let them place the macro in the proper spot(;-) IF they want to use it I BET they can figure out where to place the macro(;-)

Setting up mach to do 4th rotations is just a simple setup process they can figure it out

Have it do the angle cope AND a hole placement on the base tube. Those are the 2 normal processes done. The hole placement being the most USED.

(;-) TP
Title: Re: New program for pipe coping
Post by: DaOne on January 08, 2011, 01:21:46 PM
Can also just substitute Y axis for A so you can just unroll it on the tube. this will allow much cheaper cam software to work with this setup. 4th axis jumps up in price fast.
Title: Re: New program for pipe coping
Post by: BR549 on January 08, 2011, 01:49:41 PM
One problem with the wrapper approach is a hole that is wrapped and a hole that is projected are2 different dawgs as far as hole shape is concerned.

When plasma cutting on a tube the shape must represent a projected hole onto the tube being cut. It ends up oval shaped if you do it as a wrap.

If you look in the Mach tool box there is a simple coping routine that is driven with Gcode and a programable front end. It only does simple on axis angles not offsets.

Still working on the math to get perfect holes in a tube(;-).

I am sure IF you build it they will use it. That is one tool that is lacking in most DIY Plasma users toolbox.

Just a thought(;-) TP

Title: Re: New program for pipe coping
Post by: Tony Bullard on January 08, 2011, 02:43:50 PM
TP,

I like this part "THE operator MUST be responcible for something(;-)" LOL
If they're going to file the macro they might just as well set the Radius correction DRO. instead.

"Still working on the math to get perfect holes in a tube(;-)."-----  Me too! I know I have the math perfect for the cope.----- I think.

DaOne, "Can also just substitute Y axis for A so you can just unroll it on the tube." The torch has to be perpendicular to the tube axis so either the tube or the whole torch has to rotate--- right?

Attached is the same sample code as the rotary but it is for wrap around. notice the X moves PI x D.

Title: Re: New program for pipe coping
Post by: DaOne on January 08, 2011, 02:53:32 PM
Would sure be a nice addition to the end of our plasma table. Right now we use a tubing notcher to fish-mouth tubing before we run it on the mandrel bender. It works but would be quite a bit faster on a plasma cutter.  Most everything is tig welded so the better the fit the better the weld. The torch on our table come past the end about a foot so I was thinking about using a big chuck with a servo a while back. Just haven't gotten around to it yet. With us almost everything is a common angle and 2 1/2 is basically 98% of the work. If you guys are interested I could right a wizard to spit out common angles for common tubing sizes if someone could generate the g-code for it? Math involved to create it in the fly is beyond me.
Title: Re: New program for pipe coping
Post by: BR549 on January 08, 2011, 02:57:41 PM
It is one thing to just place a macro to drive the dro update as that is a ONE TIME thing(;-)

I like the auto update of the DRO as it takes one more step away from the operator to have to remember. IF you get it wrong the displayed toolpath will be distorted as well.  At least it does here(;-)

DOn't give the operator too much control he will think he actually runs it. (;-)

(;-) TP
Title: Re: New program for pipe coping
Post by: BR549 on January 08, 2011, 03:14:40 PM
Look at the simple coping routine in the MACH TOOL BOX in the download section. It works here for simple things.
There are 4 inputs it asks for the coped tube diameter the Base tube Diameter  the Tube thicknes and the angle of the cope.

In setting up a 4th for tube cutting consider using drive rollers to rotate the tube and run the A axis as a linear drive. One you set the steps per inch then it is just like runing X/Y  no polar conversions needed. The tube surface speed will always be the same as the surface speed of the roller driving it(;-).

Just a thought, (;-)TP

Title: Re: New program for pipe coping
Post by: Tony Bullard on January 08, 2011, 03:21:26 PM
TP, You make me smile. I like it!

Tony
Title: Re: New program for pipe coping
Post by: Tony Bullard on January 08, 2011, 04:10:40 PM
TP
with your roller drive idea you could use my X/Y linear output. If you don't maintain good traction you get a botched job. I can't seem to find the "Mach tool box " you mentioned.

DaOne, "I could right a wizard to spit out common angles ". How do ya write the wizard? That's what I need to find out.

Tony
Title: Re: New program for pipe coping
Post by: DaOne on January 08, 2011, 04:23:07 PM
Tony,

I wizard is done the same way as a screenset. I use Mach Screen. It can be found here...

http://www.kd-dietz.com/klausphp/images/eng/machscreen/beschreibung/machscreen_doc.htm


It will require VB codding ability and a bit of knowledge of how mach works with VB.


This is the Mach Toolbox section....


http://www.machsupport.com/forum/index.php/board,75.0.html
Title: Re: New program for pipe coping
Post by: DaOne on January 08, 2011, 04:27:01 PM
I never saw TPs post...

http://www.machsupport.com/forum/index.php/topic,16411.0.html

If this works correctly I can build a front end to build it into a wizard form. Is this working correctly?
Title: Re: New program for pipe coping
Post by: BR549 on January 08, 2011, 05:53:11 PM
The things you have to do is

Enable A axis rotations in tool path
Rotate as Y axis
Set the Feedrate to radius in settings to match the radius of the tube

The rest seems to work correctly here.   Use it if you can, throw rocks at it if you can't(;-)

(;-) TP
Title: Re: New program for pipe coping
Post by: DaOne on January 08, 2011, 07:16:55 PM
Maybe someone can take a look at this code...

Code: [Select]
Sub Main()

'(CNC A axis Plasma TUBE Coping routine)
'(Math derivative by Dan Hopper Copyright 2006)

'WIZARD BY WES TREIHAFT

CutTubeD = GetOEMDRO (1006)
UncutTubeD = GetOEMDRO (1016)
TubeThickness = GetOEMDRO (1012)
JointANGLE = GetOEMDRO (1017)
ASTEPDEG = GetOEMDRO (1018)

RO = CutTubeD / 2     
RU = UncutTubeD / 2     
RI = RO - TubeThickness
AF = JointANGLE           
ID = CutTubeD - TubeThickness * 2                   
ASTEPDEG = 2             


SetTicker 20, ""





OpenTeachFile "PIPENOTCHER.tap"
 
Code "%"
Code "G0 G40 G54 G90 G49 G17 G50 G64 G91.1 G94"
Code "G0 A0.000 x0.000 Z1.000 F500"
Code "Z0.0"
Code "M98 P01 L180"
Code "G0  A0.0 X0.0 Z1.0"
Code "M30"
Code "o01"
Code "G1  A" & ASTEPDEG & " X" & (Sqr (RU * 2 - ((RI * Sin (ID)) *2)) /  Sin(AF) -  Tan (90-AF) * RI * Cos(ID))
ID =(ID+2)
ASTEPDEG =(ASTEPDEG +2)
Code "M99"
Code "%"

CloseTeachFile

Call LoadTeachFile()
End Sub

Main


Here is what I am converting...

Code: [Select]
(CNC A axis Plasma TUBE Coping routine)
(Math derivative by Dan Hopper Copyright 2006)
#100= 1.250       (CutTube Diameter)
#101= 1.250       (Uncut Tube Diameter)
#103= .095         ( Tube Thickness )
#104= 45             (Joint ANGLE)
#200 = [#100 / 2]         (RO)
#201 = [#101 / 2]         (RU)
#202 = [#200 - #103]  (RI)
#203 = #104                (AF)
#204 = 0                       (ID)
#300= 2                        (A step in deg)
G0 G40 G54 G90 G49 G17 G50 G64 G91.1 G94
G0 A0.000 x0.000 Z1.000 F500
Z0.000
M98 P01 L180
G0  A0.000 X0.000 Z1.000
M30
o01
G1  A#300 X  [sqrt [#201 **2 - [ [#202 * sin [#204]] **2]] /  sin[#203] -  tan [90-#203] * #202 * cos[#204]]
#204=[#204+2]
#300=[#300+2]
m99
%

I don't understand the "**"

 I am getting :cannot divide by zero when it comes to the line with the math.

Title: Re: New program for pipe coping
Post by: BR549 on January 08, 2011, 07:22:32 PM
Squared      ^2     the Gcode version is **2
Title: Re: New program for pipe coping
Post by: DaOne on January 08, 2011, 07:27:15 PM
makes sense :)
Title: Re: New program for pipe coping
Post by: BR549 on January 08, 2011, 07:32:20 PM
IF you have not filled the variables FIRST you will get a divide by zero (;-) Once the varialbe are loaded then it will run. The same thing happens in Gcode(;-)

(;-) TP
Title: Re: New program for pipe coping
Post by: DaOne on January 08, 2011, 07:34:50 PM
Variables are filled... something must be wrong still getting divide by 0
Title: Re: New program for pipe coping
Post by: DaOne on January 08, 2011, 07:37:00 PM
ok.. think I got it
Title: Re: New program for pipe coping
Post by: DaOne on January 08, 2011, 07:54:17 PM
Ok it dosnt look like its working right for me.. The code outputs point to point so maybe someone could look at it and see where I screwed up..
Title: Re: New program for pipe coping
Post by: BR549 on January 08, 2011, 08:00:05 PM
This is what a 2" x2" at 45 deg should look like in the toolpath
Title: Re: New program for pipe coping
Post by: BR549 on January 08, 2011, 08:03:49 PM
From your earlier code it looke like you were trying to solve the equations from the VB side (;-) You need to let the Gcode side solve the equation as part of the evolution of the SUBprogram or all you will get is a straight line(;-)
Title: Re: New program for pipe coping
Post by: DaOne on January 08, 2011, 08:10:31 PM
Sounds like you got a good understanding of what wrong. Care to take a crack at fixing it? I have yet to play with G-code macros in mach so that is a shot in the dark for me.
Title: Re: New program for pipe coping
Post by: DaOne on January 08, 2011, 08:19:58 PM
I can make it loop and pull the math out of the gcode but I need to define when to exit the loop and I dont know what I am looking for.
Title: Re: New program for pipe coping
Post by: BR549 on January 08, 2011, 08:22:43 PM
OK I will take a crack at it. "You" are real close just set up the Sub like it is in the example then let VB plug in the VARS. Let VB convert YOUR variables into Gcode #vars  The Gcode will pull the # vars over internally(;-)

Want to take one more crack at it??

(;-) TP

Title: Re: New program for pipe coping
Post by: DaOne on January 08, 2011, 08:35:49 PM
Naw man go for it and I will look at how you got there... My brain hurts from cad all day. One of the perks of owning your own biz... on weekends.. U get to work.
Title: Re: New program for pipe coping
Post by: BR549 on January 08, 2011, 08:40:43 PM
YEP that is where the term 24/7 came from . Don't believe it ? Start your own business (;-)

(;-) TP
Title: Re: New program for pipe coping
Post by: BR549 on January 08, 2011, 09:07:36 PM
Here ya go give this a whirl. This is your post code button code.


Sub Main()

'(CNC A axis Plasma TUBE Coping routine)
'(Math derivative by Dan Hopper Copyright 2006)

'WIZARD BY WES TREIHAFT

CutTubeD = GetOEMDRO (1366)
UncutTubeD = GetOEMDRO (1367)
TubeThickness = GetOEMDRO (1368)
JointANGLE = GetOEMDRO (1369)
'ASTEPDEG = GetOEMDRO (1370)

RO = (CutTubeD / 2)        '  (RO)
RU = (UncutTubeD / 2)        '  (RU)
RI = (RO - TubeThickness)    '  (RI)
AF = JointANGLE              '  (AF)
ID = 0                     '  (ID)
ASTEPDEG = 2 '  (A step in deg)


SetTicker 20, ""

Setvar(200, RO)
Setvar(201,RU)
SetVar(202, RI)
SeTvAR(203, AF)
SetVar(204, AstepDeg)



OpenTeachFile "PIPENOTCHER.tap"
 
Code "%"
Code "G0 G40 G54 G90 G49 G17 G50 G64 G91.1 G94"
Code "G0 A0.000 x0.000 Z1.000 F500"
Code "Z0.0"
Code "M98 P01 L180"
Code "G0  A0.0 X0.0 Z1.0"
Code "M30"
Code "o01"
Code"G1  A#300 X  [sqrt [#201 **2 - [ [#202 * sin [#204]] **2]] /  sin[#203] -  tan [90-#203] * #202 * cos[#204]]"
Code"#204=[#204+2]"
Code"#300=[#300+2]"
Code "M99"
Code "%"

Setdro(25,RU)

CloseTeachFile
Call LoadTeachFile()
End Sub

Main

 

Title: Re: New program for pipe coping
Post by: Tony Bullard on January 09, 2011, 07:57:22 AM
TP,
I'm just back looking at this stuff. In your "(CNC A axis Plasma TUBE Coping routine)" am I correct that when you finally run "PIPENOTCHER.tap" that all the math is done as the machine is cutting? If so there would be no look ahead and wouldn't be in CV mode. Right? Wouldn't the motion be jerky and the torch dive a lot? I still haven't had my second cup of coffee.

Tony


Title: Re: New program for pipe coping
Post by: BR549 on January 09, 2011, 12:21:53 PM
ONE thing to remember with mach IF you can see it in the toolpath on load then mach can run it in the buffer with look ahead active. Mach runs and handle GCODE VERYVERY well. It can calulated advanced subs AND parameteric CODE if the formulas are progressive.  IF the code has to wait to gather info to do the calculation then you may not see a complete TOOLPATH on load.  Even then MACH does a great job in queing up the code very fast(;-) There have only been a few programs that mach struggled with that I have seen.

Runs fine here on the test computer.

You will note in the code that the radius compDRO gets updated (;) that way everthing looks and runs ok.

I have the code to do a hole in a tube but at present I can only do a 90 deg entry,still working on the angle entry.  I can visulise what it needs to do BUT I always get lost in the logic when I start working on it. It really is just a mirror of the coping code. BUT???(;-)

IF WES wants to update his WIZARD to do the straight in holes as well I can supply the code


(;-) TP
Title: Re: New program for pipe coping
Post by: Tony Bullard on January 09, 2011, 12:48:56 PM
I'm working on the hole, "saddle", also. It's looking good. Hope to have it done today.
Keep up the good work.
Tony
Title: Re: New program for pipe coping
Post by: BR549 on January 09, 2011, 01:30:27 PM
YOUS guys make me happy that you are working on cool stuff for users of Mach.

(;-) TP
Title: Re: New program for pipe coping
Post by: BR549 on January 09, 2011, 01:45:48 PM
So far so good  Good circle from top veiw and good saddle from side veiw.



Title: Re: New program for pipe coping
Post by: Ya-Nvr-No on January 09, 2011, 02:29:38 PM
Nice to see,... Smart Thinkers and Doers at work, very creative, I like it.
Good Job

Seeing I know very little about plasma cutting, Is the Z axis being driven then it floats to cut smoothly as it changes direction up and down?
I did not know you can plasma cut other than in X and Y.
Cool
Title: Re: New program for pipe coping
Post by: BR549 on January 09, 2011, 02:52:15 PM
With a floating torch head you lower the Z until it touches the material then it trips a switch and MAch reset that point as zero. THen after the arc is struck mach controls Z based on the arc voltage, raising and lower it to keep the arc voltage at the present level. IF you have stop and go situations when running it causes the thc to dive into the material trying to chase the arc voltage. SOme units have anti dive to prevent it BUT it still will lower to the set limit.

SO it is very important to produce smooth movement(;-)

NOW that IS if you have a THC. (Torch height controller)
Title: Re: New program for pipe coping
Post by: Tony Bullard on January 09, 2011, 03:14:49 PM
I think I have it.
TP, Will you see what these files look like in the tool path window ? I haven't got used to that thing yet. I've got to tune up the text formatting a little but I thins gana go. Your 90* saddle looks good!

Tony
Title: Re: New program for pipe coping
Post by: BR549 on January 09, 2011, 04:03:48 PM
The TAP files have a funny set of hidden charectors at the start of the file, I can't delelte them so mach errors out on load.
The text files I had to enclose the comment then mach loaded ok.

When you add comments you need to enclose them like  ( branch pipe 3.00 )

The 37deg saddle looks GOOD

the 90deg does not complete the shape it runs as a single arced line

Can you do a 4" main and 2" branch at 45 deg an O offset. That way I can calculate the sizes to make sure it cuts to size.





Title: Re: New program for pipe coping
Post by: DaOne on January 09, 2011, 11:55:58 PM
TP,

Here is the wizard with your code... still think its broken... let me know what you think.
Title: Re: New program for pipe coping
Post by: alenz on January 10, 2011, 06:10:03 AM
TP

I only have a small tabletop mill, (no plasma) but I read and study your posts for the informative content.  An observation or two re. your Tube Coping program and a question if you don’t mind?

On the first run it went into an endless loop on loading. Fix, check ‘Ignore M calls while loading’ in Gen Config. Not   sure exactly why but it was relataed to the Regen Toolpath, OEMButton 160 statement.

Next the A-axes Radius DRO didn’t update. Fix, add ‘SetOEMDRO(825, GetVar(100)/2)’ to Macro M1222. I probably just missed an update to your code postings.

Lastly, how do you get the program to pause after the macro call? It seems it has to do again with the Regen Toolpath statement. This would be a nice feature if I understood how it worked?

Thanks for posting your code,
I'm still trying to learn,
al
Title: Re: New program for pipe coping
Post by: Tony Bullard on January 10, 2011, 09:20:06 AM
Thanks TP. I see a few bugs in my “saddle” program. I’ll get back.  Tony

"The TAP files have a funny set of hidden charectors at the start of the file, I can't delelte them so mach errors out on load."
The text files I had to enclose the comment then mach loaded ok.
I may have edited them in Word instead of Note Pad

"When you add comments you need to enclose them like  ( branch pipe 3.00 )"
Thanks, I forgot about that. I think % also works

The 37deg saddle looks GOOD

"the 90deg does not complete the shape it runs as a single arced line"
It looks like it runs on a single arc and then back on itself. Watch the A and Y DROs. They seem to be doing the job right.

Can you do a 4" main and 2" branch at 45 deg an O offset. That way I can calculate the sizes to make sure it cuts to size.

Title: Re: New program for pipe coping
Post by: Tony Bullard on January 10, 2011, 11:02:54 AM
TP, I think I got the bugs out. These files have a 0 well thickness to make it easier for you to check the math. I appreciate you help.
Thanks, Tony
Title: Re: New program for pipe coping
Post by: Tony Bullard on January 10, 2011, 11:25:27 AM
Don't bother, I still have math problems.

Oops! not really.
Title: Re: New program for pipe coping
Post by: BR549 on January 10, 2011, 12:24:16 PM
Tony they look ok from here(;-)  One thought though, can you start the cut from the other end of the saddle on the branch cut? That way it is easier to set up on the edge of the tube AND when you cut at the finish the scrap will fall straight down.

WES It looks good from here (;-)  Are you having trouble veiwing it it the toolpath??
Title: Re: New program for pipe coping
Post by: Tony Bullard on January 10, 2011, 02:41:04 PM
Geez TP, easy on me. My brain is still somkin. I guess the easiest way to do that would be to zero at the end and have the first Y move come back (the max Y travel)+ kerf. I'll work on it.

Thanks again. Istill have a lot of tunin up to do.

Tony
Title: Re: New program for pipe coping
Post by: BR549 on January 10, 2011, 06:04:09 PM
Tony not a biggy on the start point just an observation from cutting (;-)  You may want to make an option for a left hand or righthand setup code wise. With Some machines the A mounts forward some mount aft.

Just a thought, (;-) TP
Title: Re: New program for pipe coping
Post by: Tony Bullard on January 11, 2011, 07:54:15 AM
Another good point TP, thanks. I believe I've set the code up for rotary axis direction as follows:

Looking at the "drop" end of the tube, the end that you aren't going to use, a positive rotation is clockwise, negative is counterclockwise. So in Mach you'd have to set up your rotary axis rotation accordingly.

Hmm,,, I'll have to check my saddle code though. I'm still trying to get rid of that "bad character" in my output files. It's a hidden character that Windows programs use to identify which type of text file it is---- Plain text, Rich text, HTML etc. NotePad and others see and understand what that character means and loads without displaying it. Today I've got to put my head in Visual Basic 2008 to see what I can do about it.

Tony