JSON and command line use¶
PyExtrusion can be used without writing a full Python application.
Use the canonical JSON examples for 0.19.0. trim_total_per_billet_m is total rejection per incoming billet. Legacy files retain their old meaning and require explicit Python migration, not just renaming a key. Canonical trim plus any non-null legacy trim (including zero) is rejected.
Command line identity¶
Validate an input file¶
pyextrusion validate press.json
pyextrusion validate planning_case.json --kind planning
pyextrusion validate production_sequence.json --kind sequence
Invalid values return controlled PX error codes.
Calculate a process or study from the CLI¶
JSON output:
Inspect actual-order events separately from commercial cuts:
pyextrusion calculate case.json --press press.json --fields geometry.cuts production.final_saw_events production.internal_billet_transitions production.puller_saw_events production.billet_saw_events --format json --pretty
These selectors belong to calculate. In planning JSON, order counters are in calculation.production, when a concrete calculation exists.
Planning from the CLI¶
pyextrusion plan planning_case.json --press press.json --bars 300
pyextrusion plan planning_case.json --press press.json --kg 2500
pyextrusion plan planning_case.json --press press.json --metres 1800
pyextrusion plan planning_case.json --press press.json --billets 20
pyextrusion plan planning_case.json --press press.json --hours 2
Production sequence from the CLI¶
pyextrusion sequence production_sequence.json
pyextrusion sequence production_sequence.json --format json --pretty
Compare presses from the CLI¶
Process:
Planning:
Sequence:
JSON input is strict¶
PyExtrusion intentionally rejects ambiguous or unsafe input forms.
Examples that are rejected:
The last example is rejected because 7 means 7 mm; PyExtrusion does not guess that the user intended 7 m.
Non-finite values such as NaN and Infinity are also rejected.
Discover result fields¶
pyextrusion fields
pyextrusion fields --section scrap
pyextrusion field production.bars_manufactured
Discover error codes¶
These commands are useful for software integrations because they expose the public identifiers instead of relying on guessed field names.