Moving and checking
A part's record describes its regions where they are, with frames and bend axes in model coordinates. Moving the solid alone would leave the record behind, so a part is moved with its own operation. And because a part's record only stays true while every change goes through the sheet metal operations, there is one more operation that tells you whether it still is.
Moving and mirroring a part
bitbybit.occt.fabrication.sheetMetal.transform moves, turns or mirrors a part by a matrix, and carries the record's frames and bend axes with it, so the result is a part like the one it was given and takes every operation after. A matrix that scales is refused, since it would change the thickness.


- Rete
- Blockly
- TypeScript
const { sheetMetal } = bitbybit.occt.fabrication;
const blank = await bitbybit.occt.shapes.face.createPolygonFace({ points: [[20, 0, 10], [80, 0, 30], [80, 0, -30], [20, 0, -30]] });
let bracket = await sheetMetal.plate({ face: blank, thickness: 2, bendRadius: 2, name: "foot" });
bracket = await sheetMetal.flange({
part: bracket,
insideFace: await sheetMetal.insideFace({ part: bracket, region: "foot" }),
edge: await sheetMetal.insideEdgeToward({ part: bracket, region: "foot", direction: [1, 0, 0] }),
length: 40,
name: "upright",
});
const mirror = await bitbybit.occt.transforms.mirrorPlaneToMatrix({ origin: [0, 0, 0], normal: [1, 0, 0] });
const twin = await sheetMetal.transform({ part: bracket, transformation: mirror });
const shift = await bitbybit.occt.transforms.translationToMatrix({ translation: [0, 0, 90] });
const copy = await sheetMetal.transform({ part: bracket, transformation: shift });
console.log(await sheetMetal.check({ part: twin }));
await bitbybit.draw.drawAnyAsync({ entity: [bracket, twin, copy], options: bitbybit.draw.optionsOcctSheet({}) });
bitbybit.babylon.scene.adjustActiveArcRotateCamera({ position: [198, 196, -192], lookAt: [0, 18, 45] });
The bracket's foot is slanted, so it has a hand: mirrored across the plane x = 0 with bitbybit.occt.transforms.mirrorPlaneToMatrix, it becomes its left-and-right twin, the part a pair of brackets is made of. The second copy is moved 90 along z with bitbybit.occt.transforms.translationToMatrix. Any column-major 4 x 4 matrix of 16 numbers works, or a list of them applied first to last.
A mirror keeps which face is inside, so every bend keeps its direction, angle and radius; the twin above checks as a sheet. A moved part has no roles, since the move made no new faces. Each copy is a part of its own with its own record: a pattern of parts is one call per copy.
Checking a part
bitbybit.occt.fabrication.sheetMetal.check reports whether a part and its record still make a sheet: one valid solid of one thickness that its record describes, with nothing added to or taken from its layers. It reports rather than refuses, in three fields:
isSheet, the answer.problems, one sentence each, naming every region, bend or face that is no longer what the record says, or that touches another where the sheet does not join them. When the shape's faces no longer match the record at all, as after a boolean, it is one problem that says so.warnings, notes that leave it a sheet: a bend tighter than the part'sminimumRadius, a K-factor above 0.5.


- Rete
- Blockly
- TypeScript
const { sheetMetal } = bitbybit.occt.fabrication;
const blank = await bitbybit.occt.shapes.face.createRectangleFace({ width: 100, length: 60, center: [0, 0, 0], direction: [0, 1, 0] });
let part = await sheetMetal.plate({ face: blank, thickness: 2, bendRadius: 2, minimumRadius: 3, 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: "wall",
});
console.log(await sheetMetal.check({ part }));
const boss = await bitbybit.occt.shapes.solid.createCylinder({ radius: 8, height: 10, center: [-20, 0, 0], direction: [0, 1, 0] });
const fused = await bitbybit.occt.booleans.union({ shapes: [part.shape, boss] });
console.log(await sheetMetal.check({ part: { ...part, shape: fused } }));
await bitbybit.draw.drawAnyAsync({ entity: fused });
bitbybit.babylon.scene.adjustActiveArcRotateCamera({ position: [107, 109, -128], lookAt: [0, 13, 0] });
The first check runs on a flanged plate whose bends are tighter than the minimumRadius of 3 it was given: it is a sheet, with two warnings, one for the sheet's bend radius and one for the bend wall.b1. Then a boss is fused onto the part's shape with an ordinary boolean, outside the sheet metal operations, and the record is no longer true. The fused solid has a different set of faces, numbered afresh, so the second check finds the record no longer matches the shape and says so in one problem, with the first face it found out of place and the likely cause:
the record does not match the shape: 3 of the 8 faces it names are not where it says (region wall's inside face 10 does not lie on the region's plane); a shape changed outside the sheet operations, by a boolean for one, numbers its faces anew
It is one problem rather than one for each region and bend, since every one of them would have the same cause.
A part in that state cannot be drawn in its looks either. The sheet drawing options, colorByKind and bendLines all read the record, and each refuses a part whose record no longer matches its shape: "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." That is why the example draws the fused solid as a plain shape.
Run check as the last step of every part, and after anything done to part.shape with the rest of OCCT. When it reports problems, make the change with a sheet metal operation instead: a boss on sheet metal is a form, a hole is a cut, an added piece is a tab or a flange.
