简体   繁体   中英

Python - Working with obj/stl files and 3d meshes

I've never worked with 3d objects in any capacity, and especially not in Python. I am currently working on a pet project where I have stl and obj files containing irregularly shaped objects. I would like to eventually be able to calculate the surface area of these objects, and also to be to find the circumference at various points along the object. I would also like to able to find the surface area between various circumferences.

I don't need an easy way to do this (I'm not sure how applicable something like blender would be, but I would like to avoid using anything that involves a GUI). This is more than anything an exercise, so even if it takes months, I would prefer to output code as opposed to just having the numbers.

Some of the things that I've found and have been playing with are

from stl import mesh

and also MeshPy , which I've tried and failed to download properly.

If using Python is absolutely not recommended, I don't mind learning another language. I'm just really lost on where to start with this.

I've actually the same problem two months ago. I was first started with 3D meshes and I had to create some routines to work with .stl files. In order to provide you a better response, could you provide me which are the specific utilities you're looking for?

There are several python packages that are capable to work with 3D meshes. The more popular ones are stl, vtk, openmesh and meshpy. You can use either one or another depending on your aim. Maybe the most complete is vtk, which has lots of classes and functionalities. However, if you come from a non-informatic background (I'm physicist for instance), this package is object orientated so you may have problems at the beginning.

As said, It will be usefull if you can share the utilities you're looking for in order to give you a more accurate response. Good luck!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM