Bitbybit Docs
    Preparing search index...

    Class Draw

    Drawing anything into the scene: kernel shapes, points, lines, polylines, frames, curves, meshes and tags all go through drawAnyAsync, which picks the right renderer for the entity and returns the drawn object. The options methods build the drawing options with defaults for each kind of entity, createPBRMaterial and createTexture make materials for the face slots, and a drawn object can be redrawn in place by passing it back.

    Hierarchy (View Summary)

    Index

    Constructors

    • Returns Bit.Draw

    document options

    • Beta

      Builds the drawing options for an assembly document, as occt.assembly.manager.loadStepToDoc returns it: how it turns, how finely it is meshed, and whether its edges and its dimensions, tolerances and datums are drawn, with defaults for what is left out.

      Faces show the document's own colors, an uncolored part grey; the annotations occt.assembly.query.getDocumentAnnotations reads take these options too.

      Parameters

      Returns DrawOcctDocumentOptions

      The drawing options

      const document = await bitbybit.occt.assembly.manager.loadStepToDoc({ stepData });
      const meshing = bitbybit.draw.optionsMeshing({ precision: 0.05 });
      const annotations = bitbybit.draw.optionsAnnotations({ annotationColour: "#0047ab", annotationsFilled: true });
      const options = bitbybit.draw.optionsOcctDocument({ upAxis: Bit.Inputs.Base.upAxisConversionEnum.zUpToYUp, meshing, drawAnnotations: true, annotations });
      const drawn = await bitbybit.draw.drawAnyAsync({ entity: document, options });
    • Beta

      Builds how finely an assembly document is meshed for drawing, for the meshing of optionsOcctDocument, with defaults for what is left out.

      Parameters

      Returns DrawMeshingOptions

      The meshing settings

      const meshing = bitbybit.draw.optionsMeshing({ precision: 0.05, angularDeflection: 0.3 });
      const options = bitbybit.draw.optionsOcctDocument({ meshing });
    • Beta

      Builds the color, width and opacity of the edge lines, for the edges of optionsOcctDocument and optionsHatchedSection, with defaults for what is left out.

      Parameters

      Returns DrawEdgesOptions

      The edge settings

      const edges = bitbybit.draw.optionsEdges({ edgeColour: "#333333", edgeWidth: 1, edgeOpacity: 1 });
      const options = bitbybit.draw.optionsOcctDocument({ drawEdges: true, edges });
    • Beta

      Builds which of a document's dimensions, tolerances and datums are drawn and how, for the annotations of optionsOcctDocument, with defaults for what is left out.

      Parameters

      Returns DrawAnnotationsOptions

      The annotation settings

      const annotations = bitbybit.draw.optionsAnnotations({ annotationsView: "FRONT", annotationColour: "#0047ab", annotationWidth: 2, annotationsFilled: true });
      const options = bitbybit.draw.optionsOcctDocument({ drawAnnotations: true, annotations });
    • Beta

      Builds the drawing options for a hatched section, as occt.operations.hatchedSectionByFrame returns it: the cut faces in faceColour, their outlines as edges sets them, and the hatch lines in their own color and width, with defaults for what is left out.

      Parameters

      Returns DrawHatchedSectionOptions

      The drawing options

      const section = await bitbybit.occt.operations.hatchedSectionByFrame({ shapes: [housing], frame: { origin: [0, 0, 0], normal: [0, 0, 1], direction: [1, 0, 0] } });
      const edges =