Geometry calculations with STL file?

I have a friend who wants to calculate some things based on geometry described by STL files (basically he’s got an OpenSCAD model, and he wants to do things like calculate the volumes of different things, and then based on assumed density of material calculate weights, or find the center of mass of an assembly, or the distances between various points … etc)

Is there some Julia package that would make reading the STL file and doing various calculations relatively easy?

1 Like

I believe that tetgen would do the job.

How would that work? I’m not clear on what tetgen enables.

Tetgen is supposed to be able to read stl. Then it can generate a tet mesh, which enables the volume calculations your friend was calling for.

Is tetgen itself going to be able to do calculations involving volumes and centers of mass etc, or are you suggesting that the output of tetgen is something I can easily read into Julia and perform calculations on? If so, what packages would be useful for that?

FinEtools can perform the moments-of-volume calculations. https://github.com/PetrKryslUCSD/FinEtoolsAcoustics.jl/blob/9fed81300d79c31553fef828fba46922c943d814/examples/transient/water_hemis_td_struc.jl#L73