This program calculates sheet-metal bend allowances, helping fabricators determine the total flat-blank length required to produce a part with multiple bends. For each bend, it computes the setback (W) using the tangent of half the bend angle, and the bend allowance (C) using the empirical formula ((0.01743 × R) + (0.0078 × T)) × A, which accounts for both bend radius and material thickness. Up to 20 bends are supported via parallel DIM arrays for sides, angles, radians, setbacks, bend allowances, flat lengths, radii, and a spare K array. Results are tabulated showing each leg’s flat length, setback, bend allowance, angle, and radius, with all values rounded to three decimal places using the INT(x×1000+0.5)/1000 idiom.
Program Structure
The program is organized into three logical phases: data entry, calculation, and tabular output. Lines 40–120 initialize nine parallel arrays (each dimensioned to 20 elements) and collect global parameters (number of bends B and material thickness T). Lines 130–400 handle the per-bend input loop, with the first bend processed outside the loop (lines 130–230) and bends 2 through B handled in a FOR loop (lines 240–360). A final leg entry at lines 370–400 closes the geometry. Lines 410–500 produce the summary and tabular output.
Array Usage
Nine arrays are declared at line 40, all of size 20:
S()— input leg lengthsA()— bend angles in degreesX()— bend angles converted to radiansW()— setback valuesC()— bend allowancesI()— declared but unused (shadowed by the loop variableI)L()— computed flat leg lengthsR()— bend radiiK()— declared but never used
Note that I is both a numeric scalar loop variable and a declared array I(); on this platform these are distinct namespaces, so no collision occurs, but the array I() is entirely superfluous.
Engineering Formulas
Two standard sheet-metal formulas drive the calculations:
- Setback W(i):
(R(I) + T) * TAN(X(I) / 2)— the tangent-based setback from the outside mold line to the bend tangent point. - Bend allowance C(i):
((0.01743 * R(I)) + (7.8E-03 * T)) * A(I)— an empirical linear approximation. The coefficient 0.01743 is approximately π/180, scaling radius to arc length per degree; 7.8E-3 (0.0078) is a material-dependent neutral-axis factor applied to thickness.
The flat leg length L(I) is the nominal leg length minus the setbacks contributed by adjacent bends: for the first leg S(1) - W(1), for intermediate legs S(I) - W(I) - W(I-1), and for the last leg S(B+1) - W(B). The running total M accumulates all flat lengths and bend allowances to yield the required blank length.
Notable Techniques
- 180-degree guard: Line 150 clamps a 180° angle to 179° and line 280 to 179.9°, preventing a division-by-zero in
TAN(X/2)when the half-angle reaches 90°. The slightly different clamp values (179 vs. 179.9) between the first-bend and loop paths is an inconsistency. - Rounding idiom:
INT(x * 1000 + 0.5) / 1000at lines 430, 460–480 rounds results to three decimal places, a standard BASIC technique in the absence of a built-in rounding function. - Degree-to-radian conversion: Performed explicitly via multiplication by
3.1415926 / 180and stored in arrayX(), since no built-in degree-mode trigonometry is available. - Single-bend shortcut: Line 230 branches directly to line 370 when
B=1, skipping theFORloop entirely. - Literal π approximation:
3.1415926is used rather than any built-in constant, which is typical for this platform.
Output Format
The results table at lines 440–500 uses comma-separated PRINT items to align output into the system’s fixed tab columns. Column headers are “LEG”, “LENGTH”, “S/B” (setback), “B/A” (bend allowance), “ANGLE”, and “RADIUS”. The loop runs from 1 to B+1, covering all legs including the final one; however, C(B+1) and A(B+1) and R(B+1) are never assigned for the last leg and will print as zero, which is geometrically correct since there is no bend after the last leg.
Bugs and Anomalies
- The unused arrays
I(20)andK(20)consume memory without contributing to the program’s function. - The 180° clamp differs between the first bend (clamped to 179) and subsequent bends (clamped to 179.9), producing slightly different numerical results for the edge case of a near-flat bend.
- Variable
Mis used as a scalar accumulator but is never initialized to zero explicitly; it relies on the interpreter’s default zero-initialization of numeric variables. - Line 510 contains a
REM SAVE "BEND ALLOW" LINE 1comment, suggesting an intended auto-run save command that was commented out rather than executed.
Source Code
10 REM CALCULATING BEND ALLOWANCES USING THE SINCLAIR 2068
20 REM BY W.K. LANGENDORF
30 REM MAY 4,1984
40 CLS :DIM S(20):DIM A(20):DIM X(20):DIM W(20):DIM C(20):DIM I(20):DIM L(20):DIM R(20):DIM K(20)
50 PRINT "NUMBER OF BENDS: ";
60 INPUT "ENTER ";B:PRINT b
70 PRINT "THICKNESS OF MATERIAL: ";
80 INPUT "ENTER ";t:PRINT t
90 PRINT "ENTER LENGTH OF EACH LEG, THEN THE";
100 PRINT "ANGLE AT THE END OF EACH LEG."
110 PRINT "NEXT, ENTER THE RADIUS OF THE FIRST BEND."
120 PRINT ''"THE LENGTH OF SIDE 1: ";
130 INPUT "ENTER ";s(1):PRINT s(1)
140 PRINT "ANGLE OF SIDE 1: ";
150 INPUT "ENTER ";a(1):IF a(1)=180 THEN LET a(1)=179
160 PRINT a(1)
170 LET X(1)=A(1)*3.1415926/180:REM CHANGES DEGREES TO RADIANS
180 PRINT "THE RADIUS OF THE BEND: ";
190 INPUT "ENTER ";R(1):PRINT R(1)
200 LET W(1)=(R(1)+T)*(TAN (X(1)/2))
210 LET C(1)=((0.01743*R(1))+(7.8E-03*T))*A(1)
220 LET L(1)=S(1)-W(1):LET M=L(1)+C(1)
230 IF B=1 THEN GO TO 370
240 FOR I=2 TO B
250 PRINT "LENGTH OF SIDE ";I;": ";
260 INPUT "ENTER ";S(I):PRINT S(I)
270 PRINT "ANGLE OF SIDE ";I;": ";
280 INPUT "ENTER ";A(I):IF A(I)=180 THEN LET A(I)=179.9
290 PRINT A(I)
300 LET X(I)=A(I)*3.1415926/180:REM CHANGES DEGREES TO RADIANS
310 PRINT "THE RADIUS OF BEND ";I;": ";
320 INPUT "ENTER ";R(I):PRINT R(I)
330 LET W(I)=(R(I)+T)*(TAN (X(I)/2))
340 LET C(I)=((0.01743*R(I))+(7.8E-03*T))*A(I)
350 LET L(I)=S(I)-W(I)-W(I-1):LET M=M+L(I)+C(I)
360 NEXT I
370 PRINT "THE LAST LEG: ";
380 INPUT "ENTER ";S(B+1):PRINT S(B+1)
390 LET L(B+1)=S(B+1)-W(B)
400 LET M=M+L(B+1)
410 PRINT ''
420 PRINT "THICKNESS= ";T'" NO. OF BENDS: ";B
430 PRINT "TOTAL LENGTH NEEDED: "; INT (M*1000+0.5)/1000
440 PRINT '"LEG","LENGTH","S/B","B/A","ANGLE","RADIUS"
450 FOR I=1 TO B+1
460 LET L(I)= INT (L(I)*1000+0.5)/1000
470 LET W(I)= INT (W(I)*1000+0.5)/1000
480 LET C(I)= INT (C(I)*1000+0.5)/1000
490 PRINT I,L(I),W(I),C(I),A(I),R(I)
500 NEXT I
510 REM SAVE "BEND ALLOW" LINE 1
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
