PDA

View Full Version : Programming with SB commands



beacon14
04-17-2005, 04:32 PM
OK, I'll get the ball rolling.

Here's a little file I wrote to surface the table or a workpiece without using the CR command. I prefer to do my surfacing with simple back-and forth strokes instead of the CR command with pocketing, which sometimes misses small areas in the corners and can leave cross-grain ridges on solid lumber.
Feel free to use this file if you find it useful, in exchange I ask that you post any improvements here for use by all.

' File for surface planing any object you can secure under the gantry, but typically used for
' Planing large, warped, wide, and/or valuable lumber.
' Requires input for length (X dimension) and width (Y dimension) of object, depth of cut, and stepover.
' Copyright 2005 David Buchsbaum. Unauthorized use or sale prohibited.

INPUT "LENGTH OF BOARD (X-axis)" &length
INPUT "WIDTH OF BOARD (Y-axis)" &width
INPUT "DEPTH PER PASS" &depth
INPUT "STEPOVER" &step

INPUT "BEGIN AT LOWER LEFT CORNER. ZERO TO TOP OF BOARD. [K]FOR KEYBOARD MODE or [ENTER] TO BEGIN" &key
&key="&key"
IF &key=K THEN GOSUB KEY
'READY TO ROCK & ROLL?
PAUSE
Z2
MS,1.5
BEGIN:
SO,1,1
PAUSE 1
&yvalue=0
JZ,.02
M3,5,0,-&depth
MX,0
LOOP:
MX,&length
&yvalue=&yvalue+&step
MY,&yvalue
MX,0
&yvalue=&yvalue+&step
IF &yvalue>&width THEN GOTO FINISHED
MY,&yvalue
GOTO LOOP
FINISHED:
JZ,.25
SO,1,0
JZ,1
&depth=0
INPUT "ANOTHER PASS? ENTER NEW DEPTH OR [0] FOR NONE" &depth
IF &depth=0 THEN GOTO END
J2,0,0
GOTO BEGIN
KEY:
SK
RETURN
END:


It can use some improvements, such as recording the current X and Y positions and restoring them after it's done - it now re-zeroes X and Y at the starting point, but it was all I had time for at the time. Let's see what people can make of it. I haven't annotated it, so if anything is not clear just ask, the idea is to put this out for discussion and improvement.

richards
04-17-2005, 06:54 PM
David,

I like your code, but I'm wondering if alternating a climb cut with a conventional cut, as the code seems to be doing, would case problems with 'tear-out' when surfacing lumber?

-Mike

richards
04-17-2005, 07:32 PM
Here is the same code with two additions:
1. Current xy location saved before the Z2 command.

2. Conventional cut only. (Takes twice as long)

I inserted ' +++++ and ' ----- at the beginning and end of code additions, except where I commented out the MX,0 instruction.


' File for surface planing any object you can secure under the gantry, but typically used for
' Planing large, warped, wide, and/or valuable lumber.
' Requires input for length (X dimension) and width (Y dimension) of object, depth of cut, and stepover.
' Copyright 2005 David Buchsbaum. Unauthorized use or sale prohibited.

INPUT "LENGTH OF BOARD (X-axis)" &length
INPUT "WIDTH OF BOARD (Y-axis)" &width
INPUT "DEPTH PER PASS" &depth
INPUT "STEPOVER" &step

INPUT "BEGIN AT LOWER LEFT CORNER. ZERO TO TOP OF BOARD. [K]FOR KEYBOARD MODE or [ENTER] TO BEGIN" &key
&key="&key"
IF &key=K THEN GOSUB KEY
'READY TO ROCK & ROLL?
PAUSE
' +++++
' save current location
&CURRENT_X = %(1)
&CURRENT_y = %(2)
' -----
Z2
MS,1.5
BEGIN:
SO,1,1
PAUSE 1
&yvalue=0
JZ,.02
M3,5,0,-&depth
MX,0
LOOP:
MX,&length
' +++++
MX,0
' -----
&yvalue=&yvalue+&step
MY,&yvalue

'MX,0

' +++++
MX,&length
MX,0
' -----

&yvalue=&yvalue+&step
IF &yvalue>&width THEN GOTO FINISHED
MY,&yvalue
GOTO LOOP
FINISHED:
JZ,.25
SO,1,0
JZ,1
&depth=0
INPUT "ANOTHER PASS? ENTER NEW DEPTH OR [0] FOR NONE" &depth
IF &depth=0 THEN GOTO END
J2,0,0
GOTO BEGIN
KEY:
SK
RETURN
END:
' +++++
JZ, 0.25
J2, 0,0
VA, &CURRENT_X, &CURRENT_Y
' -----

paco
04-17-2005, 08:33 PM
Hey guys!

Mike pointed a relevant aspect about the purpose of this program... but I believe that if less than 50% of the tool diameter is actualy machining the stepover than the result should be even on all the surface (depend on cutting speed too)... With CR pocketing, the routine is usualy set/used as to make a FULL use of the tool diameter... that is why I believe it result in a non-even surface...

Here my modifications...

-----------------------------------

' File for surface planing any object you can secure under the gantry, but typically used for
' Planing large, warped, wide, and/or valuable lumber.
' Requires input for length (X dimension) and width (Y dimension) of object, depth of cut, and stepover...
' ###And more...
' Copyright 2005 David Buchsbaum. Unauthorized use or sale prohibited.
' ###PACO MODIFICATIONS (4/17/2005)### Enjoy! 8-)

INPUT "LENGTH OF BOARD (X-axis)" &length
INPUT "WIDTH OF BOARD (Y-axis)" &width
INPUT "TOOL DIAMETER" &tool_diam '###
&tool_rad = &tool_diam / 2 '###
INPUT "% STEPOVER (SUGGEST 40)" &step '###
&step_dec = &step / 100 '###
&stepover = &tool_diam * &step_dec '###
INPUT "DEPTH PER PASS (Enter a positive value like 0.02 or 0.06)" &stepdown
INPUT "CUTTING SPEED" &cutspeed '###
INPUT "PLUNGE SPEED" &plungespeed '###
INPUT "BEGIN AT LOWER LEFT CORNER. ZERO TO TOP OF BOARD. [K] FOR KEYBOARD MODE or ANY KEY TO BEGIN" &key
IF &key = K THEN GOSUB KEY

'READY TO ROCK & ROLL?
PAUSE
Z2
MS,&cutspeed,&plungespeed '###
&depth = &stepdown

BEGIN:
SO,1,1
PAUSE 1
&yvalue = %(2) '###
JZ,0.02
MZ,-&depth

LOOP:
MX,&length
&yvalue = &yvalue + &stepover '###
IF &yvalue > &width THEN GOTO FINISHED '###
MY,&yvalue
MX,0
&yvalue = &yvalue + &stepover
IF &yvalue > &width THEN GOTO FINISHED
MY,&yvalue
GOTO LOOP

FINISHED:
SO,1,0
JH
INPUT "ANOTHER PASS? ANY KEY to continue or N (or Esc) to end" &cont
IF &cont = N THEN GOTO END
&depth = &depth + &stepdown '###
GOTO BEGIN

KEY:
SK
RETURN

END:
JH '###
END

-----------------------------------

As I post this, I'm wondering if it could be worth to include a choice to cut in conventional or climb... though I think conventional to be the one...

paco
04-17-2005, 08:56 PM
Back with another MOD that I think Mike will like (even more with an ALPHA)...

-----------------------------------

' File for surface planing any object you can secure under the gantry, but typically used for
' Planing large, warped, wide, and/or valuable lumber.
' Requires input for length (X dimension) and width (Y dimension) of object, depth of cut, and stepover...
' ###And more...
' Copyright 2005 David Buchsbaum. Unauthorized use or sale prohibited.
' ###PACO MODIFICATIONS v2 (4/17/2005)### Enjoy! 8-)

INPUT "LENGTH OF BOARD (X-axis)" &length
INPUT "WIDTH OF BOARD (Y-axis)" &width
INPUT "TOOL DIAMETER" &tool_diam '###
&tool_rad = &tool_diam / 2 '###
INPUT "% STEPOVER (SUGGEST 40)" &step '###
&step_dec = &step / 100 '###
&stepover = &tool_diam * &step_dec '###
INPUT "DEPTH PER PASS (Enter a positive value like 0.02 or 0.06)" &stepdown
INPUT "CUTTING SPEED" &cutspeed '###
INPUT "PLUNGE SPEED" &plungespeed '###
INPUT "BEGIN AT LOWER LEFT CORNER. ZERO TO TOP OF BOARD. [K] FOR KEYBOARD MODE or ANY KEY TO BEGIN" &key
IF &key = K THEN GOSUB KEY

'READY TO ROCK & ROLL?
PAUSE
Z2
MS,&cutspeed,&plungespeed '###
&depth = &stepdown

BEGIN:
SO,1,1
PAUSE 1
&yvalue = %(2) '###

LOOP:
JZ,0.02
MZ,-&depth
MX,&length
JZ,&SAFE_Z
&yvalue = &yvalue + &stepover '###
IF &yvalue > &width THEN GOTO FINISHED '###
J2,0,&yvalue
GOTO LOOP

FINISHED:
SO,1,0
JH
INPUT "ANOTHER PASS? ANY KEY to continue or N to end" &cont
IF &cont = N THEN GOTO END
&depth = &depth + &stepdown '###
GOTO BEGIN

KEY:
SK
RETURN

END:
JH '###
END

-----------------------------------

richards
04-17-2005, 09:23 PM
Paco,

I do like you idea of having router on/off code and a speed parameter as part of the program. I've taken the liberty to change your program just a little. Your program initialized the &yvalue to the starting y-axis location, but then performed a comparision using &yvalue + &width. I believe the result of the comparison assumed that the starting location would be x,y = 0,0, and, therefore might fail if starting from another location.

Also, by lifting/lowering the z-axis on each pass, we might introduce some 'waviness' depending on whether the z-axis returned to the exact height each time it was moved. (I'll concede that that is probably a nit-picky point. I considered doing the same thing, when I first looked at the program.)

Anyway, many eyes and opinions make program modification easier.

-Mike

' File for surface planing any object you can secure under the gantry, but typically used for
' Planing large, warped, wide, and/or valuable lumber.
' Requires input for length (X dimension) and width (Y dimension) of object, depth of cut, and stepover...
' ###And more...
' Copyright 2005 David Buchsbaum. Unauthorized use or sale prohibited.
' ###PACO MODIFICATIONS v2 (4/17/2005)### Enjoy! 8-)

INPUT "LENGTH OF BOARD (X-axis)" &length
INPUT "WIDTH OF BOARD (Y-axis)" &width
INPUT "TOOL DIAMETER" &tool_diam '###
&tool_rad = &tool_diam / 2 '###
INPUT "% STEPOVER (SUGGEST 40)" &step '###
&step_dec = &step / 100 '###
&stepover = &tool_diam * &step_dec '###
INPUT "DEPTH PER PASS (Enter a positive value like 0.02 or 0.06)" &stepdown
INPUT "CUTTING SPEED" &cutspeed '###
INPUT "PLUNGE SPEED" &plungespeed '###
INPUT "BEGIN AT LOWER LEFT CORNER. ZERO TO TOP OF BOARD. [K] FOR KEYBOARD MODE or ANY KEY TO BEGIN" &key
IF &key = K THEN GOSUB KEY

'READY TO ROCK & ROLL?
PAUSE

' +++++
' Z2
&START_X = %(1)
&START_Y = %(2)
' -----

MS,&cutspeed,&plungespeed '###
&depth = &stepdown

BEGIN:
SO,1,1
PAUSE 1
' +++++
'&yvalue = %(2) '###
' -----

LOOP:
JZ,0.02
MZ,-&depth
'+++++
'MX,&length
MX, &START_X + &length
' -----
JZ,&SAFE_Z
&yvalue = &yvalue + &stepover '###
IF &yvalue > &width THEN GOTO FINISHED '###

' +++++
'J2,0,&yvalue
J2, 0, &START_Y + &yvalue
' -----

GOTO LOOP

FINISHED:
SO,1,0
JH
INPUT "ANOTHER PASS? ANY KEY to continue or N to end" &cont
IF &cont = N THEN GOTO END
&depth = &depth + &stepdown '###
GOTO BEGIN

KEY:
SK
RETURN

END:
JH '###
END

richards
04-17-2005, 10:44 PM
I just noticed that the ramping cut was eliminated from the program. It's probably a good idea to leave it in, especially with large diameter cutters.

If you go back to David's original listing, you'll find it a few lines after the BEGIN: label. However, I would change it from:
M3,5,0,-&depth
to:
M2, 5 + &START_X, &START_Y
MZ, 0.01
M3, &START_X, &START_Y, -&depth

One other little matter concerning the diameter of the cutter vs the radius of the cutter contributing to the amount of 'waviness'. If my math is correct (and it probably isn't), it seems that if the z-axis were tilted, that using the radius instead of the diameter would still produce a wavy surface, although not as pronounced. To test the point, imagine a 30, 60, 90 degree triangle with the long leg representing the diameter of the cutter and the short leg representing the amount of error. Using 1/2 of the long leg would still produce 1/2 the error. (I know how hard it is to have a perfectly aligned z-axis. It's hard enough that I still mess with my alpha every time I flatten the spoil board.)

paco
04-18-2005, 12:54 AM
Mike!

The router control code is from David; I use a wall switche!

Both David and I have assumed (I think!?) that the program would be run from 0,0; but your mods is interesting and correcting the program to another possibility...

I agree about the "lifting/lowering the z-axis on each pass"; I'd prefer my first mod anyway... and I believe it would perform just as with "lifting/lowering the z-axis on each pass"... and it will be even faster (both for PRT and PRT ALPHA machine) machining back and forth, moving the Y each time with the stepover...

Sorry David; I have'nt noticed the use of the ramp in... so I got it back! I added a slight modifications about it; tell me what you guys think?!

-----------------------------------

' File for surface planing any object you can secure under the gantry, but typically used for
' Planing large, warped, wide, and/or valuable lumber.
' Requires input for length (X dimension) and width (Y dimension) of object, depth of cut, and stepover...
' ###And more...
' Copyright 2005 David Buchsbaum. Unauthorized use or sale prohibited.
' ###PACO'S MODIFICATIONS v3 (4/17/2005)### Enjoy! 8-)
' @@@Mike Richard's modifications v2 (4/17/2005)@@@

INPUT "LENGTH OF BOARD (X-axis)" &length
INPUT "WIDTH OF BOARD (Y-axis)" &width
INPUT "TOOL DIAMETER" &tool_diam '###
&tool_rad = &tool_diam / 2 '###
INPUT "% STEPOVER (SUGGEST 40)" &step '###
&step_dec = &step / 100 '###
&stepover = &tool_diam * &step_dec '###
INPUT "DEPTH PER PASS (Enter a positive value like 0.02 or 0.06)" &stepdown
INPUT "CUTTING SPEED" &cutspeed '###
INPUT "PLUNGE SPEED" &plungespeed '###
INPUT "BEGIN AT LOWER LEFT CORNER. ZERO TO TOP OF BOARD. [K] FOR KEYBOARD MODE or ANY KEY TO BEGIN" &key
IF &key = K THEN GOSUB KEY

'READY TO ROCK & ROLL?
PAUSE
&START_X = %(1) '@@@
&START_Y = %(2) '@@@
MS,&cutspeed,&plungespeed '###
&depth = &stepdown '###

BEGIN:
SO,1,1
PAUSE 1
JZ,0.02 - (&depth - &stepdown) '### 8-)
M3,&START_X + 5,&START_Y,-&depth '###@@@Original ramp in from David B. (Sorry...I have'nt noticed the purpose...)
MX,&START_X '###@@@

LOOP:
MX, &START_X + &length '###@@@
&yvalue = %(2) + &stepover '###
IF &yvalue > &width THEN GOTO FINISHED '###
MY,&yvalue
MX,&START_X '###@@@
&yvalue = %(2) + &stepover '###
IF &yvalue > &width THEN GOTO FINISHED
MY,&yvalue
GOTO LOOP

FINISHED:
SO,1,0
JH
INPUT "ANOTHER PASS? ANY KEY to continue or N to end" &cont
IF &cont = N THEN GOTO END
&depth = &depth + &stepdown '###
GOTO BEGIN

KEY:
SK
RETURN

END:
JH '###
END

-----------------------------------

By the way David, you could get your, say spoilboard , without any missed area by setting the "Pocket Overlap" to at least 15 %... I've found that below this setting, it will leave small area unmachined as you wrote in your first post...

gerald_d
04-18-2005, 01:13 AM
Climb vs Conventional is a bit of a non-issue for a "surfacing" job. Normally we worry a little about the top edge and the vertical face when choosing a cut direction, but for surfacing there is no vertical face or top edge.

beacon14
04-18-2005, 02:30 AM
Uh oh, I can see this thread is going to require much more time to monitor than I realized. I'll have to look into the code improvements later but I can tell you that as far as surfacing in only one direction or two it shouldn't make any difference - I'm only using the 'Bot to make the surface flat - it still has to sanded until all the torn/cut fibers have been removed, or the surface is not ready for finishing. If you can see "track marks" after the finish is applied, it indicates a problem with the sanding, not the machining (assuming the Z axis is reasonably square to the table - if not your ridges will be more of an issue than grain/cutter direction).

Cutter sharpness will make much more of a difference than cut direction, so why take twice as long? I've done it with both hard and soft woods and it works fine.
But good job on chiming in with suggestions - this could work well and I hope the newbies will get something out of it as well.

fleinbach
04-18-2005, 07:02 AM
Well Gerald, it looks like we're on the same page again. I totally agree, climb versus conventional would be of little consequences when surfacing the table. Since surfacing is usually done at very shallow depths there would be little vertical face area, hardly enough to be concerned about climb versus conventional.

Climb versus conventional is used primarily to keep the bit from over or under cutting (pulling into or away from the cut line). It has little effect on the bottom of the bit as is necessary when surfacing.

richards
04-18-2005, 03:37 PM
The various code modifications show that every programmer has his/her own way of doing things. If it works, it works. Period. After that, changes to the code could be considered 'tweaking' to enhance some aspect of the job that seemed to need 'tweaking' (quality of cut, speed, cutter life, etc.). I've found that keeping an 'after cut' report helps to define problem areas that might need 'tweaking' when the job needs to be run again or other similar jobs come along.

richards
04-19-2005, 12:18 AM
Today's been one of those quiet days that I really enjoy from time to time as I drive between Salt Lake City, Utah and Boise, Idaho (and back - 750 miles round trip). Going up was an adventure with snow, rain, hail and some of the strongest winds that I've ever experienced. (Can you envision 55mph maximum speed with the throttle pressed to the floor?) Coming back was even more fun when I had to tap the brakes from time to time to keep the speed under the legal 75mph limit.

The point, though, was having twelve hours to reflect on how enjoyable the last several months has been since the Shopbot arrived. That machine has been the more than a pleasure to use. Normally it only takes a very few minutes from concept to execution (you can tell by that statement that my designs must be fairly simple). But, it's true. A few minutes in AutoCAD Lite to lay things out, a few minutes in PartsWizard to create the tool paths, a few minutes with an editor to tweak the code and then a few minutes to cut the parts.

I realized that there must be a 99-percent rule that governs how I program, since 99-percent of all parts are first drawn in AutoCAD Lite, 99-percent of all tool paths are created with PartsWizard, and 99-percent of all SBP files are tweaked just a little, (although I have had a little fun with a c-program that nobody but a fellow programmer would even find even remotely useful until Bruce Clark worked his magic and made it usable for everyone, including programmers).

How many other process control type machines come with the quality of software tools that Shopbot provides? I don't know of any. (By the way, I've got to spend some serious time with PartsWizard - it's just hard to break away from AutoCAD Lite when I've already invested so much time learning it well enough to lay out my parts.) The actual Shopbot programming code still amazes me. It actually does exactly what it should do, without bugs and without work-arounds (at least all of the commands that I've ever used).

It's a great machine with great software tools backup up by great people and supported by a great neighborhood of users. Thanks to all!

-Mike

gerald_d
04-19-2005, 01:22 AM
Mike, a good post!

A small correction though: The name is AutoCad LT - anything but "light"