ManifoldCAD User Guide
    Preparing search index...

    Module manifoldCAD

    These are the objects and functions that are available within manifoldCAD itself.

    All of the classes, functions and properties of this module are implemented elsewhere and re-exported here.

    This is an isomorphic module. When imported within manifoldCAD, the bundler will swap it out for an identical module running in the worker context. When imported as an ES module, it will implicitly instantiate a manifold wasm module, and export it along with everything else listed here. This allows models to behave identically when running on manifoldCAD.org, through the CLI, or through nodejs.

    It can be imported as manifold-3d/manifoldCAD.

    Classes

    BaseGLTFNode

    The abstract class from which other classes inherit. Common methods and properties live here.

    CrossSection
    GLTFNode

    Position a manifold model for later export.

    Manifold

    This library's internal representation of an oriented, 2-manifold, triangle mesh - a simple boundary-representation of a solid object. Use this class to store and operate on solids, and use MeshGL for input and output, or potentially Mesh if only basic geometry is required.

    In addition to storing geometric data, a Manifold can also store an arbitrary number of vertex properties. These could be anything, e.g. normals, UV coordinates, colors, etc, but this library is completely agnostic. All properties are merely float values indexed by channel number. It is up to the user to associate channel numbers with meaning.

    Manifold allows vertex properties to be shared for efficient storage, or to have multiple property verts associated with a single geometric vertex, allowing sudden property changes, e.g. at Boolean intersections, without sacrificing manifoldness.

    Manifolds also keep track of their relationships to their inputs, via OriginalIDs and the faceIDs and transforms accessible through MeshGL. This allows object-level properties to be re-associated with the output after many operations, particularly useful for materials. Since separate object's properties are not mixed, there is no requirement that channels have consistent meaning between different inputs.

    Mesh

    An alternative to Mesh for output suitable for pushing into graphics libraries directly. This may not be manifold since the verts are duplicated along property boundaries that do not match. The additional merge vectors store this missing information, allowing the manifold to be reconstructed.

    VisualizationGLTFNode

    Include an imported model for visualization purposes.

    Interfaces

    GLTFMaterial
    MeshOptions

    Type Aliases

    AnimationMode
    Box
    ErrorStatus
    FillRule
    GLTFAttribute
    JoinType
    Mat3
    Mat4
    Polygons
    Rect
    SimplePolygon
    Smoothness
    Vec2
    Vec3

    Functions

    getGLTFNodes

    Get a list of GLTF nodes that have been created in this model.

    isManifoldCAD

    Is this module running in manifoldCAD evaluator?

    resetGLTFNodes

    Clear the list of cached GLTF nodes.

    triangulate

    Triangulates a set of /epsilon-valid polygons.

    Global Settings

    getAnimationDuration

    Get the current duruation of the animation, in seconds.

    getAnimationFPS

    Get the current animation frame rate.

    getAnimationMode

    Get the current animation repeat mode.

    getCircularSegments

    Determine the result of the setMinCircularAngle, setMinCircularEdgeLength, and setCircularSegments defaults.

    getMinCircularAngle

    Get the current angle constraint.

    getMinCircularEdgeLength

    Get the current edge length constraint.

    resetToCircularDefaults

    Reset the circular construction parameters to their defaults if setMinCircularAngle, setMinCircularEdgeLength, or setCircularSegments have been called.

    setAnimationDuration

    Set the duration of the animation, in seconds.

    setAnimationFPS

    Set the animation frame rate.

    setAnimationMode

    Set the animation repeat mode.

    setCircularSegments

    Set the default number of segments in a circle. Overrides the edge length and angle constraints and sets the number of segments to exactly this value.

    setMinCircularAngle

    Set an angle constraint when calculating the number of segments in a circle. The number of segments will be rounded up to the nearest factor of four.

    setMinCircularEdgeLength

    Set a length constraint when calculating the number segments in a circle. The number of segments will be rounded up to the nearest factor of four.

    Global State

    These objects and functions are specific to top-level scripts running within manifoldCAD.

    They are only accessible as global objects by a top level script evaluated by the worker. Libraries will not have access to them.

    AnimationMode → AnimationMode

    Modelling Functions

    importManifold

    Import a model, and convert it to a Manifold object for manipulation.

    importModel

    Import a model, for display only.

    only

    Wrap any shape object with this method to display it and any copies as the result, while ghosting out the final result in transparent gray. Helpful for debugging as it allows you to see objects that may be hidden in the interior of the result. Multiple objects marked only() will all be shown.

    setMaterial

    Return a shallow copy of the input manifold with the given material properties applied. They will be carried along through operations.

    setMorphEnd

    Apply a morphing animation to the input manifold. Specify the end function which will be applied to the vertex positions of the last frame and linearly interpolated across the length of the overall animation. This animation will only be shown if this manifold is used directly on a GLTFNode.

    setMorphStart

    Apply a morphing animation to the input manifold. Specify the start function which will be applied to the vertex positions of the first frame and linearly interpolated across the length of the overall animation. This animation will only be shown if this manifold is used directly on a GLTFNode.

    show

    Wrap any shape object with this method to display it and any copies in transparent red. This is particularly useful for debugging subtract() as it will allow you find the object even if it doesn't currently intersect the result.