Sheet metal
Most enclosures, brackets, ducts and chassis are made the same way: a flat blank is cut from sheet of one thickness, then bent on a press brake, its edges folded over, its corners closed, and holes and stiffening shapes punched or pressed into it. bitbybit.occt.fabrication.sheetMetal models parts in exactly that vocabulary. You do not draw a solid and hope it can be made from sheet: you start a part from a flat face or a profile, then bend flanges off its edges, fold it along lines, close its corners and stamp forms into it, and every step keeps it a part of one thickness.
Each operation takes a part and returns a new one; the part it was given stays as it was. The result is an exact solid, so it draws, measures and exports like any other OCCT shape, and it carries a record of what it is made of: its regions, its bends and the seams and forms between them, each by name.
The sheet metal functions are new and marked beta: their names and the shape of the record may still change.
A first part
A blank of 120 by 80 becomes a plate 2 thick, and two flanges are bent up off its opposite edges. The flanges are found by name and direction, not by counting faces.


- Rete
- Blockly
- TypeScript
const { sheetMetal } = bitbybit.occt.fabrication;
const blank = await bitbybit.occt.shapes.face.createRectangleFace({ width: 120, length: 80, center: [0, 0, 0], direction: [0, 1, 0] });
let part = await sheetMetal.plate({ face: blank, thickness: 2, bendRadius: 2, name: "base" });
part = await sheetMetal.flange({
part,
insideFace: await sheetMetal.insideFace({ part, region: "base" }),
edge: await sheetMetal.insideEdgeToward({ part, region: "base", direction: [1, 0, 0] }),
length: 30,
name: "side1",
});
part = await sheetMetal.flange({
part,
insideFace: await sheetMetal.insideFace({ part, region: "base" }),
edge: await sheetMetal.insideEdgeToward({ part, region: "base", direction: [-1, 0, 0] }),
length: 30,
name: "side2",
});
console.log(await sheetMetal.regionNames({ part }), await sheetMetal.bendNames({ part }));
console.log(await sheetMetal.check({ part }));
await bitbybit.draw.drawAnyAsync({ entity: part, options: bitbybit.draw.optionsOcctSheet({}) });
bitbybit.babylon.scene.adjustActiveArcRotateCamera({ position: [131, 131, -157], lookAt: [0, 13, 0] });
bitbybit.occt.fabrication.sheetMetal.plate turns the face into a part, the region named base. bitbybit.occt.fabrication.sheetMetal.flange bends a flange off one straight edge of a region's inside face; each flange is a new region (side1, side2) joined to the base by a bend (side1.b1, side2.b1). The TypeScript tab prints those names, then the part's check: a sheet, with no problems and no warnings. The part is drawn in its looks, its bends tinted.
What a part is made of
A sheet metal part is an object with four things in it:
shape, the solid.record, a JSON text that names every flat region of the part, every bend that joins two regions, every seam where two regions meet without a bend (a mitred corner, a closed corner, a rip) and every form pressed into it, each with the faces it owns. The next operation reads it, and you can parse it to look inside.roles, the faces the last operation added, grouped by what they are: a flange'sendface, itssidesand itslegEnds, a cut'swalls, thereliefsbeside a bend, and each form's faces under the form's own name.frames, one coordinate frame per flat region, its origin on the region's inside face and its normal pointing through the material.
Every operation reads the part's record and writes a new one, so a part only stays a part when each step is one of these operations. A boolean or a fillet applied to part.shape gives a solid the record no longer describes; checking a part shows what that looks like.
Thickness
A part has one thickness, given when it starts and kept by everything after. Two parts of different thickness cannot be joined into one: they would be two parts in the shop too.
The inside face
Each region has an inside face, the face it was drawn on, and an outside face across the thickness from it. A plate made with side set to back (the default) keeps the drawn face as its inside face and grows the thickness behind it, so the inside face looks the way the face did.
Bends are described from the inside face. A bend that turns up rises toward the side the inside face looks at, so the inside face becomes the bend's concave side and its inner radius is measured there. A plate drawn on the ground looking up therefore bends its flanges upward; draw it looking down, or set direction to down, and they hang below it. The same rule holds for hems, folds, lances and forms, which is why most examples on these pages draw their blanks facing up.
Bend radius
Every bend has an inner radius. A shop picks it from its tooling and the material, and a common starting point is a radius equal to the thickness, which is what a part uses when bendRadius is left out. A smaller radius than the material can take cracks it: set minimumRadius on the part and check warns of every bend tighter than that.
K-factor and bend allowance
When sheet bends, its outer layer stretches and its inner layer is compressed. Somewhere between them lies the neutral layer, which keeps its length. The K-factor says where: as a share of the thickness, measured from the inside face, so 0.5 puts it in the middle and 0.33 a third of the way through.
The length of the neutral layer through a bend is the bend allowance, the length of flat sheet the bend takes up: the bend's angle in radians times the inner radius plus the K-factor times the thickness. Each bend records the K-factor it was made with. Operations that move material along a line, a fold, a jog, a lance, a louver and a bridge, use it to decide where the material beyond the bend lands, so the part comes out as long as the sheet it was cut from. A K-factor above 0.5 is unusual for a press brake, and check warns of it.
A shop that has measured its bends keeps a bend table: rows of thickness, inner radius and angle, each giving the K-factor, the bend allowance or the bend deduction that combination produced. Give a part a bendTable and each bend reads its K-factor from the rows at its own thickness, radius and angle, between rows by interpolation. A bend outside the rows is refused rather than guessed, since a table says nothing about a bend it does not list. bitbybit.occt.fabrication.sheetMetal.create.bendTableRow makes a row in every editor, from thickness, radius, angle, gives (kFactor, allowance or deduction) and value; Bends, jogs and lances folds a strip by one.
Reliefs
A flange that stops short of the end of its edge leaves the bend pressing against flat sheet beside it, which tears or bulges when it is formed. A relief is a small notch cut beside the bend's end so it can form cleanly: rectangular, obround (a rounded floor), tear (a slit one kerf wide) or none, with a width along the edge and a depth past the bend. Where two flanges meet at a corner, their bends share a square of sheet; a corner relief clears it, as the square they share (bendRegion), a round hole (circular) or a square one (square).
Settings that cascade
The operations that start a part, bitbybit.occt.fabrication.sheetMetal.plate, contour, loft and sweep, take the sheet's own settings and record them: bendRadius, kFactor, bendTable, relief with reliefWidth and reliefDepth, cornerRelief with cornerReliefSize, minimumFlange and minimumRadius. Every later operation inherits them. A flange or a fold may give its own bendRadius, kFactor or relief, which holds for that feature alone.
Set what is true of the material once, on the part, and only what is particular to one feature on that feature. minimumFlange is the shortest flange the shop's tooling can grip; a flange shorter than it is refused. minimumRadius is the tightest bend the material takes; bends below it are allowed, and check warns of each.
Names, and picking faces without numbers
Every operation records what it adds under its name. Left out, it is the operation's word and the lowest free number, such as flange1 or louver2. A feature with several regions numbers them name, name.2 and on, its bends are name.b1, name.b2, and its forms name.1, name.2, which are also the roles that hold each form's faces.
Those names are how you find faces. A face index changes whenever an operation adds a face somewhere, and a list of indexes stops naming the right faces as soon as a size changes. The pickers name faces by what they are instead:
bitbybit.occt.fabrication.sheetMetal.insideFaceandoutsideFacegive a region's inside or outside face by its name.insideEdgeTowardgives the edge of a region's inside face that lies furthest along a direction:[1, 0, 0]is always the edge at the largest x, whatever the part's size.insideEdgeNearestgives the edge whose middle lies nearest a point.endFaceTowardgives the face through the thickness at a region's outline that lies furthest along a direction: a flange's end at a corner, the facecloseCornertakes.edgeBetweengives the edge where the faces of two regions meet.facesOfRolegives the faces of one of the part'sroles, such as thesidesof the flange just made. They come in the order of the part's faces, which says nothing of where each lies, so pick one of several with a picker that looks, asendFaceTowarddoes.regionNamesandbendNameslist the part's regions and bends in the order its record holds them.
Every example on these pages picks its faces and edges this way.
Drawing a part in its looks
A sheet metal part draws like any shape, all one colour. Drawn in its looks, it shows what it is made of. bitbybit.draw.optionsOcctSheet makes the drawing options for that, passed to bitbybit.draw.drawAnyAsync as its options, as a shape's options are:
regionColourfor the flat regions, white;bendColourfor the bends,#9fb8d6;formedColourfor the smooth regions a formed loft makes,#c6d2e0; andformColourfor the forms, the accent#ff4400. The faces through the thickness take the region colour unlesswallColourgives them their own.insideColourandoutsideColourpaint a whole side of the material over those colours, as a coated or finished side would look: the inside is the side the bends turn toward when they bend up, kept through every bend, and the bends' ends, the walls and the forms keep their own.edgeColour,#5f6773, andedgeWidth, 1: half a shape's, since a sheet has many short edges through its thickness.tangentEdgeColouris the colour of the edges where the bends meet their regions, the edge colour unless you give it another.drawBendLinesdraws the bends' lines over the part.bendLineKindsays which: where each bend meets its regions on the inside layer (insideTangents, the default) or the outside (outsideTangents), or the one line halfway round it (insideCenter,outsideCenter), the line a press brake is set to. They are#ff6a00(bendLineColour) and 2 wide (bendLineWidth).
In Rete the "occt sheet" component, under draw > options, plugs into a draw component's options, and the part's own component is hidden so the part is not drawn twice; in Blockly the "occt sheet" block goes into the draw block's options. A list of parts drawn with one set of options draws each part in its looks. Every part on these pages is drawn this way, with the defaults unless the page is about something the defaults leave out.


- Rete
- Blockly
- TypeScript
const { sheetMetal } = bitbybit.occt.fabrication;
const blank = await bitbybit.occt.shapes.face.createRectangleFace({ width: 120, length: 80, center: [0, 0, 0], direction: [0, 1, 0] });
let part = await sheetMetal.plate({ face: blank, thickness: 2, bendRadius: 2, name: "base" });
part = await sheetMetal.flange({
part,
insideFace: await sheetMetal.insideFace({ part, region: "base" }),
edge: await sheetMetal.insideEdgeToward({ part, region: "base", direction: [1, 0, 0] }),
length: 30,
name: "side1",
});
part = await sheetMetal.flange({
part,
insideFace: await sheetMetal.insideFace({ part, region: "base" }),
edge: await sheetMetal.insideEdgeToward({ part, region: "base", direction: [-1, 0, 0] }),
length: 30,
name: "side2",
});
part = await sheetMetal.form({
part,
face: await sheetMetal.insideFace({ part, region: "base" }),
kind: Bit.Inputs.OCCT.sheetMetalFormEnum.dimple,
points: [[-25, 0, 0], [25, 0, 0]],
diameter: 20,
depth: 4,
draft: 30,
name: "dimple",
});
const shift = await bitbybit.occt.transforms.translationToMatrix({ translation: [-160, 0, 0] });
const plain = await sheetMetal.transform({ part, transformation: shift });
await bitbybit.draw.drawAnyAsync({ entity: plain });
await bitbybit.draw.drawAnyAsync({ entity: part, options: bitbybit.draw.optionsOcctSheet({}) });
bitbybit.babylon.scene.adjustActiveArcRotateCamera({ position: [15, 217, -272], lookAt: [-80, 13, 0] });
Drawn as a plain shape, the part is all one white, its bends and dimples told apart only by their edges. Drawn in its looks beside it, its regions, its two bends and its two dimples read at a glance.
The options only draw. When a script needs the looks or the lines themselves, two functions give them. bitbybit.occt.fabrication.sheetMetal.colorByKind returns the part with its looks as an appearance, in colours you choose, for a script that passes the part on in colour. bitbybit.occt.fabrication.sheetMetal.bendLines returns the bend lines as wires, every bend's or one bend's by name, to measure, label or export; with a lift they stand that far off the part, square to each bend's axis and away from the material, which is how the drawing options keep them clear of the flat facets a curved bend is drawn with. Both read the part's record, so both refuse a part whose record no longer matches its shape, as after a boolean, and so does drawing it in its looks: "part holds a record that no longer matches its shape, as after a boolean or a transform outside the sheet metal operations; sheetMetal.check says why." Moving and checking shows such a part.
Checking a part
bitbybit.occt.fabrication.sheetMetal.check reads a part and its record and reports whether they still make a sheet: one valid solid that the record describes, with nothing added to or taken from its layers. It reports rather than refuses. isSheet is the answer, problems names each region, bend or face that is no longer what the record says, and warnings lists what leaves it a sheet but deserves a look, such as a bend below minimumRadius. Run it as the last step of a part, and after anything done to a part outside these operations.
The pages of this section
- Starting a part: plates, contour flanges, lofted transitions and swept flanges.
- Flanges and hems: one flange and its options, flanges of several bends, mitred flanges, and the five kinds of hem.
- Bends, jogs and lances: folding a region along a line, jogging it, folding by a bend table, and lancing a tab out of it.
- Joining and corners: joining two plates with a bend, closing corners, rips and tabs.
- Cutting, forming and finishing: holes and pockets, stamped forms, gussets and finished corners.
- Moving and checking: moving and mirroring parts, and what
checkreports. - An inline fan box: one product that uses every operation, built step by step.
Every function
| Function | What it does |
|---|---|
bend | Folds a flat region along a line across it, or jogs it with an offset, two opposite bends that land the far side parallel. |
bendLines | Draws a part's bend lines as straight wires along each bend's axis, across the bend's whole width: where it meets its flat regions, or halfway round it. |
bendNames | Lists the names of a part's bends, in the order its record holds them, as gusset takes one. |
check | Checks that a part and its record still make a sheet of one thickness. |
closeCorner | Closes the corner between two flanges by extending their ends: one overlapping the other's edge, or both meeting on the corner's miter. |
colorByKind | Gives a part an appearance read from its record: each kind of face in a color, the edges where bends meet their regions in another, and each side of the material in one when given. |
contour | Starts a part as a contour flange: an open profile of straight lines given a thickness and run along a direction, every corner a bend of the sheet's radius. |
create.bendTableRow | Makes one row of a bend table: the K-factor, bend allowance or bend deduction that a bend of this thickness, inner radius and angle takes. |
create.flangeSegment | Makes one segment of a flange's profile: a further bend of an angle and the straight run after it, turning Z shapes, clips, returns and steps into one flange. |
cut | Cuts closed profiles drawn on a region's face square through the sheet, or pockets them to a depth. |
edgeBetween | Picks the edge where the faces of two regions meet, such as the inner corner of two walls closed against each other, which ripEdge parts; the longest where they share several. |
endFaceToward | Picks the planar face through the thickness at a region's outline that lies furthest along a direction, judged by its center: a flange's end, which closeCorner takes as a leg's end, or its rim. |
facesOfRole | Picks the faces the operation that made a part names by a role, such as a flange's end or a cut's walls, as the part's roles lists them: in the order of the faces, which says nothing of where each lies, so pick one of several by where it lies, as endFaceToward does. |
flange | Bends a flange off a straight edge of a region's inside face. |
flanges | Bends a flange off each of several straight edges of one inside face, flanges sharing a corner meeting mitered there, with a corner relief where their bends meet. |
form | Stamps forms into a region's face: dimples, louvers, bridges or extruded holes at points, embosses along closed profiles or beads along paths. |
gusset | Presses gussets across a cylindrical bend to stiffen it, at positions along the bend. |
hem | Folds a straight edge of a region back over the sheet as a hem: closed flat on it, open with a gap, a teardrop, a rolled edge or a double hem that hides the raw edge. |
insideEdgeNearest | Picks the edge of a region's inside face whose middle lies nearest a point, the edge a flange, a hem or a join starts from. |
insideEdgeToward | Picks the edge of a region's inside face that lies furthest along a direction, judged by its middle; where several lie as far, the longest. |
insideFace | Picks a region's inside face by the region's name: the face its flanges, hems, folds and cuts start from. |
join | Joins two plates drawn where they lie with one bend between them: cylindrical, or conical where endRadius differs from bendRadius. |
lance | Cuts a tongue free on three sides of a hinge line and bends it out of the region, as a lanced tab. |
loft | Starts a part as a lofted flange between two profiles, such as a square-to-round transition. |
outsideFace | Picks a region's outside face by the region's name: the face across the thickness from its inside face. |
plate | Starts a sheet metal part from a flat face, given its thickness. |
regionNames | Lists the names of a part's flat regions, in the order its record holds them, to pick faces and edges by. |
rip | Rips a slot gap wide through a region along a line, in from its outline or a hole. |
ripEdge | Rips two regions apart along the edge where they meet, splitting the corner on its miter. |
roundCorners | Rounds or bevels the blank corners of a region's outline: the edges through the thickness where two of its sides meet. |
sweep | Starts a part by carrying an open profile of straight lines along a path of straight segments, its runs meeting mitered at each corner of the path. |
tab | Adds a flat face drawn on a region's plane to the region as a tab of the sheet's thickness. |
transform | Moves, turns or mirrors a part together with its record, as a pattern's copy or a mirrored twin needs. |
