Selecting faces and edges by rule
Fillets, chamfers, push-pull and face removal all work on chosen faces or edges, given as a list of indexes. bitbybit.occt.select finds those indexes for you from a rule, so the choice survives when the model changes. Picking faces and edges explains why that matters; this page lists the rules.
How the rules work
- Every rule takes the shape and returns a list of indexes, counted from 0 as
getFacesandgetEdgeslist them. - Every rule can narrow an earlier choice: give it
indexes, and it chooses only among those. Chain rules to say "the circular edges of the top face". - A rule that matches nothing returns an empty list. Check before you pass it on:
filletEdgesgiven no indexes rounds every edge.
Here the edges that run along Y are chosen and only they are rounded, which is the rule for "round the upright corners of a box":

- Rete
- Blockly
- TypeScript
const box = await bitbybit.occt.shapes.solid.createBox({ width: 4, length: 4, height: 4, center: [0, 0, 0] });
const upright = await bitbybit.occt.select.edges.along({ shape: box, direction: [0, 1, 0], angle: 0 });
const rounded = await bitbybit.occt.fillets.filletEdges({ shape: box, radius: 1, indexes: upright });
await bitbybit.draw.drawAnyAsync({ entity: rounded });
Faces
| Rule | Chooses the faces |
|---|---|
facing | whose normal points within an angle of a direction |
onPlane | lying in a plane |
ofType | of a kind of surface: flat, cylindrical, conical, spherical and so on |
byRadius, bySize | by the radius of a curved face, or by area |
inBox, inSphere, nearest | by where they lie |
extreme | furthest along a direction, such as the top or the bottom |
adjacentTo, ofEdges | beside chosen faces, or around chosen edges |
sortAlong, groupAlong | ordered, or grouped in layers, along a direction |
Edges
| Rule | Chooses the edges |
|---|---|
along | straight, running within an angle of a direction |
onPlane | lying in a plane |
ofType | of a kind of curve: line, circle, ellipse, B-spline |
byLength, byRadius | by length, or by the radius of a circular edge |
convex, concave | outside corners, or inside corners |
between, ofFaces | where two sets of faces meet, or around chosen faces |
tangentChain | an edge and every edge that continues it smoothly |
inBox, inSphere, nearest, extreme | by where they lie |
sortAlong, groupAlong | ordered, or grouped, along a direction |
Here byRadius picks the rims of four holes, the only circular edges of that radius, so the chamfer stays on them however the plate changes:

- Rete
- Blockly
- TypeScript
const plate = await bitbybit.occt.shapes.solid.createBox({ width: 10, length: 6, height: 1, center: [0, 0.5, 0] });
const top = bitbybit.frame.zx({ origin: [0, 1, 0] });
const grid = bitbybit.frame.grid({ frame: top, countX: 2, countY: 2, spacingX: 4, spacingY: 6, centered: true });
const drilled = await bitbybit.occt.features.holes({ shape: plate, frames: grid, diameter: 1 });
const rims = await bitbybit.occt.select.edges.byRadius({ shape: drilled, min: 0.4, max: 0.6 });
const chamfered = await bitbybit.occt.fillets.chamferEdges({ shape: drilled, distance: 0.15, indexes: rims });
await bitbybit.draw.drawAnyAsync({ entity: chamfered });
convex and concave read how the two faces at an edge meet, so they pick out a part's edges by what each one does, with no counting. On this bracket the one inside corner gets a round and the outside edges a chamfer. The second rule runs on the rounded shape, as the first step changes the edges:

- Rete
- Blockly
- TypeScript
const points = bitbybit.json.parse({ text: '[[0, 0, 0], [10, 0, 0], [10, 0, 2], [2, 0, 2], [2, 0, 8], [0, 0, 8]]' });
const outline = await bitbybit.occt.shapes.wire.createPolygonWire({ points });
const profile = await bitbybit.occt.shapes.face.createFaceFromWire({ shape: outline, planar: true });
const bracket = await bitbybit.occt.operations.extrude({ shape: profile, direction: [0, 6, 0] });
const inside = await bitbybit.occt.select.edges.concave({ shape: bracket });
const rounded = await bitbybit.occt.fillets.filletEdges({ shape: bracket, radius: 0.8, indexes: inside });
const outside = await bitbybit.occt.select.edges.convex({ shape: rounded });
const finished = await bitbybit.occt.fillets.chamferEdges({ shape: rounded, distance: 0.25, indexes: outside });
await bitbybit.draw.drawAnyAsync({ entity: finished });
bitbybit.babylon.scene.adjustActiveArcRotateCamera({ position: [20, 16, 22], lookAt: [4, 3, 3] });
Every rule
| Function | What it does |
|---|---|
edges.along | Chooses the straight edges that run within angle degrees of direction, either way along it: an angle of 0 finds the edges parallel to it. |
edges.between | Chooses the edges where a face of indexes meets a different face of otherIndexes, such as the edges round a top face where it meets the sides. |
edges.byLength | Chooses the edges whose length lies between min and max, both included. |
edges.byRadius | Chooses the circular edges whose radius lies between min and max, both included. |
edges.concave | Chooses the edges where two faces meet at an inside corner, the valleys a fillet fills; faces meeting within tangentAngle degrees of smooth count as neither. |
edges.convex | Chooses the edges where two faces meet at an outside corner, the ridges a fillet rounds off; faces meeting within tangentAngle degrees of smooth count as neither. |
edges.extreme | Chooses the edges whose centres lie furthest along direction, with any others within tolerance of them: the edges round the top along z. |
edges.groupAlong | Sorts edges along direction and groups them by level: a group ends where the next centre lies more than tolerance beyond the group's first. |
edges.inBox | Chooses the edges whose centres lie inside a box lined up with the axes, given by two opposite corners in either order. |
edges.inSphere | Chooses the edges whose centres lie within radius of center. |
edges.nearest | Chooses the count edges whose centres lie nearest point, nearest first; edges as near as each other keep their order. |
edges.ofFaces | Chooses the edges that bound any of the given faces, counted as shapes.face.getFaces counts them. |
edges.ofType | Chooses the edges that run along one kind of curve, such as the straight edges of a part or the circular rims of its holes. |
edges.onPlane | Chooses the edges that lie in a plane, given by a point on it and its normal: every point of an edge within tolerance of the plane. |
edges.sortAlong | Orders edges by how far along direction their centres lie, from the lowest to the highest; edges level with each other keep their order. |
edges.tangentChain | Grows the given edges into the chains they continue smoothly: two edges meeting where their tangents turn by no more than angle degrees are one chain, as a fillet runs along. |
faces.adjacentTo | Chooses the faces that share an edge with any of the given faces, leaving out the given faces themselves. |
faces.byRadius | Chooses the faces on cylinders and spheres whose radius lies between min and max, and the faces on tori whose tube radius does, the rounds a fillet makes along a curved edge. |
faces.bySize | Chooses the faces whose area lies between min and max, both included. |
faces.extreme | Chooses the faces whose centres lie furthest along direction, with any others within tolerance of them: the top faces along z, the lowest along minus z. |
faces.facing | Chooses the faces whose normal, read at the middle of each face, points within angle degrees of direction: an angle of 0 finds the faces looking straight that way. |
faces.groupAlong | Sorts faces along direction and groups them by level: a group ends where the next centre lies more than tolerance beyond the group's first. |
faces.inBox | Chooses the faces whose centres lie inside a box lined up with the axes, given by two opposite corners in either order. |
faces.inSphere | Chooses the faces whose centres lie within radius of center. |
faces.nearest | Chooses the count faces whose centres lie nearest point, nearest first; faces as near as each other keep their order. |
faces.ofEdges | Chooses the faces bounded by any of the given edges, counted as shapes.edge.getEdges counts them: the two faces that meet along each. |
faces.ofType | Chooses the faces that lie on one kind of surface, such as the planar faces of a part or the cylindrical walls of its holes. |
faces.onPlane | Chooses the planar faces that lie in a plane, given by a point on it and its normal; a face counts from either side, within tolerance. |
faces.sortAlong | Orders faces by how far along direction their centres lie, from the lowest to the highest; faces level with each other keep their order. |



