FluidCAD Documentation

website·Indexed 32 days ago

https://fluidcad.io

A parametric CAD program whose native file format is JavaScript. FluidCAD allows users to model in a 3D viewport using sketches, extrusions, cuts, and boolean operations. The documentation covers part definitions, assembly management, connectors, joints, and a JavaScript-based API for geometric modeling.

Tokens
136.4K
Snippets
784
Records
1K
Agent score
66%

What's inside FluidCAD

  1. Overview of Part Connectors

    A connector is a named coordinate frame (consisting of an origin, an X direction, and a Z normal) attached to a part's geometry. Connectors define the mating interface of a part; in an assembly, mates are created by joining one connector to another. Every instance of a part carries the same set of declared connectors.
  2. Overview of FluidCAD 3D operations

    FluidCAD provides operations to transform flat sketches into 3D solids and reshape those solids. These operations are available via toolbar buttons with docked dialogs and generate statements in the part file that support method chaining.
  3. Overview of FluidCAD API Geometry Features

    The FluidCAD API provides functions for creating and manipulating geometry across four primary categories:

    • 2D Sketching: Create lines, circles, arcs, rectangles, and other 2D geometry.
    • 3D Operations: Perform extrude, revolve, loft, sweep, booleans, and other modifications.
    • Transforms: Apply translate, rotate, mirror, copy, and repeat operations.
    • Utilities: Perform selection, coloring, removal, and loading of objects.
  4. Create a Planar mate in the viewport

    A planar mate keeps two faces in contact, allowing the second part to slide in X and Y and rotate about Z. This is ideal for objects like a block on a table or a tile on a floor.

    Steps to create in the viewport:

    1. Click Planar on the assembly toolbar.
    2. Select the two face connectors: first the surface, then the part that rests on it.
    3. The part will drop onto the surface. You can drag it around while it remains flat.
    4. Use Offset to set a fixed Z-distance above the face or Flip to turn the part over.
    5. Click Apply.
  5. FluidCAD Workspace Basics

    When working in the FluidCAD workspace, use the following UI interactions:

    • Selection: Use Ctrl+click to add an entity to the current selection; a plain click replaces the selection.
    • Constraint Bar: Appears during sketching. Buttons are icon-based; hover for names. Buttons only activate when the current selection is valid for that constraint.
    • DOF Pill: Located at the bottom of the viewport, it tracks the remaining degrees of freedom in a sketch. It displays 'Fully constrained' when the sketch is complete.
    • Feature Dialogs: Every dialog displays the code statement it will write to the file. Use Apply (or Enter) to commit the statement and Exit (or Escape) to discard it.
  6. Choose between FluidCAD editors

    FluidCAD supports multiple editing environments:

    • In-page Editor: Suitable for most tasks; provides inline diagnostics and autocompletion based on the engine's type declarations.
    • External Editors: VS Code and Neovim extensions connect to the same server to provide a full IDE experience.
  7. Understand automatic fusion in FluidCAD

    In FluidCAD, most 3D operations that add material (such as extrude, revolve, sweep, loft, rib, and mirror) automatically merge their result into any existing solid they touch if the 'Add' tab is used. This is called auto-fusion and eliminates the need to manually call a Fuse boolean when creating new geometry onto an existing body.
  8. Create a Revolute mate in the viewport

    A revolute mate acts as a hinge, where two connectors share an origin and a Z axis, allowing the second part to rotate freely about that axis. This is used for components like levers on pivots, doors on hinges, or wheels on axles.

    To create a revolute mate in the viewport:

    1. Click Revolute on the assembly toolbar.
    2. Select the fixed part's pivot connector first, then the swinging part's connector.
    3. The part will snap onto the pivot. You can drag it in the viewport to test the swing.
    4. Configure the Rotate (rest angle), Limits (swing bounds), and Offset (shift hinge point) if needed.
    5. Click Apply.

    Once created, you can use the Animate… option in the Joints panel to sweep the angle between the defined limits.

  9. Configure Revolute mate options in code

    When defining a revolute mate in an assembly script, you can chain the following methods to control the hinge behavior:

    • .rotate(degrees): Sets the rest angle in degrees about the shared Z axis.
    • .limits(min, max): Bounds the swing range in degrees.
    • .offset(x, y, z): Shifts the hinge point in the driver's frame along any axis.
    • .flip(): Changes the hinge to the opposite side.
    mate('revolute', base.connectors.bore, arm.connectors.pivot)
        .rotate(30)           // rest angle, degrees about the shared Z
        .limits(-45, 45)      // swing bounds, degrees
        .offset(0, 0, 2)      // lift the hinge 2 along the driver's Z
        .flip()               // hinge from the other side
  10. Create a cylindrical mate in the viewport

    A cylindrical mate allows a part to rotate about and travel along a shared Z axis (e.g., a piston in a bore). To create one in the viewport:

    1. Click Cylindrical on the assembly toolbar.
    2. Select the first connector (e.g., the bore's frame), then the second connector (e.g., the piston's frame).
    3. The second part will snap to the axis. You can drag it to slide or spin it.
    4. Use Offset to set the rest position along the Z axis and Rotate to set the rest angle.
    5. Click Apply.
  11. Understand FluidCAD's parametric model structure

    FluidCAD is a parametric CAD program where the native file format is JavaScript. Models are stored in .part.js or .assembly.js files. The system maintains a bidirectional sync: actions performed in the 3D viewport (via sketch tools, feature dialogs, and mates) are written as readable JavaScript statements in the file, and manual edits to the JavaScript file automatically re-render the model in the viewport.
  12. Define 2D sketch relationships using constraints

    Constraint statements in FluidCAD declare relationships between entities in a 2D sketch. Because coordinates provided in line(), arc(), circle(), and point() are treated as initial guesses, the sketch solver automatically moves entities to satisfy all active constraints. Constraints are recorded in the timeline as features.
    import { 
      coincident, horizontal, vertical, parallel, perpendicular, 
      tangent, equal, concentric, collinear, midpoint, 
      symmetric, fix, distance, angle, radius, diameter 
    } from 'fluidcad/constraints';