Skip to content

Getting ready for the next CadQuery release (new imprint and OCCT 8) #469

Backlog

Description

@shimwell

The 2D cross section stack (#465, #466, #467, #468) is built and tested against CadQuery 2.8.0, which is what CI picks up from pip. CadQuery main is now 2.9.0dev, with a new imprint and a move to OCCT 8, so I had a look at whether anything in the stack is going to break when that gets released.

Short version: nothing I could find. The full assembly test suite passes on CadQuery main. We should keep 2.8.0 as the version we support, but it's worth adding a CI job against CadQuery main so we find out about changes before they land in a release.

What's changing upstream

  • New assembly imprint (Better imprint for assy CadQuery/cadquery#2069, merged after 2.8.0): cadquery.occ_impl.assembly.imprint goes from BOPAlgo_MakeConnected to a plain BOPAlgo_Builder, and gets glue ("partial" by default, or "full") and tol (fuzzy value) arguments. The free function imprint in cadquery.func changes its default glue from "full" to "partial".
  • OCCT 8 (Start with OCP8 CadQuery/cadquery#2076, #2099): main now pins cadquery-ocp==8.0.1.1.
  • Still open: Add assy imprint method CadQuery/cadquery#2128 adds an in-place cq.Assembly.imprint() method and makes the free function booleans raise ValueError when OCCT reports an error. We don't use cadquery.func, and the Shape.cut / Workplane.cut methods we do use aren't affected.

Why the imprint change shouldn't change our results

BOPAlgo_MakeConnected in 2.8.0 already glues with BOPAlgo_GlueShift internally (see BOPAlgo_MakeConnected::MakeConnected in OCCT), and that's what glue="partial" maps to. So the default gluing is the same. The new version drops the material association step and reads the origins straight from Builder::Origins(), so it should be faster but give the same topology.

cad_to_dagmc 0.16 already handles both versions. It passes glue= when imprint accepts it and falls back to the old call on 2.8.0, which only allows "partial".

Also, the stack mostly takes imprint off the critical path. The revolved parts share their faces by construction, so imprinting only has to match up the things we still make in 3D: extra_cut_shapes such as PF coils, TF coils, and extra_intersect_shapes.

What I tested

I made a separate venv with CadQuery main (2.9.0.dev0, cadquery-ocp 8.0.1.1) and ran it against vacuum-from-2d-cross-section, the top of the stack:

  • tests/test_assemblies: 290 passed. The 24 skipped were the transport tests, because that venv had no cad_to_dagmc or openmc at first.
  • Transport tests with cad_to_dagmc 0.16 and openmc added: all 24 passed. That covers DAGMC meshing through cad_to_dagmc, which uses the new glue= path on main, and OpenMC transport for every reactor in test_imprint.py, the paper reactors and the vacuum tests.
  • The OCP calls in cross_section.py (BOPAlgo_Builder, Modified(), BRepPrimAPI_MakeRevol, ShapeUpgrade_ShapeDivideClosedEdges, TopoDS_Iterator) all still work on OCP 8.
  • tokamak() with PF coils and cases placed across curved layer boundaries (layer 4/5 at the midplane, layer 4/5 on the outboard shoulder, and layer 3/4 poking into the vacuum), at 180 and 360 degrees: no extra solids after imprinting, no overlaps, and the same shared faces on 2.8.0 and main.

Things to do / keep in mind

  • Add a CI job that runs the tests against CadQuery main (allowed to fail, or scheduled), so we see breakage before a release. The docs job already installs main for Fix slow vertical rotation in the Sphinx viewer on tall pages CadQuery/cadquery#2124.
  • pyproject.toml says cadquery>=2.6.0, but we only ever test the latest release. Either test 2.6/2.7 with the stack or raise the floor to 2.8.0.
  • Once 2.9 is out, see whether imprint(..., tol=...) helps with the nearly touching spline surfaces in the paper reactors, where we list the cuts by hand because the booleans aren't reliable.
  • Once Add assy imprint method CadQuery/cadquery#2128 is released, consider using Assembly.imprint() instead of our own calls in the tests.
  • "partial" glue assumes the solids only touch or share coincident faces and don't cut into each other. That's the same on 2.8.0, but it means imprint isn't a solid overlap check by itself, so test_extra_shape_overlaps.py should stay as the real check.
  • A small upstream thing: on main, imprint of an assembly with a single solid returns an origins dict keyed by the original compound rather than the returned solid (return s, {obj: (id_map[s],)}). It doesn't affect us because we always have several solids, and cad_to_dagmc skips imprinting below two solids, but it's worth reporting upstream.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions