PDA

View Full Version : G code question



myxpykalix
05-28-2008, 11:26 PM
I have asked whether SB runs Gcode before and gotten an answer on that and researching the wiki and past posts it gives me the commands that SB recognizes however i can't figure out what file format to save the file in from say Mach3 that SB can read. Is it .tap, .nc, .ncc, or .txt?

Call-Tech
05-28-2008, 11:38 PM
I'm not sure about the Gcode, but the shopbot file is a text file with an .sbp file extension.

stevem
05-29-2008, 01:09 AM
Mach3 controls the machine. You would send Gcode to Mach. You don't send code from Mach to SB control software.
Mach will work with .nc or .txt

joe
05-29-2008, 08:56 AM
Jack,

I'm running G code with Mach3. It's so easy and offers many functions SBers would adore. Light years apart. But that's not going to happen.

They come from different languages. Too bad.

richards
05-29-2008, 09:29 AM
You can run G-code directly or you can convert the G-code file to an SBP file.

If you want to convert a G-code file, click on the File menu, select "file Conversions", scroll the "Types of File" box and either select "All Files (*.*)", or all files or "GCode Files (*.gcc, *.tap, *.nc, *.agc)".

When you click on the FP command to select a file, scroll the "Types of File" box and either select "All Files (*.*)", or all files or "GCode Files (*.gcc, *.tap, *.nc, *.agc)".

I'm running version 3.6.1 beta06 with a V201 controller card from Shopbot on my test bench. If you're using an old version of SB3, you may need to update your software. (By the way, that controller card is great. For the developer/experimenter, it allows you to get a new design up and running in the shortest possible time.)

joe
05-29-2008, 10:41 AM
Mike do yourself a favor, go on line and see how neat Mach takes a G-code, TAP, and gives a visual of everyting the machine is doing.
It allows for spindle speed changes, gantry speed changes, previews of the cuts, start and stops, bit changes, and many more functions, without loosing a step and continuing on to the end of the process.

If I didn't have this program, my work would suffer greatly. It's like comparing a Model T to a HumVee.

richards
05-29-2008, 09:45 PM
Joe,
I use both SB3 and Mach3. SB3 runs my PRT-Alpha and Mach3 runs other things. Both have their place. Personally, I've found that SB3 is easier to extend with its GOTO and GOSUB statements. It allows the use of variables and can read variables from a file.

On the other hand, Mach3 is close to the industry standard for G-Code. Most G-Code commands work.

To me, they're both tools. Just like any tool, sometimes one tool works better than another, depending on your need.

joe
05-29-2008, 10:43 PM
Richard,

You can understand why Mach 3 has become so popular when you can see all the command option on the screen and follow the router movement in real time. Also being able to zoom in to see each part being cut. There's so many functions like setting up to seven home positions. Like you say this has become the industry standard and it only costs $165.00. What a bargain!

Joe
www.normansignco.com (http://www.normansignco.com)

knight_toolworks
05-30-2008, 12:15 PM
anyone have the settings for a prt alpha? I wanted to play with it but I don't want to spend too much time fumbling getting it working.

myxpykalix
06-03-2008, 03:34 AM
ok this might be elementary to some of you guys but i'm confused. I made a file from a mach3 wizard but it only allows me to save it as a .txt file.
In the shopbot controls the F/C command only allows me to convert gcc, nc, tap, agc. How do i convert a txt file to a sbp?
It won't allow me to just call it up and run a txt file. It's not as simple as just changing the file extension is it? (Edit) I did just that and got it to run in the preview.

dana_swift
06-03-2008, 10:45 AM
Jack- "txt" just means it contains text. The question is what kind of text? GCode files are text files. "sbp" is also a text file, so converting one to the other requires knowing how the text represents the part, then using a program that can make the appropriate conversion.

First thing to do is find out what kind of text it is: double click on the file and look at it with notepad (or another text viewer). What is in there? It may be daunting at first, but there is no magic going on, after thinking about it for a minute or two you might be able to answer your own question.

How about post the txt file here so some of us can look at it? I look at the internal structure of files all the time.

If the file contains shopbot commands then all that is involved is changing the extension. Or just selecting the txt file from SB3 as the cut file. If there is anything wrong with the structure of the file SB3 will let you know.

Hope that helps-

D

garyb
06-03-2008, 12:08 PM
They are all txt files just change the extension as you have. But that is not going to be your only problem, you didn't say which wizard you used to create the g-code so you may find you need to manually edit it as Shopbot does not reconize all the g-code commands that the wizards will drop in the file.
See the Shopbot Wiki for the supported g-code

khaos
06-03-2008, 12:44 PM
Jack, this (my) post is just for a laugh and will not get you closer to your answer.

Dana, it would almost certainly NOT look like this:
call forHelp
mov stdin,eax
add eax,SIZEOF(FILE)
mov stdout,eax
add eax,SIZEOF(FILE)
mov stderr,eax
invoke crt_fprintf,stdout,ADDR msg,stdout
invoke ExitProcess,0

or this:

.entrypoint
.maxstack 1
ldstr "Loading my goovy file"
call void [mscorlib]Shopbot.Control::CutMe(class System.sbGCode)
ret


8359

dana_swift
06-03-2008, 02:21 PM
Joe, it seems you are an assembler sort of guy! I only do that when I have to. If it looks like that kind of text its outside the scope of this forum..

I doubt it looks like that, i suspect it is G code, or a DXF variant, but without looking- no way to tell..

D

joe
06-04-2008, 10:23 AM
I like to use my CNC to make money

joe
06-04-2008, 10:40 AM
I like to use my CNC to make money

bcammack
06-04-2008, 02:51 PM
Joe,

What concerns me is that I actually understood those snippets of assembly language. Brrrrr.... I don't miss my days in low-level languages, although you can detonate a running operating system in many interesting and spectacular ways with it.

khaos
06-04-2008, 06:58 PM
Hee Hee. The second snippet is a intermediate level .NET language called IL. Its just a new face on an old idea.

I develope software for a living and I just needed to make a smile as I know Dana is or was in another life a developer as well .

The good news is that Jack got the real purpose of this thread working!!
8360

dana_swift
06-04-2008, 08:46 PM
Joe, I got a good laugh out of it! I still develop commercial software under contract, but most of my software development work now revolves around the shopbot.

This last weekend I put some polish on a truetype reader so I can use my own engraving algorithms on my parts. Its getting interesting, probably one or two more evenings of tinkering and it will be making cuts.

I have looked into IL, but as long as the C# compiler generates solid code I haven't had any reason to delve into it. The only time I go to the low level is for real-time kernels, and those have been in the can for so many years they rarely need changes.

I still would love to see what was in the txt file that got this sub-thread going.

D

garyb
06-05-2008, 12:42 AM
Here you go Dana, this is a test file to run 3 circles. The last line in this file (m47)is just to repeat normally would have an M30 to end file & rewind.

(Circles)
G90
G20
G49
G0Z0.7500
M3 S12500
G0 X6.6833 Y15.7800 Z0.7500
G1 Z-0.2500 F50
G2 X8.3855 Y22.3347 I13.3957 J0.0197 F360
G2 X9.8585 Y24.4603 I11.7653 J-6.5799
G2 X12.7482 Y27.0234 I10.3240 J-8.7294
G2 X19.9596 Y29.2290 I7.3657 J-11.1906
G2 X26.6865 Y27.5279 I0.1880 J-13.4078
G2 X28.8121 Y26.0549 I-6.5799 J-11.7653
G2 X31.3752 Y23.1652 I-8.7294 J-10.3240
G2 X33.5775 Y16.1271 I-11.1865 J-7.3641
G2 X32.4599 Y10.3946 I-13.4245 J-0.3580
G2 X31.5493 Y8.6680 I-12.2872 J5.3773
G2 X29.7556 Y6.3849 I-11.4557 J7.1540
G2 X27.2441 Y4.3633 I-9.6662 J9.4376
G2 X20.6516 Y2.3413 I-7.0895 J11.3565
G2 X15.0481 Y3.3258 I-0.5280 J13.4337
G2 X14.1545 Y3.7298 I5.0606 J12.3833
G2 X12.2150 Y4.9079 I5.9865 J12.0417
G2 X9.0713 Y8.1281 I7.9695 J10.9248
G2 X6.6833 Y15.7800 I11.0143 J7.6359
G0 Z0.7500
G0 X33.6111 Y32.4308
G1 Z-0.2500 F50
G1 X33.6111 Y32.4324 F360
G2 X33.6239 Y32.9356 I9.9394 J-0.0003
G2 X34.3792 Y36.2374 I9.7245 J-0.4873
G2 X37.3522 Y40.1254 I9.0321 J-3.8258
G2 X41.4217 Y42.0140 I6.0257 J-7.6555
G2 X43.8960 Y42.1998 I1.9694 J-9.6595
G2 X47.1978 Y41.4444 I-0.4873 J-9.7245
G2 X51.0858 Y38.4715 I-3.8258 J-9.0321
G2 X52.9743 Y34.4019 I-7.6555 J-6.0257
G2 X53.1601 Y31.9276 I-9.6595 J-1.9694
G2 X52.4048 Y28.6258 I-9.7245 J0.4873
G2 X49.6148 Y24.8852 I-9.0304 J3.8247
G2 X45.6023 Y22.9016 I-6.2115 J7.5143
G2 X43.1388 Y22.6539 I-2.2069 J9.5787
G2 X40.0305 Y23.2437 I0.2402 J9.7518
G2 X36.3130 Y25.6823 I3.3706 J9.1911
G2 X34.0513 Y29.5217 I7.0683 J6.7495
G2 X33.6111 Y32.4308 I9.3407 J2.9013
G0 Z0.7500
G0 X55.7549 Y20.6019
G1 Z-0.2500 F50
G2 X57.8869 Y27.8958 I13.4754 J0.0197 F360
G2 X59.7182 Y30.1702 I11.4403 J-7.3372
G2 X61.9928 Y32.0012 I9.6105 J-9.6100
G2 X68.9362 Y34.1280 I7.2712 J-11.3412
G2 X75.0027 Y32.8682 I0.3608 J-13.4990
G2 X76.5777 Y32.0004 I-5.7137 J-12.2335
G2 X78.8521 Y30.1691 I-7.3372 J-11.4403
G2 X80.6831 Y27.8945 I-9.6100 J-9.6105
G2 X82.8099 Y20.9511 I-11.3412 J-7.2712
G2 X81.5501 Y14.8846 I-13.4990 J-0.3608
G2 X80.6823 Y13.3096 I-12.2335 J5.7137
G2 X78.8510 Y11.0352 I-11.4403 J7.3372
G2 X76.5764 Y9.2042 I-9.6105 J9.6100
G2 X69.6330 Y7.0774 I-7.2712 J11.3412
G2 X63.7159 Y8.2685 I-0.3604 J13.5017
G2 X62.5494 Y8.8660 I5.5559 J12.2857
G2 X60.6778 Y10.1630 I6.7618 J11.7553
G2 X58.0652 Y13.0387 I8.6585 J10.4913
G2 X55.7549 Y20.6019 I11.1712 J7.5469
G0 Z0.7500
G0 X0.0000 Y0.0000
G0Z0.7500
G0X0.0000Y0.0000
M5
M47

myxpykalix
06-05-2008, 04:07 AM
Ok you Gcode guru's here is my problem. This file was created using mach3. It is a simple 24" long spiral, 4 flutes, 3" diameter with this resulting code:
-----------------------------
start point 2.0"
length of cut in X 24"
part diameter 3"
number of flutes 4

rotational flute 90 degrees

drive letter B

rapid clearance gap .25
max cutting depth .25
-------------------------------

G90
G1 Z1.75 F75.0
G1 X0.0 Y0.0 B0.0 F75.0
G1 X2.0 Y0.0 F75.0
M3
G91
G1 Z-0.25 F25.0
G1 Z-0.125 F25.0
G1 X-24 B90.0 F25.0
G1 Z-0.125 F25.0
G1 X24 B-90.0 F25.0
G90
G1 Z1.75 F75.0
G91
G1 B90 F75.0
G91
G1 Z-0.25 F25.0
G1 Z-0.125 F25.0
G1 X-24 B90.0 F25.0
G1 Z-0.125 F25.0
G1 X24 B-90.0 F25.0
G90
G1 Z1.75 F75.0
G91
G1 B90 F75.0
G91
G1 Z-0.25 F25.0
G1 Z-0.125 F25.0
G1 X-24 B90.0 F25.0
G1 Z-0.125 F25.0
G1 X24 B-90.0 F25.0
G90
G1 Z1.75 F75.0
G91
G1 B90 F75.0
G91
G1 Z-0.25 F25.0
G1 Z-0.125 F25.0
G1 X-24 B90.0 F25.0
G1 Z-0.125 F25.0
G1 X24 B-90.0 F25.0
G90
G1 Z1.75 F75.0
M5
G1 X0.0 Y0.0 B0.0 F75.0
G1 B0.0
M30
%

---------------------------
Now i took the nc file and converted it in shopbot control software and then converted it to a txt file to copy here:
SA
MS,1.25,1.25
MZ,1.75
MS,1.25,1.25
M2,.0,.0
MS,1.25,1.25
M2,2.0,.0
SO 2,1
SR
MS,.42,.42
MZ,-.25
MS,.42,.42
MZ,-.125
MS,.42,.42
MX,-24.0
MS,.42,.42
MZ,-.125
MS,.42,.42
MX,24.0
SA
MS,1.25,1.25
MZ,1.75
SR
MS,1.25,1.25

SR
MS,.42,.42
MZ,-.25
MS,.42,.42
MZ,-.125
MS,.42,.42
MX,-24.0
MS,.42,.42
MZ,-.125
MS,.42,.42
MX,24.0
SA
MS,1.25,1.25
MZ,1.75
SR
MS,1.25,1.25

SR
MS,.42,.42
MZ,-.25
MS,.42,.42
MZ,-.125
MS,.42,.42
MX,-24.0
MS,.42,.42
MZ,-.125
MS,.42,.42
MX,24.0
SA
MS,1.25,1.25
MZ,1.75
SR
MS,1.25,1.25

SR
MS,.42,.42
MZ,-.25
MS,.42,.42
MZ,-.125
MS,.42,.42
MX,-24.0
MS,.42,.42
MZ,-.125
MS,.42,.42
MX,24.0
SA
MS,1.25,1.25
MZ,1.75
SO 2,0
MS,1.25,1.25
M2,.0,.0
END
-----------------------------------
The problem is that it never rotates my B drive when i aircut the file. I barely get thru this and it looks to me like there is a problem in translation and certain moves are being ignored or unrecognized but i'm confused as to how to "re-implement" those lost moves?

richards
06-05-2008, 05:56 AM
I'm at a Linux computer right now, so I can't run SB3 code; however, when you look at the G-code, you have a line G1 X-24 B90.0 F25.0

The means set the move speed to 25.0 inches per minute or 0.4 ips and move the X-axis and the B-axis together. Be sure that you have the VD command set to use 5-axes. The equivalent SB3 code would be:

MS, 0.4,,,0.4
M5, -24,,,,90.0

I believe that the File Conversion program only converts 3-axis files. If that is the case, you'll need to add a M5 statement whenever you have a multi-axis move that involves the B-axis, or you'll need to add an MB statement when you have a single B-axis move.

richards
06-05-2008, 07:18 AM
When you have to do manual file conversions, or when you need to compare a G-code file to an SBP file, an editor with split screen capabilities is a real asset. On Windows, I use Crimson Editor (download it free from www.crimsoneditor.com (http://www.crimsoneditor.com)). On Linux, I use Kate, which is part of KDE.

In Crimson, just select Split Vertical from the Windows Menu, and then open the two files, one in each window. I also turn on line numbering (View Menu or F11), so that I can keep track of where I am. The line numbering option does not put line numbers in the file, it only display a line number on the screen.

Manually editing/checking a file is not that difficult once you know which G-code command corresponds to a similar SBP command.

dana_swift
06-05-2008, 11:13 AM
Jack- Mikes answer jives with mine in the case of your question. Thanks for posting the G code, so we can see what is going on. I have found with both of them it just takes a short while to learn what the individual commands mean, and the problems show up quickly. The nice part is its easier to read than write, so you can check the output of your tool-path generator to see if it is doing what you want. Since I use mostly my own tool path generators I find myself reading the output files more often than other folks might.

Now as to WHY is the conversion program not generating any code for the B axis, I can't shed any light. I am also stunned that it is not more intelligent, why the redundant "MS" commands? If the bot is already at a speed those should be suppressed and save the SB3 program from having to re-interpret commands that make no change in the current state of the machine.

As to how to re-implement the lost moves. Read up in the Shopbot Command Reference manual, you will need to add M5 and MB commands as appropriate. Also you will need to ad MS and JS commands to change the B speed as appropriate:

MS XYSpeedIPS, ZSpeedIPS, ASpeedIPS, BSpeedIPS

Although if you leave the first fields blank it should preserve the existing values, I don't count on it, and fill in all fields.

Hope that helps.

D

PS and FYI for text tools I have used:

http://www.textpad.com

It has a free download and trial, but is a nominal fee to purchase. I don't remember the price $30 or so which is very reasonable for the power of the program.

Also another text tool I use to compare files or directories of them is:

http://www.winmerge.org

Winmerge is on a GNU license, free download free to use.

Like Mike, I like Linux a lot. But SB doesn't support it, however I have thought about writing my own SB3 equivalent for Linux, just too much else to do.

dana_swift
06-05-2008, 11:18 AM
Mike- I just checked out the Crimson editor, that looks very attractive. Thanks for the tip, I will download it and give it a try.

I like the open source.. it means it is like the shopbot- "have it your way"!

I have used Textpad for so many years I have not looked around for anything else, this may well replace it.

Thanks again

D

richards
06-05-2008, 03:08 PM
Dana,
Someone on the Forum suggested Crimson Editor awhile back, or I would never have tried it myself.

It's a good editor for programmers. I use it whenever I program on a Windows computer.