Skip to main content

Plateau foam

Send a STEP file of a solid part and get back the part filled with a smooth open-cell foam. Seeds grown inside the part become cells, the cells' edges become struts that meet the way the borders of a real foam meet, and the struts are blended where they meet. The struts can grow finer toward the part's surface, and a closed skin can keep the part's outside closed with the foam inside it. The result is one closed triangle mesh, as STL or 3MF, ready for a slicer. It is one of the Pro algorithms that run only on CAD Cloud.

The swirl node filled with Plateau foam under a closed skin and cut open through its body: the skin round every lobe and the trunk, and the foam's smooth struts filling the lobes
The swirl node as an open foam without a skin: struts where its cells meet its surface and along its own sharp edges, cut flush with its surface, seeds 8.5 mm apart and struts of radius 0.9 mm, with the foam inside seen through the open cells

The same part twice, the swirl node you can download below. Above, filled with foam under a 1 mm skin and cut open through its body: the closed skin round every lobe and the trunk, and the foam's struts inside it. Below, grown as an open foam without a skin, with struts where its cells meet its surface and along its own sharp edges, so the lattice keeps the part's shape. Every render of a foam on this page is made in Blender from the mesh CAD Cloud returned.

The swirl node as it was drawn: three massive lobes sweeping around a flared central trunk, bolt bosses on the lobes and a flat mounting face underneath, one solid

The part as it was drawn: three lobes that sweep round a tapered trunk as they rise, a boss on each lobe, a bore through the trunk, blind bores into the lobes from above and below, and a flat face underneath, one solid in a STEP file. It was drawn on CAD Cloud too, by a pipeline that lofts the body through its outlines, rounds its edges, joins the trunk and the bosses to it, and bores and chamfers them. Download the pipeline and run it as Pipelines in Studio shows, or import it there to change it.

The swirl node as a STEP file, one solid in millimetres (2.0 MB) The CAD Cloud pipeline that builds the swirl node and returns it as a STEP file (16 KB) The Plateau foam request of the swirl node: seeds 6 mm apart, struts of radius 0.75 mm and a 1 mm skin (1 KB)

Foams like these make lightweight cores, cushioning, lamps and decorative pieces, and lattices with a large surface for heat to pass through.

What goes in and what comes back​

You send one STEP file (.step, .stp, or gzip-compressed .stpz) of at most 100 MB. It is read in millimetres, or in the unit fileUnit names. The foam fills one solid: a file of one solid fills it, and a file of several needs solid, the solid's place in the file counted from 0.

You get back:

  • The foam as one closed triangle mesh: stl, a binary STL (the default), and 3mf, a 3MF package of one mesh object in millimetres, as outputs.formats asks. Both are written Z-up, as the STEP file stood. The mesh is checked to be closed, with no triangles crossing each other, before it is written, ready for a slicer.
  • The report as the task's metadata result: the seeds, the struts' radii, the mesh, its volume and the time each step took (The report).

In Studio​

Lattices with the swirl node loaded: the part in the 3D view, and the settings sized to it beside it, the presets, the part, the seeds and the strut radius
  1. Open Lattices and drop a STEP file on it.
  2. The settings are sized to the part as it loads. Choose a preset, Even foam, Fine skin, coarse core or Thin open lattice, and change what you want: the Seeds, the Strut radius, the Foam and the Output.
  3. Choose Grow the foam.

The Result tab shows the foam in the 3D view. Part draws the part Solid, as an Outline or Hidden, and Cut away keeps what lies below a cut across the file's X, Y or Z axis, at the place Cut at sets, so you can see inside. Files downloads the STL, the 3MF and the report, and Request sent shows the request the page sent, ready to copy into your own code. Your own seeds (points, weights and sizes) are for requests you write; the page grows the seeds itself.

The route​

POST /api/v1/cad/pro/lattices/plateau-foam takes the uploaded file as stepFileId, starts a task and answers with its taskId, like every CAD Cloud call. It needs an API key with the cad scope.

A request​

This is the request of the swirl node above. <your uploaded file> stands for the fileId the upload gave you.

{
"stepFileId": "<your uploaded file>",
"seeds": { "method": "poisson", "maxSpacing": 6 },
"radius": 0.75,
"voxel": 0.55,
"skin": 1,
"outputs": { "formats": ["stl", "3mf"] }
}
  • seeds grows seeds inside the part, at least 6 mm apart.
  • radius is every strut's radius, in millimetres.
  • voxel is how fine the foam is meshed (Voxel size and limits).
  • skin keeps a closed skin 1 mm thick on the part's surface, with the foam inside it.

Everything else takes its default. Every option is in the API reference.

Seeds​

Every seed becomes one cell, and the foam's struts run along the cells' edges. seeds.method says how they are grown inside the part:

methodNeedsWhat it places
poisson (the default)maxSpacingSeeds at least maxSpacing apart, so the cells come out even
randomcountThat many seeds anywhere in the part
gridspacing, and jitter if you likeSeeds on a regular grid, each moved off its point by up to jitter (a share of the spacing, from 0 to 1, 0 by default)
  • seed picks the random choices (0 by default): the same seed gives the same seeds.
  • relax runs up to 100 rounds that each move every seed to the middle of its cell, which evens the cells out (Lloyd rounds in Studio, 0 by default).
  • A request places at most 10,000 seeds; a spacing that would place more is refused once the seeds are made, and so is one that leaves no seed inside the part.

Your own seeds​

Give points instead of seeds to place every seed yourself, [x, y, z] each in millimetres. The points are in the Y-up space the part is read into: a file's point (x, y, z) is (x, z, -y) here. The report lists the seeds in the same space, so the seeds of one run can be sent back as the points of the next.

  • weights, one for each point, lets a cell with a larger weight grow into its neighbours.
  • sizes, one strut radius for each point, grades the foam your own way: a strut takes the mean of the values of the cells that meet at it. Leave radius and grading out with sizes.
  • outsideSeeds decides what happens to a point outside the part: refuse (the default) refuses the request, drop leaves the point out. coincidentSeeds does the same for points too close to each other: refuse, or merge to make them one cell.

Strut radius and grading​

radius is the struts' radius in millimetres. With grading, the foam changes from the part's surface to its core:

{
"seeds": { "method": "poisson", "maxSpacing": 6, "minSpacing": 3 },
"radius": 0.8,
"grading": { "depth": 8, "skinRadius": 0.4, "falloff": "smooth" }
}
  • grading.depth is how deep below the surface the change reaches.
  • grading.skinRadius is the struts' radius at the surface; from depth inward they take radius.
  • seeds.minSpacing (with poisson seeds) is the seeds' spacing at the surface, so the cells are smaller there; from depth inward they are maxSpacing apart.
  • grading.falloff is how the values change over the depth: linear (the default), smooth, inverse or exponential.

Give skinRadius, minSpacing or both: grading with neither changes nothing and is refused. In Studio, choose Skin to core under Strut radius, then the Skin radius, the Depth, the Falloff and the Spacing at the skin.

A slice 4 mm thick through the middle of a sphere of radius 20 mm filled with a graded foam: small cells and thin struts near its surface, larger cells and thicker struts in its core

A slice through the middle of a sphere of radius 20 mm, graded from cells 3.5 mm apart with struts of 0.5 mm at its surface to cells 8 mm apart with struts of 1 mm from 8 mm deep: fine cells and thin struts near the surface, larger cells and thicker struts in the core.

Blend, bow and relaxation​

  • blend is how far the struts blend into each other where they meet, in millimetres; 0 joins them without rounding. It defaults to half the least strut radius.
  • bow bends each strut inside the part away from a straight line, as a share of its length from 0 to 0.25. It defaults to 0, straight struts.
  • relaxRounds (20 by default, at most 1,000) moves the points where struts meet so the struts meet at more even angles, as they do in a real foam. Points on the part's surface stay where they are. relaxStrength (0 to 1, 1 by default) is how much of the way to go, and relaxDamping (0.001 to 1, 0.5 by default) the share of each step taken.

A closed skin with the foam inside​

Yes, the part's shell can stay. skin is the thickness of a closed skin on the part's surface, in millimetres, and the struts blend into it. The skin's outer face is the part's own surface, finely triangulated, so the part keeps its shape and size, and the skin grows skin millimetres inward from it: a part that prints closed, with the foam inside. With escape holes, the outer face follows the part's surface closely instead. skin defaults to 0, no skin.

Close to where the main lobe meets the trunk, cut open: the skin, the trunk's bore and the foam's struts blending into each other at their nodes

Close to where the swirl node's largest lobe meets the trunk, cut open: the skin round the lobe and the trunk's bore, and the struts blending into it where they meet it.

A section through the swirl node's trunk and main lobe: the closed skin round the outside and the bore, and the foam filling the solid between them

A section through the trunk and the largest lobe: the skin keeps the outer surface, the bores and the flat face underneath closed, and the foam fills the solid between them.

Lattices after growing the swirl node's foam: the part hidden and the view cut through its body, the cut through the skin and the struts capped in blue, the view's settings and the report beside it

The swirl node's foam in Studio, with Part set to Hidden and Cut away at Z: the cut is closed with a flat blue cap, so the skin round every lobe and the trunk and the struts inside read as a section.

In Studio, set Skin thickness; the Fine skin, coarse core preset starts with one, at least two voxels thick.

Printing a part with a closed skin​

A closed skin keeps whatever is inside it. In powder-bed printing (SLS, MJF, metal) the unsintered powder stays in the foam, and in resin printing (SLA, DLP) so does the uncured resin. escapeHoles opens holes through the skin so it can run out. A part that may stay open needs none: leave the skin off (skin 0), and the open foam drains as it is.

Escape holes​

This request puts two holes through the swirl node's flat underside, clear of its bores:

{
"stepFileId": "<your uploaded file>",
"seeds": { "method": "poisson", "maxSpacing": 6 },
"radius": 0.75,
"voxel": 0.55,
"skin": 1,
"escapeHoles": [
{ "point": [0, -14, -26], "radius": 1.5 },
{ "point": [-18, -14, 12.6], "radius": 1.5 }
]
}

Each hole is a straight, flat-ended hole from outside the part, through the skin, a voxel deep into the first open space of the foam behind it. A request takes up to 64 of them, and only with a skin.

  • point is where the hole goes, in millimetres, in the same space as points (Your own seeds): the points above are on the node's underside, z -14 in the file. The point is moved onto the nearest point of the part's surface, which may lie no farther from it than the hole's radius.
  • radius is the hole's radius in millimetres, at least two voxels, so the hole is meshed round and open.
  • direction is the hole's axis into the part, at most 80 degrees from the surface's inward normal there. Left out, it is that normal.
  • The holes' rims are sharp or rounded as edges says.

The report lists every hole: the surface point used, its axis, radius and depth, and open, whether it reached the foam's open interior. A hole is reported open: false, and may not drain, when its axis leaves the part before it reaches open foam, so it goes right through, or when it meets only skin and struts as far as it looks: move it and grow the foam again. A request is refused, naming the hole, without a skin, for a radius under two voxels (with the least radius that fits), for a point farther from the surface than its radius, for a direction too steep, or for more than 64 holes.

Where to put them:

  • Two or more, so air can get in while the resin or powder runs out.
  • At the low points of the part as it will stand in the printer.
  • Large enough to mesh at your voxel, and for your process to drain through.
Lattices with the swirl node seen from below and a 1 mm skin: escape holes placed by clicking its flat underside, drawn on it, and listed under Escape holes with their points and radiiAn escape hole through the swirl node's skin on its flat underside, cut through its axis: a straight round hole from outside, through the skin, into the open foam

In Studio, Escape holes shows once the foam has a skin. Choose Place holes and click the part in the view: each click puts a hole where you hit, four voxels in radius, until Done placing. Every hole is listed with its point, a Radius field and a button to remove it, and the holes are drawn on the part while the settings show. Studio drills each hole along the surface's inward normal; give direction in a request of your own to tilt one. The report says when a hole did not reach the open foam. On the left, holes placed by clicking the swirl node's flat underside, seen from below; on the right, one of them in the foam that came back, cut through its axis where it opens through the skin into the foam.

Struts on the surface and their edges​

Without a skin, a strut ends where a cell's edge meets the part's surface. surfaceStruts adds struts along the surface itself:

surfaceStrutsStruts on the surface
none (the default)None: every strut ends at the surface
cellEdgesOne along each line where a cell meets the surface
cellAndPartEdgesThose, and one along each of the part's own sharp edges

A seam, a pole and an edge where two faces meet smoothly never get a strut. With a skin, surfaceStruts changes nothing: the skin covers the surface.

edges decides how a strut ends where the part's surface cuts it:

  • sharp leaves a clean, sharp rim on the part's outer surface.
  • rounded rounds the rim with a fillet of edgeRadius (half the least strut radius unless given), and keeps the part's outer extent wherever a strut is thicker than edgeRadius.

When a foam without a skin has struts on its surface and the request names no edges, the rims are rounded; otherwise they are sharp. A named edges always wins. Surface struts on a curved part look best rounded. The part's own sharp edges stay sharp either way, and a skin at least edgeRadius thick covers every rim, so under a skin both give the same outer surface. edgeRadius applies only to rounded edges, asked for or the default. In Studio, Edges follows Struts on the surface until you choose one yourself.

A cylinder's foam with struts along its cells' edges and its own rims, with sharp edges where the surface meets the strutsThe same cylinder's foam with rounded edges: every rim where the surface meets the struts softened into a fillet

A cylinder with struts along its cells' edges and its own rims (cellAndPartEdges), sharp on the left and rounded on the right.

The open swirl node at the top of this page is grown the same way, with sharp edges: no skin, cellAndPartEdges, seeds 8.5 mm apart and struts of radius 0.9 mm. The struts on its surface are cut flush with it and trace its lobes, bosses and bores, and the foam inside shows through the open cells.

Smoothing and simplification​

  • smoothRounds is how many rounds of smoothing the mesh gets: smoothing makes it follow the foam more closely, with fewer thin triangles. It defaults to 3, at most 20, which about doubles the time the foam takes; 0 leaves the mesh unsmoothed, quicker and rougher.
  • simplifyTolerance is how far, in millimetres, the written mesh may stray from the meshed foam when it is simplified to fewer triangles. Left out, it is a tenth of the voxel. Simplifying never makes triangles cross or opens the mesh, and it leaves a skin's outer face as it is. 0 writes the mesh unsimplified, as it was meshed, with many more triangles and larger files.

In Studio, Simplify within sets the tolerance, and Unsimplified writes the mesh as it was meshed.

Voxel size and limits​

voxel is how fine the foam's mesh is, in millimetres: a smaller voxel gives a finer mesh and takes longer. It defaults to half the least strut radius, two voxels across it. A larger voxel is quicker and rougher, good for a first look.

A request is refused, with what to change, when:

LimitWhat happens
More than 10,000 seedsRefused once the seeds are made: take a larger spacing or fewer seeds
More than 2,000,000,000 voxels over the part's boxRefused before the foam is built, naming the least voxel that fits
More than 5,000,000 voxels near the surfaceRefused while the foam is built, as soon as it reaches that many: take a larger voxel
More than 6,000,000 triangles meshedRefused once the foam is meshed and simplified, before anything is written: take a larger voxel
More than 1,500,000 triangles to write, simplified or notRefused: give a larger simplifyTolerance, or take a larger voxel
More than 10 minutesThe task stops

How many voxels a foam needs near its surface is known only while it is built, since it depends on the struts, so that limit cannot be checked up front. As a guide, the swirl node filled with seeds 6.5 mm apart and struts of radius 0.7 mm comes near the limit of voxels near the surface at a voxel of 0.33 mm. A part of about 40 mm takes 5 to 15 seconds, and the swirl node above, about 130 mm across and filled with 545 seeds, about a minute and a half. Studio shows an estimate of the voxels over the part's box under Voxel size, and when a voxel is refused for making too many over the box, a button offers the least one that fits.

The report​

The task's metadata result is the report:

  • part: the solid filled, how many the file holds, and its size;
  • seeds: whether they were grown or given, how many, the settings they were grown with, and every seed's position, ready to send back as points;
  • struts: the radius asked for, the grading, and the least and largest radius a cell took;
  • foam: the cells built, inside the part and cut by its surface, the struts and the points where they meet, the relaxation, the voxel, the blend, the skin and the bow used, the voxels near the surface, the triangles and the volume, the smoothing, the surface struts, the edges, the escape holes, and the skin's outer face: outerSurface says whether it is the part's own triangulated surface (source part) and, if so, its triangles and the triangulation's reported deflection, an upper bound;
  • simplification: the tolerance, and the triangles and the volume before and after;
  • timings: the milliseconds each step took.
The report of the swirl node's foam in Lattices: the part, the seeds and cells, the struts, the mesh, the volume and relative density, the relaxation and the timings

Studio's Report reads the same report, and adds the foam's share of the part's volume as its Relative density.

Run it​

With the TypeScript SDK, the call is:

import { readFileSync } from "node:fs";
import { BitbybitClient, unwrap } from "@bitbybit-dev/cad-cloud-sdk";

const client = new BitbybitClient({ apiKey: process.env["BITBYBIT_API_KEY"] ?? "" });
const name = "swirl-node.step";
const file = await client.files.uploadBytes(name, readFileSync(name), "application/octet-stream");
const { taskId } = await unwrap<{ taskId: string }>(await client.request("POST", "/api/v1/cad/pro/lattices/plateau-foam", {
stepFileId: file.fileId,
seeds: { method: "poisson", maxSpacing: 6 },
radius: 0.75,
voxel: 0.55,
skin: 1,
outputs: { formats: ["stl", "3mf"] },
}));
const { downloads } = await client.tasks.pollAndDownload(taskId, { intervalMs: 5000, maxAttempts: 150 });

downloads gives an address to download each result from: the STL, the 3MF and the report. Every request option is in the API reference.