Bitbybit Docs
    Preparing search index...

    Class JSCADExtrusions

    Turning flat JSCAD shapes into solids: straight extrusion along Z with an optional twist, a wall built along an outline, and revolution around the Z axis. Every flat shape lies in the XY plane, so the result grows out of that plane along Z.

    Index

    Constructors

    extrude

    • Extrudes a flat 2D shape straight along Z by height into a solid, twisting it on the way when twistAngle is not zero.

      twistAngle in degrees turns the top relative to the bottom around Z and twistSteps is the number of slices used for it, at least 1. A negative height extrudes downward.

      Parameters

      • inputs: ExtrudeLinearDto

        The 2D shape, the height, the twist angle and the twist steps

      Returns Promise<JSCADEntity>

      The extruded solid

      const square = await bitbybit.jscad.polygon.square({ center: [0, 0], size: 10 });
      const twisted = await bitbybit.jscad.extrusions.extrudeLinear({ geometry: square, height: 20, twistAngle: 90, twistSteps: 15 });
    • Builds a wall along the outline of a 2D shape or path: the outline is thickened by size on each side and raised by height along Z.

      The wall stands on the XY plane and is twice size thick, centered on the outline; the inside of a 2D shape stays empty. A list of inputs gives a list of walls.

      Parameters

      Returns Promise<JSCADEntity>

      The wall as a solid

      const circle = await bitbybit.jscad.polygon.circle({ center: [0, 0], radius: 10, segments: 32 });
      const ring = await bitbybit.jscad.extrusions.extrudeRectangular({ geometry: circle, height: 5, size: 0.5 });
    • Builds a wall along a polyline of points, as extrudeRectangular does for a path: the line is thickened by size on each side and raised by height along Z.

      Only the X and Y coordinates of the points are used and repeated consecutive points are dropped.

      Parameters

      Returns Promise<JSCADEntity>

      The wall as a solid

      const wall = await bitbybit.jscad.extrusions.extrudeRectangularPoints({ points: [[0, 0, 0], [10, 0, 0], [10, 10, 0]], height: 5, size: 0.5 });
      
    • Revolves a flat 2D shape around the Z axis into a solid.

      The shape lies in the XY plane, so its X coordinate is its distance from the axis, and a shape crossing the axis is clipped there. angle and startAngle are in degrees, 360 makes a full ring, and segments counts the steps of a full turn.

      Parameters

      • inputs: ExtrudeRotateDto

        The 2D shape, the sweep angle, the start angle and the segment count

      Returns Promise<JSCADEntity>

      The revolved solid

      const profile = await bitbybit.jscad.polygon.circle({ center: [10, 0], radius: 3, segments: 24 });
      const ring = await bitbybit.jscad.extrusions.extrudeRotate({ polygon: profile, angle: 360, startAngle: 0, segments: 48 });