Beta release notice: These changes are being validated before the final 2.0.4 release. Review reconstructed geometry and generated CAD documents before using them in production.
SimpleCADAPI 2.0.4b2 adds an Agent-oriented STEP/BREP reconstruction workflow. The release turns the existing inspection and strict-comparison utilities into a focused, framework-neutral tool surface for iterative reconstruction. It also adds replayable interpolated B-spline profiles for freeform and periodic input.
simplecadapi.inverse_engineer.brep now builds a bounded, cached BRepModel
for each STEP input. Bodies, Faces, Edges, and Vertices receive deterministic
zero-based identifiers such as body:0, face:12, and edge:4, allowing an
Agent to carry local topology references across inspection calls.
The model summary reports validity, material-body counts, bounds, volume, surface area, centroid, topology counts, and analytic surface/curve statistics. Optional bounded groups expose repeated carrier parameters, canonical axes, and adjacency signatures as evidence for a hypothesis; these groups do not infer a pattern by themselves.
Entity inspection reports geometry parameters, bounds, adjacency, endpoint differentials, and optional exact B-spline or Bezier definitions. Surface definitions remain explicitly separated from trim-loop evidence so an untrimmed carrier cannot be mistaken for a complete Face.
The new agent_tool_schemas() registry exposes 17 JSON-Schema-validated tools,
and call_agent_tool(...) dispatches them without depending on a particular
Agent framework:
get_model_summary inspect_entity
get_topology_neighborhood measure_relation
make_section extract_face_boundaries
probe_point render_region
compare_global_properties compare_boundary_distance
compute_material_difference compare_sections
build_difference_regions find_nearby_entities
compare_entities evaluate_result
compare_brep_strict
The simplecad-brep tools command prints the schemas. simplecad-brep tool
invokes one tool with an inline JSON object or an --arguments-file, so the same
contract is available to shell-driven Agents and external orchestrators.
Local query tools can expand a bounded topology neighborhood, measure supported parallel/coplanar/coaxial/concentric/perpendicular/touching/tangent relations, cut physical sections, extract ordered Face loops, and find the nearest indexed entities to a point. Compact section and boundary modes preserve structural evidence while omitting large sampled arrays.
Candidate diagnostics now include:
- global body, bounds, volume, area, centroid, and topology deltas;
- bidirectional sampled-boundary-to-exact-boundary distances;
- strict missing/excess material components from directional Boolean cuts;
- target/candidate section comparison on the same physical plane;
- ranked material or boundary difference regions and nearby entity lookup;
- local entity parameter and adjacency comparison.
evaluate_result(...) applies replay, BREP validity, material, bounds, volume,
area, and boundary gates in one report. Strict geometry-labelled incidence
comparison remains opt-in. Fuzzy Boolean results are diagnostic only and cannot
claim strict material equality.
render_region(...) renders selected stable entities and an optional topology
neighborhood over a translucent context model. Existing full-model
render_step_views(...) output remains available for synchronized isometric and
orthographic inspection.
Rendering now meshes a detached BREP copy. OpenCascade triangulation therefore cannot alter the cached model's measured bounds or influence a later Agent evaluation in the same process.
The public modeling API adds:
make_interpolated_spline_redge(...)
make_interpolated_spline_rwire(...)
make_periodic_spline_rwire(...)
Open and periodic curves interpolate their input points through the OCP kernel, validate minimum point counts and duplicate-point tolerances, and retain their construction data in graph metadata. Canonical model JSON records and strictly replays interpolated edges, including expression-valued points. Periodic profiles can be promoted into replayable Faces and Loft workflows.
The new reconstruction specification defines three explicit operating modes:
- inspection-only reconstruction restricts access to exact control arrays;
- report-assisted reconstruction permits targeted exact curve/surface data;
- exact BREP transcription permits complete carrier, trim, and topology evidence while requiring the result to be labelled as transcription.
The workflow requires isolated inputs and outputs, a written feature hypothesis, Sketch-first planar profiles unless a documented exception applies, fresh-process model replay, valid BREP output, and measured final classification. Expensive Boolean, dense boundary, and strict-topology checks are delayed until cheaper evidence shows that a candidate is close enough to justify them.
Regression coverage includes stable entity identifiers, bounded schemas, compact sections and boundary definitions, cross-model relation semantics, material-difference strictness, difference-region reuse, evaluation gates, region-rendering side effects, interpolated-curve replay, expression retention, and periodic-profile Loft replay.
A real STEP round trip was also exercised with a replayable drilled solid. The target and replayed STEP passed strict material, boundary, validity, and geometry-labelled incidence gates after both full-model and highlighted-region rendering.