Bitbybit Docs
    Preparing search index...

    Class OCCTSketch

    Drawing flat outlines with a pen: a start point and a list of moves (lines, arcs, Bezier curves, rounded and beveled corners) become one exact wire, or a face when the outline closes, in the plane of a frame. commands makes the moves one at a time; stroke and hull outline wires and wrap shapes. A sketch's x axis is the frame's direction and its y axis the normal crossed with it.

    Index

    Constructors

    Properties

    draw

    outline

    Constructors

    Properties

    draw

    • Draws an outline with a pen, from a start point through a list of moves, in a frame's plane.

      Each command draws on from where the previous one ended, and lines and arcs come out as exact lines and circles. makeFace turns a closed outline into a face facing along the frame's normal; one that crosses itself is refused.

      Parameters

      • inputs: SketchPenDto

        The commands, the start point, the frame and whether to make a face

      Returns Promise<TopoDSShapePointer>

      The outline as a wire, or a face when makeFace is true

      const plate = await bitbybit.occt.sketch.pen({
      commands: [
      { type: "hLine", length: 40 },
      { type: "vLine", length: 10 },
      { type: "filletCorner", radius: 2 },
      { type: "tangentArc", to: [-10, 10], relative: true },
      { type: "close" },
      ],
      makeFace: true,
      });
    • Draws an outline as pen does and reports which edges each command drew, so later steps can find the edges and faces a command made by its id.

      Edges are numbered as shapes.edge.getEdges numbers them on the result. A command without an id is named by its position, and a command that drew nothing is left out.

      Parameters

      • inputs: SketchPenDto

        The commands, the start point, the frame and whether to make a face

      Returns Promise<SketchWithSegments<TopoDSShapePointer>>

      The outline and, per command, the edges it drew

      const drawn = await bitbybit.occt.sketch.penWithSegments({
      commands: [{ type: "hLine", id: "base", length: 40 }, { type: "vLine", id: "side", length: 10 }, { type: "close", id: "slope" }],
      makeFace: true,
      });
      console.log(drawn.segments.find(segment => segment.id === "slope")?.edges);

    outline

    • Outlines a wire as if it were drawn with a pen of a given width, in a frame's plane.

      Half of width lies to each side; cap finishes an open wire's ends and join its corners. A closed wire gives a ring: a face with one hole, or its two wires in a compound without makeFace.

      Parameters

      Returns Promise<TopoDSShapePointer>

      The outline as a face, or as a wire or compound of wires when makeFace is false

      const path = await bitbybit.occt.sketch.pen({ commands: [{ type: "hLine", length: 30 }, { type: "tangentArc", to: [10, 10], relative: true }] });
      const slot = await bitbybit.occt.sketch.stroke({ shape: path, width: 4, cap: Bit.Inputs.OCCT.strokeCapEnum.round });
    • Wraps vertices, straight edges and circular edges lying in a frame's plane in the tightest convex outline around them.

      The outline is exact: straight where it spans between shapes, following a circle where a circle or an arc bulges out. Other curves are refused, as are shapes off the frame's plane or circles tilted out of it.

      Parameters

      Returns Promise<TopoDSShapePointer>

      The hull as a face, or as a wire when makeFace is false

      const left = await bitbybit.occt.shapes.wire.createCircleWire({ radius: 5, center: [0, 0, 0], direction: [0, 1, 0] });
      const right = await bitbybit.occt.shapes.wire.createCircleWire({ radius: 2, center: [20, 0, 0], direction: [0, 1, 0] });
      const lever = await bitbybit.occt.sketch.hull({ shapes: [left, right] });