Bitbybit Docs
    Preparing search index...

    Class OCCTDesignBeta

    Builds parametric parts and assemblies kept as data: a part document holds typed parameters, configurations, an ordered list of features and the parts they make, with materials, appearance, properties such as part numbers and connectors; an assembly document places parts and other assemblies, fastened by their connectors.

    Features find faces and edges by the feature that made them and the role it made them in, so a reference keeps pointing at the same face when the parameters change. Sketches come from sketch, the operations from operations, booleans, fillets and features.

    Experimental: the document format may still change before its first stable version, and documents written before then are not migrated.

    Index

    Constructors

    document

    Constructors

    document

    • Beta

      Checks a design document without building it and lists every problem found.

      Each problem carries the JSON pointer of the value it is about, such as /features/2/radius, and a message. An assembly is checked with the documents it places, whose problems come under their position, such as /documents/2. Undefined properties and bad expressions count.

      Parameters

      Returns Promise<DesignIssue[]>

      The problems, empty when there are none

      const issues = await bitbybit.occt.design.validate({
      document: { schemaVersion: 1, parameters: { size: 10 }, features: [{ id: "block", type: "extrude", profile: "base", distance: "size" }] },
      });
      console.log(issues[0]?.path, issues[0]?.message);
    • Beta

      Works out the version of a design document, the value a component's version pins its source with.

      The version is the SHA-256 of the document's canonical JSON (RFC 8785) without what only editors and tools read, such as meta but its name, extras, labels, descriptions and reference hints, so editing those keeps it.

      Parameters

      Returns Promise<string>

      The version, 64 lower-case hexadecimal digits

      const version = await bitbybit.occt.design.versionOf({
      document: { schemaVersion: 1, id: "3f2c9a1e-5b7d-4e8f-9a0b-1c2d3e4f5a6b", features: [] },
      });
      console.log(version);
    • Beta

      Builds the parts of a design document, with a configuration's values and then parameters replacing the document's own.

      A document validate faults is refused. A failed feature is reported and what uses it skipped; unchanged features are reused. structure exports the parts to STEP and glTF through assembly.manager.buildAssemblyDocument; an assembly adds components and a bill of materials.

      Parameters

      Returns Promise<DesignBuildResult<TopoDSShapePointer>>

      The parts, a report per feature, the problems found after the features ran, and the parameter values used

      const { parts, report } = await bitbybit.occt.design.build({
      document: { schemaVersion: 1, parameters: { width: 40, height: 10 }, features: [
      { id: "base", type: "sketch", on: { plane: "XY" }, pen: [{ type: "hLine", length: "width" }, { type: "vLine", length: 20 }, { type: "hLine", length: "-width" }, { type: "close" }] },
      { id: "plate", type: "extrude", profile: "base", distance: "height" },
      ], parts: [{ id: "plate", body: "plate", properties: { partNumber: "PL-{width}x{height}" } }] },
      parameters: { width: 60 },
      });
      console.log(parts[0]?.properties.partNumber);