简体   繁体   English

如何在没有 GUI 应用程序的情况下在 Python 中固化 3D STL 文件(例如:Blender、MeshLab 等)

[英]How to solidify 3D STL file in Python without a GUI application (e.g: Blender, MeshLab, etc)

I am trying to solidify/add thickness to a 3D STL file for a research project.我正在尝试为研究项目巩固/增加 3D STL 文件的厚度。

So far, I can do that in Blender, but I don't want to solidify the object in Blender.到目前为止,我可以在 Blender 中做到这一点,但我不想在 Blender 中固化对象。 在 Blender 中使用solidify 修改器查看此图像

Are there other ways to solidify/add thickness to the STL file using commands/Python script without GUI application (like Blender, MeshLab, etc.)?是否有其他方法可以在没有 GUI 应用程序(如 Blender、MeshLab 等)的情况下使用命令/Python 脚本来巩固/增加 STL 文件的厚度?

Parse the STL file using whatever method you like (I've previously posted some Python STL parsing code here , but you could also use any existing libraries).使用您喜欢的任何方法解析 STL 文件(我之前在这里发布了一些 Python STL 解析代码,但您也可以使用任何现有的库)。

Then, identify all boundary edges.然后,识别所有边界边缘。 Each facet has 3 edges, which you can hash by their indices and count how many times each edge is found in the mesh.每个面都有 3 条边,您可以通过它们的索引对它们进行散列,并计算每条边在网格中出现的次数。 Boundary edges will only be found once.边界边缘只会被发现一次。

For each triangle, make a copy, flip it, and move its vertices by some amount in the direction of the copied triangle's normal.对于每个三角形,制作一个副本,将其翻转,然后将其顶点沿所复制三角形法线的方向移动一定量。

If the triangle had any boundary edges, you must generate 2 triangles per boundary edge to connect both the original and copied triangle.如果三角形有任何边界边,则必须为每个边界边生成 2 个三角形以连接原始三角形和复制的三角形。

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

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