Bitbybit Docs
    Preparing search index...

    Class JSCADText

    Writing text with JSCAD's built-in stroke font. createVectorText gives the pen strokes of the text as lists of 2D points in the XY plane; cylindricalText and sphericalText turn every stroke into a solid by chaining hulled cylinders or spheres along it, centered on the origin. The text height is the height of a capital letter in model units.

    Index

    Constructors

    text

    • Writes text as solids: every pen stroke becomes a chain of cylinders standing along Z, hulled together into one smooth solid, so a letter like A gives several solids.

      The strokes lie in the XY plane, centered on the origin, and the cylinders are extrusionHeight long with half above and half below the plane.

      Parameters

      • inputs: CylinderTextDto

        The text, the cylinder height and radius, the segment count and the font options

      Returns Promise<JSCADEntity[]>

      One solid per pen stroke

      const letters = await bitbybit.jscad.text.cylindricalText({ text: "Hello", extrusionHeight: 2, extrusionSize: 0.5, segments: 16, xOffset: 0, yOffset: 0, height: 10, lineSpacing: 1.4, letterSpacing: 1, align: Bit.Inputs.JSCAD.jscadTextAlignEnum.center, extrudeOffset: 0 });
      
    • Writes text as solids: every pen stroke becomes a chain of spheres hulled together into one rounded solid, so a letter like A gives several solids.

      The strokes lie in the XY plane, centered on the origin, and the spheres of radius sit on that plane.

      Parameters

      • inputs: SphereTextDto

        The text, the sphere radius, the segment count and the font options

      Returns Promise<JSCADEntity[]>

      One solid per pen stroke

      const letters = await bitbybit.jscad.text.sphericalText({ text: "Hello", radius: 0.5, segments: 16, xOffset: 0, yOffset: 0, height: 10, lineSpacing: 1.4, letterSpacing: 1, align: Bit.Inputs.JSCAD.jscadTextAlignEnum.center, extrudeOffset: 0 });
      
    • Writes text as pen strokes: each stroke is a list of 2D points in the XY plane, and a letter may take several.

      The text starts at xOffset, yOffset and is not centered; height is the height of a capital letter, lineSpacing and letterSpacing scale the gaps and align places the lines of a multi-line text.

      Parameters

      Returns Promise<Point2[][]>

      The strokes as lists of 2D points

      const strokes = await bitbybit.jscad.text.createVectorText({ text: "Hi", segments: 16, xOffset: 0, yOffset: 0, height: 10, lineSpacing: 1.4, letterSpacing: 1, align: Bit.Inputs.JSCAD.jscadTextAlignEnum.center, extrudeOffset: 0 });