Bitbybit Docs
    Preparing search index...

    Class OCCTSelectFaces

    Choosing the faces of an OpenCascade shape by what they are and where they lie, so that "the top face" still names the right face after a parameter changes. Every method returns face indexes as shapes.face.getFaces counts them, from 0, which the getters and the other selectors take as they are. indexes limits a filter to faces chosen before, keeping their order; left out, every face is a candidate, and an empty list chooses nothing. Positions are read at each face's centre of mass.

    Index

    Constructors

    by geometry

    • 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.

      Parameters

      Returns Promise<number[]>

      The indexes of the chosen faces

      const walls = await bitbybit.occt.select.faces.ofType({ shape: part, type: Bit.Inputs.OCCT.surfaceTypeEnum.cylinder });
      
    • 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.

      Parameters

      Returns Promise<number[]>

      The indexes of the chosen faces

      const up = await bitbybit.occt.select.faces.facing({ shape: part, direction: [0, 0, 1], angle: 0 });
      
    • Chooses the faces whose area lies between min and max, both included.

      Parameters

      Returns Promise<number[]>

      The indexes of the chosen faces

      const small = await bitbybit.occt.select.faces.bySize({ shape: part, min: 0, max: 10 });
      
    • 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.

      Parameters

      Returns Promise<number[]>

      The indexes of the chosen faces

      const holes = await bitbybit.occt.select.faces.byRadius({ shape: part, min: 1.9, max: 2.1 });
      

    by position

    • 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.

      Parameters

      Returns Promise<number[]>

      The indexes of the chosen faces

      const top = await bitbybit.occt.select.faces.extreme({ shape: part, direction: [0, 0, 1], tolerance: 1e-7 });
      
    • Chooses the faces whose centres lie inside a box lined up with the axes, given by two opposite corners in either order.

      Parameters

      Returns Promise<number[]>

      The indexes of the chosen faces

      const near = await bitbybit.occt.select.faces.inBox({ shape: part, corner: [0, 0, 9], oppositeCorner: [10, 10, 11] });
      
    • Chooses the faces whose centres lie within radius of center.

      Parameters

      Returns Promise<number[]>

      The indexes of the chosen faces

      const around = await bitbybit.occt.select.faces.inSphere({ shape: part, center: [5, 5, 10], radius: 2 });
      
    • Chooses the count faces whose centres lie nearest point, nearest first; faces as near as each other keep their order.

      Parameters

      Returns Promise<number[]>

      The indexes of the chosen faces, nearest first

      const [picked] = await bitbybit.occt.select.faces.nearest({ shape: part, point: [5, 5, 12], count: 1 });
      
    • 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.

      Parameters

      Returns Promise<number[]>

      The indexes of the chosen faces

      const bottom = await bitbybit.occt.select.faces.onPlane({ shape: part, origin: [0, 0, 0], normal: [0, 0, 1] });
      

    by relation

    • Chooses the faces that share an edge with any of the given faces, leaving out the given faces themselves.

      Parameters

      Returns Promise<number[]>

      The indexes of the neighbouring faces, in order

      const sides = await bitbybit.occt.select.faces.adjacentTo({ shape: part, indexes: [5] });
      
    • Chooses the faces bounded by any of the given edges, counted as shapes.edge.getEdges counts them: the two faces that meet along each.

      Parameters

      Returns Promise<number[]>

      The indexes of the faces, in order

      const beside = await bitbybit.occt.select.faces.ofEdges({ shape: part, indexes: [0] });
      

    order

    • Orders faces by how far along direction their centres lie, from the lowest to the highest; faces level with each other keep their order.

      Parameters

      Returns Promise<number[]>

      The indexes of the faces, sorted

      const bottomToTop = await bitbybit.occt.select.faces.sortAlong({ shape: part, direction: [0, 0, 1] });
      
    • 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.

      Parameters

      Returns Promise<number[][]>

      One list of face indexes per level, from the lowest

      const levels = await bitbybit.occt.select.faces.groupAlong({ shape: part, direction: [0, 0, 1], tolerance: 0.01 });