Skip to main content

Flexible geometry API

cadflow.flexible describes authored static thin forms using sparse control grids and deterministic sampling. It produces indexed triangle meshes; it does not calculate motion, equilibrium, loads, or time evolution.

Object model

TypeResponsibility
FlexibleMaterialThickness and appearance metadata
FlexiblePanelOne rectangular control grid and sampling policy
FlexiblePanelMeshBuilt vertices, normals, triangles, and material for one panel
FlexibleModelOrdered collection of uniquely named panels
FlexibleMeshCombined arrays, panel ranges, measurements, and export
RingSectionElliptical section used by sectioned_panel

Build a panel

from cadflow.flexible import FlexibleMaterial, FlexibleModel, FlexiblePanel

panel = FlexiblePanel(
name="cover",
control_points=(
((0, 0, 0), (0, 50, 5), (0, 100, 0)),
((60, 0, 3), (60, 50, 16), (60, 100, 3)),
((120, 0, 0), (120, 50, 5), (120, 100, 0)),
),
sample_rows=36,
sample_columns=44,
material=FlexibleMaterial(name="coated fabric", thickness=1.2),
)
model = FlexibleModel("protective-cover")
model.add_panel(panel)
mesh = model.build()

The control array must have shape (rows, columns, 3), contain at least a 2x2 grid, and contain only finite values. Sample counts must be integers no smaller than the corresponding control dimensions.

Periodic sections and thickness

Set periodic_columns=True for a wrapped column direction and provide at least three distinct control columns. Do not duplicate the first column at the end. sectioned_panel constructs this form from ordered RingSection values.

Thickness 0 produces a single surface. Positive thickness creates normal-offset sides and closes remaining boundaries. All dimensions and downstream tolerances must use one consistent unit convention.

Combined mesh

FlexibleModel.add_panel rejects duplicate panel names. build() concatenates panels deterministically and records each panel's vertex and triangle range in mesh.panels.

FlexibleMesh memberMeaning
vertex_count, triangle_countCombined element counts
boundsAxis-aligned minimum and maximum points
surface_areaTriangle area sum
is_watertightEvery undirected triangle edge occurs exactly twice
write_obj(path)Grouped mesh with normals and panel identity
write_stl(path)Combined binary triangle mesh
write_json(path)Arrays, panel ranges, material data, bounds, and metrics

Validate counts, bounds, seam continuity, panel ranges, and expected watertightness before delivery. See all 10 Flexible symbols.