简体   繁体   English

Python-使用obj / stl文件和3d网格

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

I've never worked with 3d objects in any capacity, and especially not in Python. 我从未以任何能力使用过3d对象,尤其是在Python中。 I am currently working on a pet project where I have stl and obj files containing irregularly shaped objects. 我目前正在一个宠物项目中,其中有包含不规则形状对象的stl和obj文件。 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). 我不需要一个简单的方法来做到这一点(我不确定像Blender这样的东西是否适用,但是我想避免使用任何涉及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. 还有MeshPy ,我尝试过但未能正确下载。

If using Python is absolutely not recommended, I don't mind learning another language. 如果绝对不建议使用Python,那么我不介意学习另一种语言。 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. 我最初是从3D网格开始的,我必须创建一些例程来处理.stl文件。 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. 有几个可以与3D网格配合使用的python软件包。 The more popular ones are stl, vtk, openmesh and meshpy. 最受欢迎的是stl,vtk,openmesh和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. 也许最完整的是vtk,它具有许多类和功能。 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! 祝好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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