Bitbybit Docs
    Preparing search index...

    Class OCCTSketchCommands

    Making the commands sketch.pen draws, one at a time: lines, circular arcs, Bezier curves, closing the outline, and rounding or beveling a corner. Each method returns one command as plain data, the same object a script can write by hand, so a list of them is what sketch.pen takes.

    Index

    Constructors

    arcs

    • Makes a command that draws a circular arc through one point to another.

      The arc turns whichever way takes it from where the pen is through through to to; the three points must not lie on one line.

      Parameters

      • inputs: SketchThreePointArcDto

        The point to pass through, the point to end at, whether they are relative and the command's id

      Returns Promise<SketchCommand>

      The command

      const crown = await bitbybit.occt.sketch.commands.threePointArc({ through: [10, 4], to: [20, 0] });
      
    • Makes a command that draws a circular arc to a point, leaving in the direction the previous segment ended in.

      It needs a segment before it. The arc's radius follows from where it ends; an end straight ahead is refused, as tangentLine draws that.

      Parameters

      Returns Promise<SketchCommand>

      The command

      const bend = await bitbybit.occt.sketch.commands.tangentArc({ to: [10, 10], relative: true });
      
    • Makes a command that draws a circular arc to a point, bowed out by a given distance.

      sagitta is how far the middle of the arc stands off the straight line to to: positive to the left of the direction of travel, negative to the right.

      Parameters

      • inputs: SketchSagittaArcDto

        The point to end at, the sagitta, whether the point is relative and the command's id

      Returns Promise<SketchCommand>

      The command

      const bow = await bitbybit.occt.sketch.commands.sagittaArc({ to: [20, 0], sagitta: 3 });
      
    • Makes a command that draws a circular arc to a point, given by its bulge as DXF files write arcs.

      bulge is the tangent of a quarter of the angle swept: positive turns counterclockwise, 1 draws a half circle and 0 is refused, being a straight line.

      Parameters

      • inputs: SketchBulgeArcDto

        The point to end at, the bulge, whether the point is relative and the command's id

      Returns Promise<SketchCommand>

      The command

      const half = await bitbybit.occt.sketch.commands.bulgeArc({ to: [-20, 0], bulge: 1, relative: true });
      

    corners

    • Makes a command that rounds the corner between the segment before it and the segment after it with an arc of a given radius.

      Placed after close, it rounds the corner at the start point. Only lines and circular arcs take a corner, and a radius too large for them is refused.

      Parameters

      Returns Promise<SketchCommand>

      The command

      const round = await bitbybit.occt.sketch.commands.filletCorner({ radius: 2 });
      
    • Makes a command that bevels the corner between the segment before it and the segment after it, cutting the same distance off each.

      distance is measured along each segment. Placed after close, it bevels the corner at the start point; only lines and circular arcs take a corner.

      Parameters

      Returns Promise<SketchCommand>

      The command

      const bevel = await bitbybit.occt.sketch.commands.chamferCorner({ distance: 1.5 });
      

    curves

    • Makes a command that draws a quadratic Bezier curve to a point, pulled toward a control point.

      With relative true, control and to are offsets from where the pen is.

      Parameters

      • inputs: SketchQuadraticDto

        The control point, the point to end at, whether they are relative and the command's id

      Returns Promise<SketchCommand>

      The command

      const sweep = await bitbybit.occt.sketch.commands.quadratic({ control: [10, 8], to: [20, 0] });
      
    • Makes a command that draws a cubic Bezier curve to a point, shaped by two control points.

      The curve leaves toward control1 and arrives from control2; with relative true all three points are offsets from where the pen is.

      Parameters

      • inputs: SketchCubicDto

        The two control points, the point to end at, whether they are relative and the command's id

      Returns Promise<SketchCommand>

      The command

      const wave = await bitbybit.occt.sketch.commands.cubic({ control1: [5, 10], control2: [15, -10], to: [20, 0] });
      

    lines

    • Makes a command that draws a straight segment to a point.

      to is a point in the sketch's x and y, or an offset from where the pen is when relative is true.

      Parameters

      • inputs: SketchLineDto

        The point to draw to, whether it is relative and the command's id

      Returns Promise<SketchCommand>

      The command

      const side = await bitbybit.occt.sketch.commands.line({ to: [0, 10], relative: true, id: "side" });
      const outline = await bitbybit.occt.sketch.pen({ commands: [side, { type: "hLine", length: 20 }] });
    • Makes a command that draws a straight segment along the sketch's x axis.

      A negative length draws in the negative x direction.

      Parameters

      Returns Promise<SketchCommand>

      The command

      const base = await bitbybit.occt.sketch.commands.hLine({ length: 40, id: "base" });
      
    • Makes a command that draws a straight segment along the sketch's y axis.

      A negative length draws in the negative y direction.

      Parameters

      Returns Promise<SketchCommand>

      The command

      const side = await bitbybit.occt.sketch.commands.vLine({ length: 10, id: "side" });
      
    • Makes a command that draws a straight segment of a given length at an angle.

      angle is in degrees from the sketch's x axis, counterclockwise; a negative length draws the opposite way.

      Parameters

      Returns Promise<SketchCommand>

      The command

      const slope = await bitbybit.occt.sketch.commands.polarLine({ length: 12, angle: 30 });
      
    • Makes a command that draws straight on in the direction the previous segment ended in.

      It needs a segment before it, and is how a straight run leaves an arc smoothly.

      Parameters

      Returns Promise<SketchCommand>

      The command

      const runOut = await bitbybit.occt.sketch.commands.tangentLine({ length: 15 });
      

    outline

    • Makes a command that closes the outline with a straight segment back to the start point.

      Only corner commands may follow it. When the pen is already at the start point it draws nothing and only closes the outline.

      Parameters

      Returns Promise<SketchCommand>

      The command

      const close = await bitbybit.occt.sketch.commands.close({ id: "back" });