Skip to main content

Standard library and translators

Standard library

cadflow.stdlib provides parameterized reusable components. The current public inventory includes spur, helical, herringbone, bevel, ring, rack, and cycloidal gear geometry.

from cadflow.stdlib import make_spur_gear_rsolid

gear = make_spur_gear_rsolid(
n_teeth=24,
module=2.0,
pressure_angle=20.0,
gear_height=8.0,
backlash=0.05,
)

Gear constructors validate tooth counts, module, pressure angle, height, clearance, and family-specific parameters. They return compatibility solids that can participate in products, recording, serialization, and export. Record the full parameter set; a gear name alone is not enough to reproduce geometry.

See the standard-library catalog for all 13 exports.

Translators

The Fusion 360 and SolidWorks translators compile supported Model JSON operations into target-oriented scripts. Translator classes expose capability data and structured translation reports; convenience functions return script text or, where supported, orchestrate STEP output through the target application.

from cadflow.translators.fusion360_translator import (
translate_model_json_to_fusion360_script,
)

script = translate_model_json_to_fusion360_script(
model_json,
document_name="CadFlowBracket",
result_node_ids=result.result_node_ids,
)

Capability boundary

Translation is operation-aware, not arbitrary source-code conversion. Before delivery:

  1. Inspect the translator capability record.
  2. Use canonical Model JSON with explicit terminal nodes.
  3. Review diagnostics for unsupported or approximated operations.
  4. Run generated scripts only in a controlled target-application environment.
  5. Compare exported geometry and dimensions with the CadFlow source result.

Script generation itself does not prove that the target application version, licenses, add-ins, filesystem policy, or interactive session are available. SolidWorks STEP export has external side effects and should be isolated from pure translation tests.

See all 13 Translator symbols.