Skip to main content

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​

Task accepted

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)

FieldTypeRequiredDescription
stepFileIdstringyesID 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.
fileUnitmm | cm | m | innoA unit of length: 'mm' (millimetres), 'cm' (centimetres), 'm' (metres) or 'in' (inches).
solidintegernoWhich 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.
seedsobjectnoThe 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.methodpoisson | random | gridnoHow 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.maxSpacingnumbernoPoisson: the least distance between two seeds, in millimetres. With 'grading', the spacing in the part's core.
seeds.minSpacingnumbernoPoisson 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.countintegernoRandom: how many seeds to place, at most 10000.
seeds.spacingnumbernoGrid: the distance between neighbouring grid points, in millimetres.
seeds.jitternumbernoGrid: 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.seedintegernoThe seed of the random choices: the same seed gives the same seeds. Defaults to 0.
seeds.relaxintegernoRounds 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.
pointsarray of arraynoYour 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.
weightsarray of numbernoWith 'points': one weight for each point, which makes power cells: a cell with a larger weight grows into its neighbours.
sizesarray of numbernoWith '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.
radiusnumbernoThe struts' radius in millimetres; with 'grading', the radius in the part's core. Needed unless 'sizes' gives each cell its own.
gradingobjectnoA change of the struts' radius, and of the seeds' spacing, from the part's surface to its core.
grading.depthnumberyesHow 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.skinRadiusnumbernoThe 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.fallofflinear | smooth | inverse | exponentialnoHow the values change over the depth: 'linear' (the default), 'smooth', 'inverse' or 'exponential'.
voxelnumbernoHow 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.
blendnumbernoHow far the struts blend into each other where they meet, in millimetres; 0 joins them without rounding. Defaults to half the least strut radius.
skinnumbernoThe 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'.
bownumbernoHow 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.
relaxRoundsintegernoRounds 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.
relaxStrengthnumbernoHow much of the way from the cells' own struts to the relaxed ones to go, from 0 to 1. Defaults to 1.
relaxDampingnumbernoThe share of each relaxation step taken, from 0.001 to 1. Defaults to 0.5.
surfaceStrutsnone | cellEdges | cellAndPartEdgesnoStruts 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.
edgessharp | roundednoHow 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.
edgeRadiusnumbernoWith 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.
smoothRoundsintegernoRounds 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.
escapeHolesarray of objectnoOpenings 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[].pointarray of objectyesWhere 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[].radiusnumberyesThe hole's radius in millimetres, at least 2 voxels so the hole is meshed round and open.
escapeHoles[].directionarray of objectnoThe 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.
outsideSeedsrefuse | dropnoWhat happens to a point outside the part: 'refuse' (the default) refuses the request, 'drop' leaves the point out.
coincidentSeedsrefuse | mergenoWhat happens to points too close to each other: 'refuse' (the default) refuses the request, 'merge' makes them one cell.
simplifyTolerancenumbernoHow 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.
outputsobjectnoWhich mesh files the foam is written to.
outputs.formatsarray of stringyesThe 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​

StatusDescription
202Task accepted
400Validation error
403Insufficient scope
500Server 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.