Lattices - grow a Plateau foam inside a part
POST/api/v1/cad/pro/lattices/plateau-foam
Proprietary open-cell foam inside a solid part of an uploaded STEP file: seeds become cells inside the part, the cells' edges inside it become struts, the struts are relaxed so they meet at even angles as the borders of a real foam do, and they are blended smoothly where they meet, optionally joined to a closed skin of a given thickness on the part's surface. The seeds are grown on the server (evenly spaced, random or on a grid) or given by the caller, and the struts' radius is one number, a change from the part's surface to its core ('grading'), or one value for each seed. Every length is in millimetres. The result is one closed triangle mesh with no crossing triangles: 'voxel' sets how fine it is, and 'simplifyTolerance' how far it may stray from the foam to come to fewer triangles. Requires the 'cad' API key scope. Returns 202 with a task ID; the foam comes as binary STL and/or 3MF, written Z-up as the STEP file stood, and the PlateauFoamReport (the part, every seed, the radii, the foam's record, the simplification and the timings) is delivered as the metadata result. A request whose voxel would make too many voxels over the part's box, whose foam needs too many voxels near its surface, or whose mesh would come to too many triangles, is refused with the limit and what to change.
Request
Responses
- 202
- 400
- 403
- 500
Task accepted
Validation error
Insufficient scope
Server error
Reference
POST /api/v1/cad/pro/lattices/plateau-foam
Proprietary open-cell foam inside a solid part of an uploaded STEP file: seeds become cells inside the part, the cells' edges inside it become struts, the struts are relaxed so they meet at even angles as the borders of a real foam do, and they are blended smoothly where they meet, optionally joined to a closed skin of a given thickness on the part's surface. The seeds are grown on the server (evenly spaced, random or on a grid) or given by the caller, and the struts' radius is one number, a change from the part's surface to its core ('grading'), or one value for each seed. Every length is in millimetres. The result is one closed triangle mesh with no crossing triangles: 'voxel' sets how fine it is, and 'simplifyTolerance' how far it may stray from the foam to come to fewer triangles. Requires the 'cad' API key scope. Returns 202 with a task ID; the foam comes as binary STL and/or 3MF, written Z-up as the STEP file stood, and the PlateauFoamReport (the part, every seed, the radii, the foam's record, the simplification and the timings) is delivered as the metadata result. A request whose voxel would make too many voxels over the part's box, whose foam needs too many voxels near its surface, or whose mesh would come to too many triangles, is refused with the limit and what to change.
Request body
Content type: application/json (required)
| Field | Type | Required | Description |
|---|---|---|---|
stepFileId | string | yes | ID of the previously uploaded STEP file holding the part (.step, .stp or gzip-compressed .stpz), at most 100 MB. It is read in millimetres, or in the unit 'fileUnit' names. |
fileUnit | mm | cm | m | in | no | A unit of length: 'mm' (millimetres), 'cm' (centimetres), 'm' (metres) or 'in' (inches). |
solid | integer | no | Which solid of the file to fill, counting from 0 in the order the file lists them. Needed when the file holds more than one solid; a file of one solid fills it. |
seeds | object | no | The seeds the server grows inside the part, one cell for each. Every request places at most 10000 seeds; a spacing that would place more is refused once the seeds are made. |
seeds.method | poisson | random | grid | no | How the seeds are placed inside the part: 'poisson' (the default) keeps every two seeds at least a spacing apart, for even cells; 'random' places a count of seeds anywhere; 'grid' places them on a regular grid, optionally jittered. |
seeds.maxSpacing | number | no | Poisson: the least distance between two seeds, in millimetres. With 'grading', the spacing in the part's core. |
seeds.minSpacing | number | no | Poisson with 'grading': the spacing at the part's surface, at most 'maxSpacing', so cells are smaller near the skin. Without it every seed is 'maxSpacing' apart. |
seeds.count | integer | no | Random: how many seeds to place, at most 10000. |
seeds.spacing | number | no | Grid: the distance between neighbouring grid points, in millimetres. |
seeds.jitter | number | no | Grid: how far each point may move from its grid point along each axis, as a share of the spacing from 0 to 1. Defaults to 0. |
seeds.seed | integer | no | The seed of the random choices: the same seed gives the same seeds. Defaults to 0. |
seeds.relax | integer | no | Rounds of Lloyd relaxation, each moving every seed to the middle of its cell, which makes the cells more even. Defaults to 0, at most 100. |
points | array of array | no | Your own seeds, [x, y, z] each in millimetres in the Y-up working space the part is read into: a STEP file's Z-up numbers are turned a quarter about X first, so the file's +Y is -Z here, and the file's +Z is +Y. The report's seeds are in the same space, so a run's seeds can be sent back here. At most 10000. Give 'seeds' or 'points', not both. |
weights | array of number | no | With 'points': one weight for each point, which makes power cells: a cell with a larger weight grows into its neighbours. |
sizes | array of number | no | With 'points': one strut radius for each point, in millimetres, for callers who grade the foam themselves. A strut takes the mean of the values of the cells that meet at it. Leave 'radius' and 'grading' out with it. |
radius | number | no | The struts' radius in millimetres; with 'grading', the radius in the part's core. Needed unless 'sizes' gives each cell its own. |
grading | object | no | A change of the struts' radius, and of the seeds' spacing, from the part's surface to its core. |
grading.depth | number | yes | How deep below the part's surface the grading reaches, in millimetres: at the surface the struts take 'skinRadius' and the seeds 'seeds.minSpacing'; from this depth inward, 'radius' and 'seeds.maxSpacing'. |
grading.skinRadius | number | no | The struts' radius at the part's surface, in millimetres. A strut's radius is the mean of the values of the cells that meet at it, each cell's value read at its seed. |
grading.falloff | linear | smooth | inverse | exponential | no | How the values change over the depth: 'linear' (the default), 'smooth', 'inverse' or 'exponential'. |
voxel | number | no | How fine the foam's mesh is: the size of a voxel, in millimetres. Smaller is finer and slower. Defaults to half the least strut radius. A foam needs more voxels near its surface the smaller the voxel and the more struts it has: one that needs more than 5000000 of them is refused while it is built, as soon as it reaches that many, since how many it needs is known only then; take a larger voxel then. A voxel that would make more than 2000000000 voxels over the part's box, its border included, is refused before the foam is built, naming the least voxel that fits. |
blend | number | no | How far the struts blend into each other where they meet, in millimetres; 0 joins them without rounding. Defaults to half the least strut radius. |
skin | number | no | The thickness of a closed skin on the part's surface, in millimetres, blended into the struts. Defaults to 0, no skin: the struts then end where the cells' edges meet the part's surface, or in a net of struts on it with 'surfaceStruts'. |
bow | number | no | How far each inner strut bows away from a straight line, as a share of its length from 0 to 0.25. Defaults to 0, straight struts. |
relaxRounds | integer | no | Rounds of relaxation, which move the nodes inside the part, the points where struts meet, so the struts meet at more even angles, as in a real foam. Nodes on the part's surface stay where they are. 0 leaves the struts along the cells' edges. Defaults to 20, at most 1000. |
relaxStrength | number | no | How much of the way from the cells' own struts to the relaxed ones to go, from 0 to 1. Defaults to 1. |
relaxDamping | number | no | The share of each relaxation step taken, from 0.001 to 1. Defaults to 0.5. |
surfaceStruts | none | cellEdges | cellAndPartEdges | no | Struts on the part's surface, for a foam without a skin: 'none' (the default) ends every strut where a cell's edge meets the surface; 'cellEdges' adds a strut along each line where a cell's face meets the surface; 'cellAndPartEdges' adds the part's own sharp edges as well. A seam, a pole and an edge where two faces meet smoothly never get a strut. With struts on the surface the edges are rounded unless 'edges' says otherwise. With a skin it changes nothing: the skin covers the surface. |
edges | sharp | rounded | no | How a strut ends where the part's surface cuts it: 'sharp' leaves a clean sharp rim and keeps the part's outer surface exact; 'rounded' rounds the rim into a fillet of 'edgeRadius', its middle a quarter of that radius inside where the sharp line was, and keeps the part's outer extent wherever a strut's radius there is larger than 'edgeRadius'. Defaults to 'rounded' when 'surfaceStruts' puts struts on the surface of a foam without a skin, and to 'sharp' otherwise; a named value always wins. The part's own sharp edges stay sharp either way, and a skin at least 'edgeRadius' thick covers every rim, so under it both give the same outer surface. |
edgeRadius | number | no | With rounded edges, asked for or the default with struts on the surface: the radius of the rounded rims, in millimetres. Defaults to 0.5 of the least strut radius. Give it only when the edges are rounded. |
smoothRounds | integer | no | Rounds of smoothing, which make the foam's mesh follow the foam more closely, with fewer thin triangles. 0 leaves the mesh unsmoothed: quicker, and rougher. Defaults to 3, at most 20; the default about doubles the time the foam takes to build. |
escapeHoles | array of object | no | Openings through the skin, so the resin or powder left inside a skinned foam after printing can drain out: a closed skin otherwise traps it in the foam. At most 64, and only with a 'skin'. |
escapeHoles[].point | array of object | yes | Where the hole goes, [x, y, z] in millimetres in the Y-up working space the part is read into: a STEP file's Z-up numbers are turned a quarter about X first, so the file's +Y is -Z here, and the file's +Z is +Y, on or near the part's surface: the point is moved onto the nearest point of the surface, which may lie no farther from it than the hole's radius. The report gives the point used. |
escapeHoles[].radius | number | yes | The hole's radius in millimetres, at least 2 voxels so the hole is meshed round and open. |
escapeHoles[].direction | array of object | no | The hole's axis into the part, [x, y, z] of any length but none, in the same space as 'point', at most 80 degrees from the part's inward normal there. Defaults to that inward normal. |
outsideSeeds | refuse | drop | no | What happens to a point outside the part: 'refuse' (the default) refuses the request, 'drop' leaves the point out. |
coincidentSeeds | refuse | merge | no | What happens to points too close to each other: 'refuse' (the default) refuses the request, 'merge' makes them one cell. |
simplifyTolerance | number | no | How far, in millimetres, the written mesh may stray from the foam as meshed, so that it comes to fewer triangles: a larger tolerance gives fewer triangles and smaller files. The simplified mesh stays closed, no two of its triangles cross, a skinned foam's outer surface stays the part's own, and the sharp lines stay sharp. Defaults to 0.1 of the voxel; 0 writes the mesh unsimplified, with many more triangles. A foam that meshes to more than 6000000 triangles is refused: take a larger voxel. One whose mesh, simplified or not, comes to more than 1500000 triangles is refused too: give a larger simplifyTolerance, or take a larger voxel. |
outputs | object | no | Which mesh files the foam is written to. |
outputs.formats | array of string | yes | The files to write: 'stl' (binary STL) and '3mf' (a 3MF package of one mesh object, in millimetres). Both are written Z-up, as the STEP file stood. Defaults to 'stl'. |
Responses
| Status | Description |
|---|---|
202 | Task accepted |
400 | Validation error |
403 | Insufficient scope |
500 | Server error |
Example request
curl -X POST "https://api.bitbybit.dev/api/v1/cad/pro/lattices/plateau-foam" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ ... }'
Authentication: send your key in the x-api-key header. The full machine-readable specification is at openapi.json.