Skip to main content

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 getFaces and getEdges list 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: filletEdges given 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":

Bitbybit Platform

Round only the upright edges in Rete

rete logoRete
Script Source (rete)
{
"id": "rete-v2-json",
"nodes": {
"box": {
"id": "box",
"name": "bitbybit.occt.shapes.solid.createBox",
"customName": "box",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"width": 4,
"length": 4,
"height": 4,
"center": [
0,
0,
0
],
"originOnCenter": true
},
"inputs": {},
"position": [
40,
40
]
},
"upright": {
"id": "upright",
"name": "bitbybit.occt.select.edges.along",
"customName": "edges along",
"async": true,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"direction": [
0,
1,
0
],
"angle": 0
},
"inputs": {
"shape": {
"connections": [
{
"node": "box",
"output": "result",
"data": {}
}
]
}
},
"position": [
460,
40
]
},
"fillet": {
"id": "fillet",
"name": "bitbybit.occt.fillets.filletEdges",
"customName": "fillet edges",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"radius": 1
},
"inputs": {
"shape": {
"connections": [
{
"node": "box",
"output": "result",
"data": {}
}
]
},
"indexes": {
"connections": [
{
"node": "upright",
"output": "result",
"data": {}
}
]
}
},
"position": [
880,
40
]
}
},
"modules": {}
}

Faces​

RuleChooses the faces
facingwhose normal points within an angle of a direction
onPlanelying in a plane
ofTypeof a kind of surface: flat, cylindrical, conical, spherical and so on
byRadius, bySizeby the radius of a curved face, or by area
inBox, inSphere, nearestby where they lie
extremefurthest along a direction, such as the top or the bottom
adjacentTo, ofEdgesbeside chosen faces, or around chosen edges
sortAlong, groupAlongordered, or grouped in layers, along a direction

Edges​

RuleChooses the edges
alongstraight, running within an angle of a direction
onPlanelying in a plane
ofTypeof a kind of curve: line, circle, ellipse, B-spline
byLength, byRadiusby length, or by the radius of a circular edge
convex, concaveoutside corners, or inside corners
between, ofFaceswhere two sets of faces meet, or around chosen faces
tangentChainan edge and every edge that continues it smoothly
inBox, inSphere, nearest, extremeby where they lie
sortAlong, groupAlongordered, or grouped, along a direction

Every rule​

FunctionWhat it does
edges.alongChooses 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.betweenChooses 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.byLengthChooses the edges whose length lies between min and max, both included.
edges.byRadiusChooses the circular edges whose radius lies between min and max, both included.
edges.concaveChooses 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.convexChooses 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.extremeChooses the edges whose centres lie furthest along direction, with any others within tolerance of them: the edges round the top along z.
edges.groupAlongSorts 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.inBoxChooses the edges whose centres lie inside a box lined up with the axes, given by two opposite corners in either order.
edges.inSphereChooses the edges whose centres lie within radius of center.
edges.nearestChooses the count edges whose centres lie nearest point, nearest first; edges as near as each other keep their order.
edges.ofFacesChooses the edges that bound any of the given faces, counted as shapes.face.getFaces counts them.
edges.ofTypeChooses 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.onPlaneChooses 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.sortAlongOrders edges by how far along direction their centres lie, from the lowest to the highest; edges level with each other keep their order.
edges.tangentChainGrows 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.adjacentToChooses the faces that share an edge with any of the given faces, leaving out the given faces themselves.
faces.byRadiusChooses 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.bySizeChooses the faces whose area lies between min and max, both included.
faces.extremeChooses 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.facingChooses 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.groupAlongSorts 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.inBoxChooses the faces whose centres lie inside a box lined up with the axes, given by two opposite corners in either order.
faces.inSphereChooses the faces whose centres lie within radius of center.
faces.nearestChooses the count faces whose centres lie nearest point, nearest first; faces as near as each other keep their order.
faces.ofEdgesChooses the faces bounded by any of the given edges, counted as shapes.edge.getEdges counts them: the two faces that meet along each.
faces.ofTypeChooses 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.onPlaneChooses 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.sortAlongOrders faces by how far along direction their centres lie, from the lowest to the highest; faces level with each other keep their order.