Bitbybit Docs
    Preparing search index...

    Class OCCTEdge

    Edges in OpenCascade: single curves between two vertices, straight, circular, elliptical or free-form. Build them from points and lines, as arcs, circles and ellipses, or as tangent constructions against circles; read them back as points, lengths, tangents and centers; and pick edges out of any shape. Edges join end to end into wires, which shapes.wire handles. Parameters along an edge run from 0 at its start to 1 at its end; angles are in degrees.

    Index

    Constructors

    constraint

    • Draws the straight lines from two points that just touch a circle, one tangent line from each point.

      positionResult keeps the solutions on one side of the circle or all of them, and circleRemainder adds the piece of the circle between the touching points.

      Parameters

      Returns Promise<TopoDSShapePointer[]>

      The tangent lines, and the circle piece when asked for

      const tangents = await bitbybit.occt.shapes.edge.constraintTanLinesFromTwoPtsToCircle({
      circle,
      point1: [20, 0, 0],
      point2: [-20, 0, 0],
      tolerance: 1e-7,
      positionResult: Bit.Inputs.OCCT.positionResultEnum.all,
      circleRemainder: Bit.Inputs.OCCT.circleInclusionEnum.none,
      });
    • Draws the two straight lines from a point that just touch a circle.

      positionResult keeps the solution on one side of the circle or both, and circleRemainder adds the piece of the circle between the touching points.

      Parameters

      Returns Promise<TopoDSShapePointer[]>

      The tangent lines, and the circle piece when asked for

      const tangents = await bitbybit.occt.shapes.edge.constraintTanLinesFromPtToCircle({
      circle,
      point: [20, 0, 0],
      tolerance: 1e-7,
      positionResult: Bit.Inputs.OCCT.positionResultEnum.all,
      circleRemainder: Bit.Inputs.OCCT.circleInclusionEnum.none,
      });
    • Draws the straight lines that just touch two circles at once, like a belt around two pulleys.

      positionResult keeps the lines on one side or all of them, and circleRemainders adds the outside or inside pieces of the circles between the touching points, which completes the belt shape.

      Parameters

      Returns Promise<TopoDSShapePointer[]>

      The tangent lines, and the circle pieces when asked for

      const belt = await bitbybit.occt.shapes.edge.constraintTanLinesOnTwoCircles({
      circle1,
      circle2,
      tolerance: 1e-7,
      positionResult: Bit.Inputs.OCCT.positionResultEnum.all,
      circleRemainders: Bit.Inputs.OCCT.twoCircleInclusionEnum.outside,
      });

    debug

    • Collects diagnostic facts about the curve of an edge: its type and degree, control point and knot counts, whether it is rational, periodic or closed, its parameter range and period, its length and its end points.

      Parameters

      Returns Promise<EdgeDebugInfo>

      The report about the edge's curve

      const info = await bitbybit.occt.shapes.edge.debugInfo({ shape: edge });
      

    extract

    • Finds the point a fraction of the way along an edge: 0 is the start, 1 the end, 0.5 the middle of the parameter range.

      The fraction follows the curve's own parameter, which for a free-form curve is not evenly spread by length; use pointOnEdgeAtLength for a distance.

      Parameters

      Returns Promise<Point3>

      The point on the edge

      const middle = await bitbybit.occt.shapes.edge.pointOnEdgeAtParam({ shape: edge, param: 0.5 });
      
    • Turns every edge of a shape into a run of points that follows its curve closely enough to draw it, one list per edge.

      The deflection settings say how tightly the points hug curved edges; a wire's edges come in their order along the wire.

      Parameters

      Returns Promise<Point3[][]>

      One list of points per edge

      const polylines = await bitbybit.occt.shapes.edge.edgesToPoints({
      shape: wire,
      angularDeflection: 0.1,
      curvatureDeflection: 0.1,
      minimumOfPoints: 2,
      uTolerance: 1e-9,
      minimumLength: 1e-7,
      });
    • Finds the direction the edge is heading at a fraction of the way along it, from 0 at the start to 1 at the end.

      Parameters

      Returns Promise<Vector3>

      The tangent direction

      const tangent = await bitbybit.occt.shapes.edge.tangentOnEdgeAtParam({ shape: arc, param: 0.5 });
      
    • Finds the direction each edge in a list is heading at the same fraction along it.

      Parameters

      Returns Promise<Point3[]>

      One tangent per edge, in the same order

      const tangents = await bitbybit.occt.shapes.edge.tangentsOnEdgesAtParam({ shapes: edges, param: 0.5 });
      
    • Finds the point a given distance along an edge from its start, measured along the curve in model units.

      Parameters

      Returns Promise<Point3>

      The point on the edge

      const point = await bitbybit.occt.shapes.edge.pointOnEdgeAtLength({ shape: edge, length: 2.5 });
      
    • Finds the point at the same distance from the start along each edge in a list.

      Parameters

      Returns Promise<Point3[]>

      One point per edge, in the same order

      const points = await bitbybit.occt.shapes.edge.pointsOnEdgesAtLength({ shapes: edges, length: 2.5 });
      
    • Finds the direction the edge is heading at a given distance along it from its start, measured along the curve.

      Parameters

      Returns Promise<Vector3>

      The tangent direction

      const tangent = await bitbybit.occt.shapes.edge.tangentOnEdgeAtLength({ shape: arc, length: 2.5 });
      
    • Finds the direction each edge in a list is heading at the same distance from its start.

      Parameters

      Returns Promise<Vector3[]>

      One tangent per edge, in the same order

      const tangents = await bitbybit.occt.shapes.edge.tangentsOnEdgesAtLength({ shapes: edges, length: 2.5 });
      
    • Reads the point where an edge starts, in the edge's own direction.

      Parameters

      Returns Promise<Point3>

      The start point

      const start = await bitbybit.occt.shapes.edge.startPointOnEdge({ shape: edge });
      
    • Reads the start point of each edge in a list.

      Parameters

      Returns Promise<Point3[]>

      One start point per edge, in the same order

      const starts = await bitbybit.occt.shapes.edge.startPointsOnEdges({ shapes: edges });
      
    • Reads the point where an edge ends, in the edge's own direction.

      Parameters

      Returns Promise<Point3>

      The end point

      const end = await bitbybit.occt.shapes.edge.endPointOnEdge({ shape: edge });
      
    • Reads the end point of each edge in a list.

      Parameters

      Returns Promise<Point3[]>

      One end point per edge, in the same order

      const ends = await bitbybit.occt.shapes.edge.endPointsOnEdges({ shapes: edges });
      
    • Places points along an edge at equal steps of its parameter, from start to end.

      nrOfDivisions steps give one more point than that; removeStartPoint and removeEndPoint drop the ends. On a free-form curve equal parameter steps are not equal distances; use divideEdgeByEqualDistanceToPoints for those.

      Parameters

      Returns Promise<Point3[]>

      The points along the edge, in order

      const points = await bitbybit.occt.shapes.edge.divideEdgeByParamsToPoints({ shape: edge, nrOfDivisions: 10, removeStartPoint: false, removeEndPoint: false });
      
    • Places points along each edge in a list at equal steps of its parameter, one list per edge.

      Parameters

      Returns Promise<Point3[][]>

      One list of points per edge, in the same order

      const points = await bitbybit.occt.shapes.edge.divideEdgesByParamsToPoints({ shapes: edges, nrOfDivisions: 10, removeStartPoint: false, removeEndPoint: false });
      
    • Places points along an edge at equal distances measured along its curve, from start to end.

      nrOfDivisions steps give one more point than that; removeStartPoint and removeEndPoint drop the ends.

      Parameters

      Returns Promise<Point3[]>

      The points along the edge, in order

      const points = await bitbybit.occt.shapes.edge.divideEdgeByEqualDistanceToPoints({ shape: edge, nrOfDivisions: 10, removeStartPoint: false, removeEndPoint: false });
      
    • Places points along each edge in a list at equal distances along its curve, one list per edge.

      Parameters

      Returns Promise<Point3[][]>

      One list of points per edge, in the same order

      const points = await bitbybit.occt.shapes.edge.divideEdgesByEqualDistanceToPoints({ shapes: edges, nrOfDivisions: 10, removeStartPoint: false, removeEndPoint: false });
      

    from

    from base

    • Makes a straight edge from a line object of the form { start, end }.

      Parameters

      Returns Promise<TopoDSEdgePointer>

      The straight edge

      const edge = await bitbybit.occt.shapes.edge.fromBaseLine({ line: { start: [0, 0, 0], end: [10, 0, 0] } });
      
    • Makes one straight edge per line object of the form { start, end }.

      Parameters

      Returns Promise<TopoDSEdgePointer[]>

      One edge per line, in the same order

      const edges = await bitbybit.occt.shapes.edge.fromBaseLines({ lines: [{ start: [0, 0, 0], end: [10, 0, 0] }, { start: [10, 0, 0], end: [10, 10, 0] }] });
      
    • Makes a straight edge from a segment, a pair of points [start, end].

      Parameters

      Returns Promise<TopoDSEdgePointer>

      The straight edge

      const edge = await bitbybit.occt.shapes.edge.fromBaseSegment({ segment: [[0, 0, 0], [10, 0, 0]] });
      
    • Makes one straight edge per segment, each a pair of points [start, end].

      Parameters

      Returns Promise<TopoDSEdgePointer[]>

      One edge per segment, in the same order

      const edges = await bitbybit.occt.shapes.edge.fromBaseSegments({ segments: [[[0, 0, 0], [10, 0, 0]], [[10, 0, 0], [10, 10, 0]]] });
      
    • Joins each point to the next with a straight edge, so a list of points becomes a chain of edges.

      The edges are returned loose; shapes.wire.createPolylineWire makes the joined wire directly.

      Parameters

      Returns Promise<TopoDSEdgePointer[]>

      One edge per pair of neighboring points

      const edges = await bitbybit.occt.shapes.edge.fromPoints({ points: [[0, 0, 0], [10, 0, 0], [10, 10, 0]] });
      
    • Makes one straight edge per segment of a polyline object; a closed polyline also gets the edge from its last point back to its first.

      Parameters

      Returns Promise<TopoDSEdgePointer[]>

      One edge per segment, in order

      const edges = await bitbybit.occt.shapes.edge.fromBasePolyline({ polyline: { points: [[0, 0, 0], [10, 0, 0], [10, 10, 0]], isClosed: true } });
      
    • Makes the three straight edges of a triangle given as three points.

      Parameters

      Returns Promise<TopoDSEdgePointer[]>

      Its three edges

      const edges = await bitbybit.occt.shapes.edge.fromBaseTriangle({ triangle: [[0, 0, 0], [10, 0, 0], [0, 10, 0]] });
      
    • Makes the three straight edges of every triangle of a mesh, all in one flat list.

      A triangle whose edges cannot be built is skipped with a warning rather than stopping the rest.

      Parameters

      Returns Promise<TopoDSEdgePointer[]>

      The edges of all the triangles

      const edges = await bitbybit.occt.shapes.edge.fromBaseMesh({ mesh: triangles });
      

    get

    • Picks one edge out of a shape by its position, counting from 0, in the order the kernel walks the shape.

      The shape must be an edge, a wire or something built from them; an index beyond the last edge throws an error.

      Parameters

      Returns Promise<TopoDSEdgePointer>

      The edge at that index

      const first = await bitbybit.occt.shapes.edge.getEdge({ shape: wire, index: 0 });
      
    • Lists every edge of a shape in the order the kernel walks it, which is not the order along a wire; use getEdgesAlongWire for that.

      Parameters

      Returns Promise<TopoDSEdgePointer[]>

      The edges found in the shape

      const edges = await bitbybit.occt.shapes.edge.getEdges({ shape: box });
      
    • Lists the edges of a wire in the order they follow each other along it, each oriented to run in the wire's direction.

      A single edge is returned as a one-element list.

      Parameters

      Returns Promise<TopoDSEdgePointer[]>

      Its edges in order along the wire

      const ordered = await bitbybit.occt.shapes.edge.getEdgesAlongWire({ shape: wire });
      
    • Lists only the circular edges of a wire, in the order they follow each other along it.

      Parameters

      Returns Promise<TopoDSEdgePointer[]>

      Its circular edges in order

      const arcs = await bitbybit.occt.shapes.edge.getCircularEdgesAlongWire({ shape: roundedRectangle });
      
    • Lists only the straight edges of a wire, in the order they follow each other along it.

      Parameters

      Returns Promise<TopoDSEdgePointer[]>

      Its straight edges in order

      const straights = await bitbybit.occt.shapes.edge.getLinearEdgesAlongWire({ shape: roundedRectangle });
      
    • Lists the end points of every edge of a shape, with repeats removed, so a corner where several edges meet appears once.

      The points come in no particular order.

      Parameters

      Returns Promise<Point3[]>

      The unique end points of the edges

      const corners = await bitbybit.occt.shapes.edge.getCornerPointsOfEdgesForShape({ shape: box });
      
    • Measures the length of an edge along its curve, in model units.

      Parameters

      Returns Promise<number>

      The length

      const len = await bitbybit.occt.shapes.edge.getEdgeLength({ shape: edge });
      
    • Measures every edge of a shape along its curve, in model units.

      Parameters

      Returns Promise<number[]>

      One length per edge, in the order getEdges lists them

      const lengths = await bitbybit.occt.shapes.edge.getEdgeLengthsOfShape({ shape: box });
      
    • Measures each edge in a list along its curve, in model units.

      Parameters

      Returns Promise<number[]>

      One length per edge, in the same order

      const lengths = await bitbybit.occt.shapes.edge.getEdgesLengths({ shapes: edges });
      
    • Finds the center of mass of an edge, the balance point of its curve; for a straight edge that is its midpoint, for an arc a point inside the curve.

      Parameters

      Returns Promise<Point3>

      The center of mass point

      const center = await bitbybit.occt.shapes.edge.getEdgeCenterOfMass({ shape: edge });
      
    • Finds the center of mass of each edge in a list.

      Parameters

      Returns Promise<Point3[]>

      One point per edge, in the same order

      const centers = await bitbybit.occt.shapes.edge.getEdgesCentersOfMass({ shapes: edges });
      

    get circular edge

    • Finds the center of the circle a circular edge lies on.

      An edge that is not circular throws an error.

      Parameters

      Returns Promise<Point3>

      The center point

      const center = await bitbybit.occt.shapes.edge.getCircularEdgeCenterPoint({ shape: arc });
      
    • Reads the radius of the circle a circular edge lies on.

      An edge that is not circular throws an error.

      Parameters

      Returns Promise<number>

      The radius in model units

      const radius = await bitbybit.occt.shapes.edge.getCircularEdgeRadius({ shape: arc });
      
    • Reads the normal of the plane a circular edge lies in.

      An edge that is not circular throws an error.

      Parameters

      Returns Promise<Vector3>

      The unit normal of the circle's plane

      const normal = await bitbybit.occt.shapes.edge.getCircularEdgePlaneDirection({ shape: arc });
      

    is

    • Tells whether an edge is a straight line.

      Parameters

      Returns Promise<boolean>

      True when the edge is straight

      const straight = await bitbybit.occt.shapes.edge.isEdgeLinear({ shape: edge });
      
    • Tells whether an edge lies on a circle, whether a full circle or an arc.

      Parameters

      Returns Promise<boolean>

      True when the edge is circular

      const round = await bitbybit.occt.shapes.edge.isEdgeCircular({ shape: edge });
      

    primitives

    • Makes a straight edge between two points, the simplest edge there is.

      Parameters

      Returns Promise<TopoDSEdgePointer>

      The straight edge

      const edge = await bitbybit.occt.shapes.edge.line({ start: [0, 0, 0], end: [10, 0, 0] });
      
    • Makes a circular arc that starts at the first point, passes through the middle one and ends at the last.

      Parameters

      Returns Promise<TopoDSEdgePointer>

      The arc edge

      const arc = await bitbybit.occt.shapes.edge.arcThroughThreePoints({ start: [0, 0, 0], middle: [5, 5, 0], end: [10, 0, 0] });
      
    • Makes a circular arc from one point to another that leaves the first point in a given direction.

      The tangent fixes the plane and the radius of the arc.

      Parameters

      Returns Promise<TopoDSEdgePointer>

      The arc edge

      const arc = await bitbybit.occt.shapes.edge.arcThroughTwoPointsAndTangent({ start: [0, 0, 0], tangentVec: [0, 1, 0], end: [10, 0, 0] });
      
    • Cuts an arc out of a circle edge between two points on it.

      sense picks which way round the circle the arc runs from the first point to the second.

      Parameters

      Returns Promise<TopoDSEdgePointer>

      The arc edge

      const arc = await bitbybit.occt.shapes.edge.arcFromCircleAndTwoPoints({ circle, start: [10, 0, 0], end: [0, 0, 10], sense: true });
      
    • Cuts an arc out of a circle edge between two angles, in degrees, measured around the circle from its own start.

      sense picks which way round the circle the arc runs from the first angle to the second.

      Parameters

      Returns Promise<TopoDSEdgePointer>

      The arc edge

      const quarter = await bitbybit.occt.shapes.edge.arcFromCircleAndTwoAngles({ circle, alphaAngle1: 0, alphaAngle2: 90, sense: true });
      
    • Cuts an arc out of a circle edge that starts at a point on the circle and spans a given angle, in degrees.

      sense picks which way round the circle the arc runs.

      Parameters

      Returns Promise<TopoDSEdgePointer>

      The arc edge

      const arc = await bitbybit.occt.shapes.edge.arcFromCirclePointAndAngle({ circle, point: [10, 0, 0], alphaAngle: 45, sense: true });
      
    • Makes a full circle as one closed edge, lying in the plane whose normal is direction.

      Parameters

      Returns Promise<TopoDSEdgePointer>

      The circle edge

      const circle = await bitbybit.occt.shapes.edge.createCircleEdge({ radius: 5, center: [0, 0, 0], direction: [0, 1, 0] });
      
    • Makes a full ellipse as one closed edge, lying in the plane whose normal is direction.

      radiusMajor must not be smaller than radiusMinor, or the kernel refuses the ellipse.

      Parameters

      Returns Promise<TopoDSEdgePointer>

      The ellipse edge

      const ellipse = await bitbybit.occt.shapes.edge.createEllipseEdge({ center: [0, 0, 0], direction: [0, 1, 0], radiusMinor: 3, radiusMajor: 6 });
      

    rebuild

    • Rebuilds the curve of an edge as a B-spline of a given degree, within a tolerance.

      Lowering the degree simplifies the curve, raising it gives later operations more freedom; either way the new curve stays within tolerance of the old.

      Parameters

      Returns Promise<TopoDSEdgePointer>

      A new edge with the rebuilt curve

      const simpler = await bitbybit.occt.shapes.edge.rebuildEdgeDegree({ shape: edge, degree: 3, tolerance: 1e-3 });
      

    seam

    • Moves the seam of a closed periodic edge, the point where it starts and ends, to a given parameter along the curve.

      The geometry does not change; only where the edge is considered to begin.

      Parameters

      Returns Promise<TopoDSEdgePointer>

      A new edge starting at the seam

      const rotated = await bitbybit.occt.shapes.edge.moveEdgeSeamByParameter({ shape: circle, parameter: 1.57 });
      
    • Moves the seam of a closed periodic edge, the point where it starts and ends, by a distance along the curve from its current start.

      The geometry does not change; only where the edge is considered to begin.

      Parameters

      Returns Promise<TopoDSEdgePointer>

      A new edge starting at the seam

      const rotated = await bitbybit.occt.shapes.edge.moveEdgeSeamByLength({ shape: circle, length: 2.5 });
      

    shapes

    • Merges faces that lie on the same surface and edges on the same curve, which removes the internal seams a boolean or a fuse leaves behind.

      It is shapes.shape.unifySameDomain with edges and faces both unified and B-splines left as they are.

      Parameters

      Returns Promise<TopoDSShapePointer>

      The shape without internal seams

      const clean = await bitbybit.occt.shapes.edge.removeInternalEdges({ shape: fused });