Loading and merging STL files using python script

More
5 years 9 months ago #1422 by spuri
Hello,

Is it possible to do the following using a python script. I am able to do it using GUI.

1. load a binary STL file,
2. create a volume mesh,
3. merge similarly created multiple volume mesh.

Thanks for helping.

Saurabh
More
5 years 9 months ago #1424 by joachim
Hi Saurabh,

you can merge meshes with a little Python programming, here is a similar usecase:

ngsolve.org/docu/latest/i-tutorials/unit...e-dimensional-meshes

Joachim
More
5 years 9 months ago #1426 by spuri
Hello Joachim,

Thanks a lot for the quick response. I followed the link you suggested, however, I am getting following error during the creation of volume mesh.:

netgen.libngpy._meshing.NgException: Stop meshing since boundary mesh is overlapping

Could you please suggest a way to resolve this issue?

Thanks,
Saurabh
More
5 years 9 months ago #1427 by joachim
Maybe something with the index conversion went wrong.

It's best to draw the merged meshes (surface and or volume). For that you have to wrap the Netgen-mesh into an NGSolve mesh first:

import ngsolve as ngs
ngsmesh = ngs.Mesh(netgenmesh)
Draw (ngsmesh)

You can also post your py-codes and meshes.

Joachim
More
5 years 9 months ago #1458 by spuri
Hello Joachim,

Thanks again for your response. I am still getting the issue of overlapping elements. I have attached two STL files and the python script I am using to merge them. I can mesh and merge these STL files using the GUI, but not with python.

It would be great if you could take a look at the files and guide me in sorting the issue.

Regards,
Saurabh
Time to create page: 0.106 seconds