polyfoammesh.commercial.batch_mesh

Template-based batch meshing engine — journal system for CI/CD.

Records meshing actions into a replayable journal, then processes multiple geometry files sequentially or in parallel using the same template parameters.

Features:
  • Journal recording (every action → timestamped JSON log)

  • Batch processing queue (N geometry files, same parameters)

  • CLI headless mode for CI/CD pipelines

  • Progress tracking and summary report

Functions

main_cli()

Headless CLI entry point for CI/CD integration.

Classes

BatchConfig([geometry_dir, output_dir, ...])

Configuration for a batch meshing run.

BatchEntry(geometry_path[, label, status, ...])

A single geometry file in the batch queue.

BatchMesher([of_config])

Template-based batch meshing engine.

BatchReport([total, succeeded, failed, ...])

Summary report for a batch meshing run.

class polyfoammesh.commercial.batch_mesh.BatchEntry(geometry_path, label='', status='pending', cell_count=0, wall_time_s=0.0, error='')[source]

Bases: object

A single geometry file in the batch queue.

Parameters:
geometry_path: str
label: str = ''
status: str = 'pending'
cell_count: int = 0
wall_time_s: float = 0.0
error: str = ''
class polyfoammesh.commercial.batch_mesh.BatchConfig(geometry_dir='', output_dir='', pattern='*.step', max_cell=0.05, min_cell=0.01, detail='medium', bl_enabled=False, bl_n_layers=3, parallel=False, n_cores=1)[source]

Bases: object

Configuration for a batch meshing run.

Parameters:
geometry_dir: str = ''
output_dir: str = ''
pattern: str = '*.step'
max_cell: float = 0.05
min_cell: float = 0.01
detail: str = 'medium'
bl_enabled: bool = False
bl_n_layers: int = 3
parallel: bool = False
n_cores: int = 1
class polyfoammesh.commercial.batch_mesh.BatchReport(total=0, succeeded=0, failed=0, entries=<factory>, started_at='', wall_time_s=0.0)[source]

Bases: object

Summary report for a batch meshing run.

Parameters:
total: int = 0
succeeded: int = 0
failed: int = 0
entries: list[BatchEntry]
started_at: str = ''
wall_time_s: float = 0.0
class polyfoammesh.commercial.batch_mesh.BatchMesher(of_config=None)[source]

Bases: object

Template-based batch meshing engine.

Usage (CLI):

python -m polyfoammesh.commercial.batch_mesh \
    --geometry-dir ./models --pattern "*.step" \
    --max-cell 0.05 --min-cell 0.01

Usage (API):

bm = BatchMesher()
bm.add_file("model1.step")
bm.add_file("model2.step")
report = bm.run_all()
print(f"{report.succeeded}/{report.total} succeeded")
Parameters:

of_config (OFConfig | None)

configure(config)[source]
Return type:

None

Parameters:

config (BatchConfig)

add_file(geometry_path, label='')[source]
Return type:

None

Parameters:
  • geometry_path (str)

  • label (str)

add_directory(directory, pattern='*.step')[source]

Add all matching files from a directory. Returns count.

Return type:

int

Parameters:
  • directory (str)

  • pattern (str)

run_all()[source]

Process all queued geometry files sequentially.

Return type:

BatchReport

export_report(path)[source]

Export the batch report as JSON.

Return type:

None

Parameters:

path (Path | str)

polyfoammesh.commercial.batch_mesh.main_cli()[source]

Headless CLI entry point for CI/CD integration.

Usage:

python -m polyfoammesh.commercial.batch_mesh \
    --geometry-dir ./cad_models --pattern "*.step" \
    --max-cell 0.05 --min-cell 0.01 --output-dir ./meshed
Return type:

None