Workflow, defects, tuning, vision¶
openwaam.workflow.plan_build(part, process, arm='abb_irb2600', part_frame=None, feature_power=None, ds=0.002)
¶
Slice part for the bead that process lays and plan the motion.
anything with height and layers(layer_height, step_over)
(for example openwaam.parts.Impeller).
feature_power: arc power multiplier per feature name, e.g. {"blade": 0.85}.
Needs part.feature(layer, polyline).
arm: robot name, or None to skip inverse kinematics (the TCP timing is the same).
openwaam.workflow.thermal_history(plan, material, voxel=0.003, interpass_temperature=None, pool_conductivity_factor=3.0, substrate_thickness=0.012, substrate_margin=0.03, final_cooling=600.0, probes=None, verbose=False, **cfg)
¶
Run the part-scale thermal model over the whole build and return it.
Read model.summary(), model.fields() and model.probe_T afterwards.
openwaam.workflow.from_image(image, diameter, material='IN718', process=None, outdir='from_image', index=0, voxel=0.004, interpass_temperature=473.15, arm='abb_irb2600', feature_power=None, verbose=True, **overrides)
¶
Photo of an impeller -> model, robot program, thermal-history maps and defect indicators (template route: the blade count comes from the photo). Returns (estimate, plan, model, report).
openwaam.defects.DefectCriteria
dataclass
¶
(ok, bad) pairs: risk is 0 at ok and 1 at bad, linear in between.
openwaam.defects.criteria_for(material_name)
¶
openwaam.defects.assess(fields, criteria=None, same_bead_gap=5.0, include_surface=False)
¶
Turn ThermalModel.fields() into risk maps and a score.
openwaam.defects.plot_maps(fields, maps, path=None, heights=(0.25, 0.6), angle=0.0, title=None, cmaps=None, limits=None)
¶
One row per map: an axial section and horizontal sections at the given fractions of the height.
openwaam.tune.coordinate_search(evaluate, space, start, rounds=1, verbose=True)
¶
Vary one setting at a time over its listed values, keep the best, move on.
evaluate(settings) -> (objective, info). Results are cached, so a setting already tried costs nothing. Returns (best settings, log of every run).
openwaam.vision.impeller_from_image(image, diameter, index=0, template=None, describe=None, **overrides)
¶
Impeller estimated from a photo.
diameter: outer diameter in metres (a photo has no scale). index: which part to use if the image shows several (reading order). describe: optional function(cropped PIL image) -> dict of Impeller fields, for example a call to a vision-language model. Its values replace the template's; explicit keyword overrides win over both.
openwaam.vision.count_blades(gray, mask, n_min=5, n_max=45)
¶
Blade count from the angular periodicity of the image on rings around the centre. Returns (count, confidence, tilt in degrees).
openwaam.workflow.run_part(part, material='IN718', process=None, outdir='out/part', voxel=0.004, interpass_temperature=473.15, arm='abb_irb2600', feature_power=None, thermal=True, verbose=True, extra=None)
¶
Everything after the geometry: plan, robot program, thermal history, maps, defect indicators.
Writes part.stl, part.mod (RAPID, for an ABB arm), part.gcode, report.json and, with thermal=True, history_maps.png and defect_maps.png. Returns (plan, model, report).
openwaam.workflow.from_images(images, size, kind='auto', height=None, bore=0.0, wall=None, material='IN718', process=None, outdir='from_images', part_voxel=0.0015, reorient=True, thermal=True, verbose=True, backend='trellis2-space', backend_options=None, **kw)
¶
Photo(s) of any part -> solid, robot program, thermal-history maps and defect indicators.
kind 'extrude', 'revolve', 'auto' or a dict of views use silhouettes
(vision.part_from_images). kind='learned' sends one photo through an
image-to-3-D model (reconstruct.image_to_solid, backend and
backend_options choose and configure it). kind='mesh' takes a mesh file
instead of an image. With reorient=True the build
direction with the least overhang is chosen. Returns (solid, plan, model, report).
openwaam.vision.part_from_images(images, size, kind='auto', height=None, bore=0.0, wall=None, voxel=0.0015, index=None, name=None)
¶
A printable solid from one or more photos of a part on a plain background.
one image (path, PIL image or array), or a dict with any of the keys
'front', 'side', 'top' for a visual hull.
size: largest extent of the part in the image plane, metres ('front' or
'top' width for a hull).
kind: 'extrude' the photo looks straight down on a flat part; give height
'revolve' the photo is a side view of a round part with a vertical axis;
bore is the radius of a through hole, or wall the thickness of a
thin-walled shell (neither is visible from the side)
'hull' images is a dict of views
'auto' hull for a dict, otherwise revolve when the outline is mirror
symmetric without windows, else extrude
Returns a VoxelSolid whose source says how it was made.
openwaam.vision.silhouette(image, index=None, min_hole=0.002, threshold=20.0)
¶
Mask of the part in a photo on a plain background (True = part), cropped to it.
Holes larger than min_hole of the image are kept (bolt holes, windows of a
truss); smaller ones are glare and are filled. index=None takes everything
that is not background, an integer takes that part in reading order.
Returns mask[row, col].
openwaam.solids.VoxelSolid
dataclass
¶
occ[ix, iy, iz] is True where there is metal; iz = 0 sits on the build plate. h is the voxel edge, m.
analysis(bead_width=None, max_overhang_deg=30.0)
¶
Numbers behind printability: share of the volume no layer below supports
within the overhang limit, share in islands that start in mid-air, and
share in walls thinner than 0.7 bead widths.
best_orientation(max_overhang_deg=30.0)
¶
Try the six axis-aligned build directions; return (copy in the best one, its name, table of scores). The score is the unsupported share of the volume, then the height.
coverage(layer_height, step_over, pixel=0.0005)
¶
How well the planned beads fill the slices: share of the part within 0.6 step-overs of a bead centreline, and bead area laid outside the part relative to the part.
extrude(mask, pixel, height, h=None, name='extrusion')
classmethod
¶
mask[ix, iy] (True = metal), pixel size in metres, extruded to height.
frame(size, tubes=(), bosses=(), plates=(), holes=(), h=0.0015, name='frame')
classmethod
¶
A space frame drawn from primitives, in a box of size (x, y, z metres) standing on the build plate.
tubes: (points (N, 3), radius): a round bar along the polyline bosses: (x, y, z0, z1, radius): an upright cylinder plates: (three corner points, thickness): a flat triangular web holes: (x, y, radius): a vertical through hole
from_stl(path, h=0.0015, name=None)
classmethod
¶
Voxelise a closed triangle mesh (even-odd fill of every slice).
iou(other)
¶
Overlap with another solid of the same voxel size, both centred in x, y and sitting on the plate.
layers(layer_height, step_over, ds=0.0025, pixel=0.0005, return_masks=False)
¶
Planar slices as bead centrelines for Toolpath.from_contours.
oriented(up)
¶
Copy with the given axis pointing up: one of '+z', '-z', '+x', '-x', '+y', '-y'.
revolve(z, r_outer, r_inner=None, h=0.0015, name='revolved')
classmethod
¶
Solid of revolution about z from the outer (and optionally inner) radius at heights z.
shell_of_revolution(z, r_outer, wall, h=0.0015, name='shell')
classmethod
¶
Thin-walled solid of revolution: the outer radius at heights z, and a wall thickness.
supported(max_overhang_deg=30.0)
¶
(mask of metal that rests, layer by layer, on supported metal; number of voxels in islands that start in mid-air).
trimmed()
¶
Copy cropped to the occupied box, with one empty voxel around it in x and y.
visual_hull(front=None, side=None, top=None, h=0.0015, size=None, name='visual hull')
classmethod
¶
Largest solid consistent with up to three orthographic silhouettes.
front[ix, iz] looks along +y, side[iy, iz] along -x, top[ix, iy] straight
down; all True = metal, any two are enough. size is the length of the
part along x in metres (along y if there is no front or top view).
openwaam.reconstruct.image_to_solid(image, size, backend='trellis2-space', h=0.0015, up='auto', mesh_out=None, **backend_options)
¶
Photo -> mesh (learned model) -> VoxelSolid ready for workflow.run_part.
'trellis2-space', 'trellis2-local', or any function
f(image, out=None, **options) -> path of a mesh file.
size: largest extent of the real part, metres.
openwaam.reconstruct.mesh_to_solid(mesh, size, h=0.0015, up='auto', name='part')
¶
A printable VoxelSolid from a mesh file or a triangle array.
size: largest extent of the part in metres (generated meshes have no scale). up: 'auto' picks the build direction with the least overhang; or one of '+z', '-z', '+x', '-x', '+y', '-y' in the mesh's own axes.
openwaam.reconstruct.trellis2_local(image, out=None, resolution='1024', seed=0, model=TRELLIS2_MODEL, pipeline=None)
¶
Run TRELLIS.2 on this machine and write the geometry as an STL. Returns the path.
Follows the model's own example: Trellis2ImageTo3DPipeline.from_pretrained,
pipeline.run(image). Only the geometry is exported (no texture baking).
Pass a loaded pipeline to reuse it across images.
openwaam.reconstruct.trellis2_space(image, out=None, resolution='1024', seed=0, space=TRELLIS2_SPACE, token=None, decimation_target=500000, texture_size=1024, client=None)
¶
Run TRELLIS.2 in a hosted Gradio Space and download the GLB. Returns the path.
Calls the Space's three steps in order: preprocess the image (background
removal), generate, extract the GLB. space is the Space id or URL; a
duplicate of the official demo works the same way. Needs gradio_client.
openwaam.defects.defect_map(fields, criteria=None, map_criteria=None)
¶
Map of possible lack of fusion and porosity from ThermalModel.fields().
Lack of fusion: metal inside the part that a later bead was laid on or beside without taking it
back to its solidus (the lack_of_fusion indicator of assess), and first-layer metal on plate
that never reached its solidus. Porosity: metal that came close to boiling (vaporisation), or
that froze so fast that gas had little time to leave (gas entrapment). Marked voxels are joined
into regions with a position and a size. This is a screening map: the thresholds are starting
points and have not been calibrated against sectioned or scanned builds.
openwaam.defects.DefectMap
dataclass
¶
Possible lack of fusion and porosity inside a part, voxel by voxel and as connected regions.
kind int array on the part's voxels: 0 sound, 1 possible lack of fusion, 2 possible porosity, 3 both; -1 outside lof, porosity the two risks, 0..1, NaN outside the part regions list of dicts, largest first: id, type, cause, voxels, volume_mm3, equivalent_diameter_mm, centroid_mm, extent_mm, layers [first, last], max_risk
plot(path=None, title=None)
¶
Three cuts through the worst places (or the middle of a sound part) and the list of the largest regions.
openwaam.defects.DefectMapCriteria
dataclass
¶
What counts as a possible defect on the map. Screening thresholds, not calibrated.
openwaam.partscale.mechanics.estimate_distortion(thermal, setting='isotropic', clamp='bottom', release=True, coarsen=(3, 3, 1), layers_per_step=1, material=None, **kw)
¶
Distortion of a finished thermal run with one of the named settings, with what it is worth.
Returns the summary of the result (max_displacement, substrate_bow, ...) plus the setting, what it was calibrated on, where it fails, a plain statement of confidence, and the DistortionResult itself under "result". Use "wall" for long single-bead walls and "block" for solid multi-bead sections; for anything else the answer is an order of magnitude at best.
openwaam.cost.CostRates
dataclass
¶
Rates of the cost model. All are assumptions to be replaced by the user's own.
openwaam.cost.build_cost(material, wire_mass, arc_time, build_time, arc_energy_kwh, rates=None)
¶
Cost of one build.
wire_mass in kg (deposited), arc_time and build_time in seconds (build time includes the waiting between layers), arc_energy_kwh the electrical energy of the arc (voltage x current x arc time). Returns the six parts, their total, the share of each, the cost per kg deposited and the rates used.
openwaam.cost.cost_of_build(plan, model, material, rates=None)
¶
Cost of a planned and simulated build (a BuildPlan and its ThermalModel after the run).
openwaam.cost.cheapest_within(log, tolerance=0.02, score='score', cost='cost')
¶
Of the evaluated settings whose score is within tolerance of the best score, the cheapest.
log: dicts with a score (lower is better) and a cost. This is how a search over process settings is turned into a choice on cost: the indicators decide which settings are acceptable, the cost decides among them.
openwaam.certify.AcceptanceCriteria
dataclass
¶
Limits the simulated build is checked against. None switches a check off ("not evaluated").
openwaam.certify.certify_part(part, material='ER70S-6', process=None, outdir='out/certify', criteria=None, distortion='isotropic', arm='abb_irb2600', voxel=0.004, interpass_temperature=473.15, part_id=None, operator=None, feature_power=None, verbose=True, clamp='bottom')
¶
Plan, simulate, map defects, estimate distortion, check against the limits, and write the sealed record.
part a solid from openwaam.solids or openwaam.parts (see VoxelSolid.from_stl)
distortion a name from DISTORTION_SETTINGS ("wall", "block", "isotropic") or None to leave it out
Returns the record (also written to outdir/record.json with report.html beside it).
openwaam.certify.build_record(plan, model, defect, material, outdir, criteria=None, distortion=None, part_id=None, operator=None, interpass_limit=None, files=(), rates=None)
¶
Assemble, check and seal the record of a planned and simulated build. Writes record.json and report.html.
openwaam.certify.verify_record(path, base=None)
¶
Recompute the seal of a record and the hashes of its files. Returns dict(ok, problems).
openwaam.certify.compare_with_log(record_path, log_csv, out=None, tolerance=0.1, interpass_margin_C=0.0)
¶
Set the log of the real build against the planned record.
log_csv: one row per layer with a layer column (1-based) and any of current_A, voltage_V,
travel_speed_mm_s, wire_feed_m_min, interpass_temperature_C. A value further than tolerance
(relative) from the plan, or an interpass temperature above the record's limit, is a deviation.
Writes a new sealed record (default: record_as_built.json beside the original) and returns it.