Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot convert .stp file to .h5m #88

Open
ctrossei opened this issue Jun 25, 2024 · 4 comments
Open

Cannot convert .stp file to .h5m #88

ctrossei opened this issue Jun 25, 2024 · 4 comments

Comments

@ctrossei
Copy link

Hello,

Thank you for creating this library!

I have been trying to use it to convert a .stp file to .h5m as described in the examples ( surface_mesh / single_stp_file.py). However it seems the process fails for me because original_ids and scrambled_ids (line 565-566 of core.py) end up having a different size and the comments in the code tell me that this should not be the case.

Unfortunately I cannot share the .stp file I am using, however if there are some things I can try to investigate this issue, please let me know.

@shimwell
Copy link
Member

Thanks for letting me know, I shall keep an eye out for similar behaviour

@ctrossei
Copy link
Author

So, I think I made it work for my case, although I will admit I am making a lot of guesses of what might have been wrong and how the code works.

I disabled all checks regarding the size of the original_ids, scrambled_ids and material_tags / material_tags_in_brep_order. The meshing phase (gmsh, volumes = _mesh_brep(...) went well, and generated 4266 faces and 770955 nodes (vertices?).
The code went on to the _vertices_to_h5m part and spent a lot of time in there, the memory usage increased to 30 GB until the process eventually segfaulted. Looking at the code in the _vertices_to_h5m function, it looked like lines 145 and 146

moab_verts = moab_core.create_vertices(vertices)
moab_core.add_entity(face_set, moab_verts)

were adding the same vertices repeatedly to the moab_core object (because it is inside two for loops), and so I modified the function for this not to happen, ie I commented out lines 145 and 146 and added moab_verts = moab_core.create_vertices(vertices) line 105 right after the moab_core object definition. I did not add back the moab_core.add_entity(face_set, moab_verts) line, however.

After this change the _vertices_to_h5m very quickly generated an .h5m file that I mbconverted to a.vtk that looks like my original step file at first glance.

@shimwell
Copy link
Member

shimwell commented Jun 26, 2024

Nice work. The other thing I occasionally try is to manually mesh with gmsh

manually meshing the step file gives good control over the mesh parameters

1 load up gmsh GUI
2 load in the step files
3 export a msh file (2d)

then continue from line 21 of this example
https://github.com/fusion-energy/cad_to_dagmc/blob/main/examples/surface_mesh/from_gmsh_mesh_file.py

@shimwell
Copy link
Member

I wonder if the step file has something inside that I've not considered. Some sort of nested comp solid or something else,

original_ids and scrambled_ids should be the same length so I guess something is getting expanded in the process

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

No branches or pull requests

2 participants