Simulation handoff
CadFlow describes distributed contact between assembly faces without committing to Abaqus, CalculiX, Code_Aster, ANSYS, or a particular mesher. C++/OCCT measures exact BREP geometry; Python owns named regions, units, materials, constitutive declarations, validation, and package layout.
CadFlow is a preprocessor and handoff boundary, not a finite-element solver.
Define stable surface regions
Start from an assembly whose contacting components are direct Part values. Select the intended faces in component-local coordinates:
top_face = max(block_a.get_faces(), key=lambda face: face.get_center().z)
bottom_face = min(block_b.get_faces(), key=lambda face: face.get_center().z)
surface_a = cad.make_surface_region_rsurfaceregion(
surface_id="base.top",
component_id="base",
faces=(top_face,),
)
surface_b = cad.make_surface_region_rsurfaceregion(
surface_id="slider.bottom",
component_id="slider",
faces=(bottom_face,),
)
Each face becomes a replayable GeometryRef. Validation resolves the selector against current geometry and rejects missing or ambiguous matches.
Declare physics and units
law = cad.SurfaceContactLaw(
"dry_contact",
normal_model="penalty",
normal_penalty_stiffness=2.0e5, # N/mm^3
friction_model="coulomb",
friction_coefficient=0.2,
tangential_penalty_stiffness=8.0e4, # N/mm^3
)
pair = cad.SurfaceContactPair(
"slider_pair",
"base.top",
"slider.bottom",
"dry_contact",
search_tolerance=0.2,
sliding="finite",
)
steel = cad.MechanicalMaterial(
"steel",
youngs_modulus=210000.0, # N/mm^2
poisson_ratio=0.3,
density=7.85e-9, # N*s^2/mm^4
yield_stress=355.0,
)
Supported declarations include hard, penalty, tabular, and cohesive normal laws, plus frictionless or Coulomb tangential response. CadFlow validates required parameters and dimensions but never invents engineering values from names or geometry.
Analyze and export
report = cad.validate_contact_simulation_model_rcontactsimulationvalidationreport(
simulation, assembly
)
report.raise_for_errors()
analysis = cad.analyze_contact_simulation_model_rcontactsimulationanalysis(
simulation, assembly
)
print(analysis.pair_metrics)
manifest = cad.export_contact_simulation_package_rpath(
simulation, assembly, "outputs/contact-package"
)
The package contains simulation.json, component-local BREP solids, selected BREP faces, hashes, stable face indices, material assignments, and row-major rigid transforms. A solver adapter can mesh the solid, recover each contact face, apply its assembly placement, and translate the neutral law into solver-specific input.
Know the boundary
- Exact metrics and package export require the OCCT backend.
- Candidate detection is geometric preprocessing evidence, not collision detection or a nonlinear solve.
- Mesh density, element formulation, load cases, boundary conditions, stepping, stabilization, and convergence remain solver responsibilities.
- Nested assemblies must be flattened or expose target parts directly for the current surface resolver.