Bitbybit Docs
    Preparing search index...

    Class RecipesBeta

    Recipes with no CAD kernel needed: solids described as a list of steps that occt.recipes and manifold.recipes build and the ifc package writes, so a pipeline can hand geometry to any kernel as data. Check one before a kernel runs it, read one from JSON, draw its roots made of triangles, and find what a root places. Experimental: the recipe format may still change.

    Index

    Constructors

    check

    • Beta

      Checks a value against the recipe format and lists what is wrong with it: steps that refer forward or out of range, ranges outside their buffers, coordinates that are not finite or too large, matrices that flatten, lists past their limits.

      Run it on a recipe from a file, another thread or a caller before a kernel builds it.

      Parameters

      Returns RecipeIssue[]

      What is wrong, at most a hundred issues, each a path such as nodes[3].depth and a sentence; empty when nothing is

      const issues = bitbybit.recipes.check({ recipe });
      const buildable = issues.length === 0;

    read

    • Beta

      Reads a recipe whose buffers may be lists of numbers, as JSON holds them, into the typed arrays the format keeps, and refuses one check finds anything wrong with.

      The value given is left as it was.

      Parameters

      Returns Recipe

      The recipe with typed buffers

      const recipe = bitbybit.recipes.read({ recipe: JSON.parse(text) });
      
    • Beta

      Gives the triangle meshes of the roots built from triangle nodes alone, through transforms, compounds and unions, placed by their matrices, so an open mesh no solid kernel accepts can still be drawn.

      A root holding any other step, such as an extrusion, gives undefined.

      Parameters

      Returns any[]

      One mesh per root asked for, in that order: positions three numbers a vertex, indices three a triangle

      const [mesh] = bitbybit.recipes.surfaceMeshes({ recipe, roots: [0] });
      
    • Beta

      Follows a node through the transforms that only turn and move to the step it places, folding them into the matrix, so roots that place one step through different moves share it, as an instanced drawing or an assembly wants.

      A transform that mirrors, scales or stretches stays a step of its own.

      Parameters

      Returns RecipeSource

      The step reached and the matrix placing it

      const root = recipe.roots[0];
      const { node, matrix } = bitbybit.recipes.sourceOf({ recipe, node: root.node, matrix: root.matrix });