Skip to main content

Import

FluidCAD imports STEP files. An import becomes a cached .brep in the project's imports/ folder and a load() statement in your file, which places the geometry in the scene like any other feature.

In the viewport​

  1. Click Import (the file icon at the right end of the top bar, next to Export). On a narrow window it sits in the Actions menu.
  2. Pick a .step or .stp file. FluidCAD converts it and saves it as imports/<filename>.brep in your project folder.
  3. A load() statement is appended to the current file and the imported solid appears in the viewport with a Load row in the History panel. Colors stored in the STEP file are kept.

The project structure looks like this after importing:

my-hinge/
├── imports/
│ └── bracket.brep ← created by the import button
├── box.part.js
└── package.json

The code behind it​

import { load } from 'fluidcad/core';

const bracket = load("bracket"); // loads imports/bracket.brep

load() takes the file name without its extension and returns a scene object you can transform, select from, and mate against like a modelled solid.

Placing the imported geometry​

After loading, move and rotate the geometry with the transform statements:

import { load, rotate, translate } from 'fluidcad/core';

const rail = load("EGH20CA1R350Z0H_FILE_1")
rotate("x", 90)
translate(0, -50, 25)

See Transforms.

Sharing​

A share link carries the geometry the model loads: each imports/<name>.brep a load() reads, with its colour and unit files, travels in the link beside the source, and the viewer opens the model as the desktop renders it. Imports the model does not load stay out. Because the geometry is in the link itself, a large import can push the link past its size limit; the Share dialog then names the imported file as what makes it too large.

In a package​

A part of a package loads the package's own imports: load("motor") written in the package's files reads imports/motor.brep from the package, which carries it, never from the project that uses the package. One the package lacks is an error naming the package:

Imported asset not found: imports/motor.brep in @acme/[email protected]. If the name comes from the model using the package, read it with load(name, { from: 'project' }).

A name that comes from the project using the package, such as a STEP file a part takes as a parameter, is that project's file. Read it with load(name, { from: 'project' }). In your project's own files, load() reads the project's imports/ either way.

Units​

load() needs no unit. STEP files carry theirs, the import is cached in millimetres, and load() scales it into the loading file's unit: a factor of 1 in a millimetre file, so existing projects are untouched. load("bracket", { unit: 'in' }) is an assertion for assets with no trustworthy metadata (a .brep copied into imports/ by hand, a STEP whose header is wrong); it overrides what the import recorded, and you should leave it out otherwise.