Skip to content

Conversation

@jmwright
Copy link
Member

@jmwright jmwright commented May 6, 2025

@shimwell Please take a look and see if this addresses #17 . Please note the new test, and I have attached the sample msh file that is generated by that test.

tagged_imprinted_mesh.msh.zip

I can restructure the new code if desired. This method combines creating the mesh and writing it unlike the previous methods. I also do not currently include physical groups for non-tagged surfaces. I cannot remember if we've discussed whether physical groups for non-tagged surfaces are important.

This method also does not support subshapes, but that will be easy enough to add if this method seems like it will work for you.

@jmwright jmwright requested a review from shimwell May 6, 2025 16:50
@shimwell
Copy link
Collaborator

shimwell commented May 7, 2025

I am seeing this error in the CI

I guess we need to update this line in the environment.yml file which installs cadquery stable. I guess we need the cadquery master from cadquery channel
https://github.com/CadQuery/assembly-mesh-plugin/blob/d1f6a8f4c0f5286c0f5e9fffd8bbf590337ff637/environment.yml#L6C1-L6C13

         for s in res.Solids():
            ids = tuple(id_map[Solid(el)] for el in bldr.GetOrigins(s.wrapped))
            # if GetOrigins yields nothing, solid was not modified
>           origins[s] = ids if ids else (id_map[s],)
E           KeyError: <cadquery.occ_impl.shapes.Solid object at 0x7f879e024e50>

/usr/share/miniconda/envs/tagged-meshes/lib/python3.11/site-packages/cadquery/occ_impl/assembly.py:596: KeyError
----------------------------- Captured stderr call -----------------------------
Warning : Gmsh has aleady been initialized
=============================== warnings summary ===============================
<frozen importlib._bootstrap>:241
  <frozen importlib._bootstrap>:241: DeprecationWarning: builtin type SwigPyPacked has no __module__ attribute

<frozen importlib._bootstrap>:241
  <frozen importlib._bootstrap>:241: DeprecationWarning: builtin type SwigPyObject has no __module__ attribute

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED tests/test_meshes.py::test_imprinted_assembly - KeyError: <cadquery.occ_impl.shapes.Solid object at 0x7f879e024e50>
=================== 1 failed, 6 passed, 2 warnings in 3.92s ====================
sys:1: DeprecationWarning: builtin type swigvarlink has no __module__ attribute

@shimwell
Copy link
Collaborator

shimwell commented May 7, 2025

@SteSeg this PR should make the sort of flexible meshing from cadquery assembly possible

I attempted the cadquery assembly meshing here but found imprinting was needed fusion-energy/cad_to_dagmc#132

So Jeremy has kindly added imprinting to the package

Feedback welcome

@shimwell
Copy link
Collaborator

Looks good to me, LGTM

@jmwright jmwright marked this pull request as ready for review May 15, 2025 10:42
@jmwright jmwright merged commit f967ac5 into main May 15, 2025
6 checks passed
@jmwright jmwright deleted the imprint branch November 24, 2025 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants