简体   繁体   English

将3D numpy数组保存为.obj文件

[英]Save 3D numpy array as a .obj file

I have a 3D numpy array that I generated using some code. 我有一个3D numpy数组,我使用一些代码生成。 I want to save that array as a .obj file to open it in another software like Blender. 我想将该数组保存为.obj文件,以便在Blender等其他软件中打开它。 How do I achieve this? 我该如何实现这一目标?

Have a read of the wavefront obj file format and output your data to match. 读取wavefront obj文件格式并输出您要匹配的数据。

Alternatively, you can adjust your script to create the object directly in blender. 或者,您可以调整脚本以直接在blender中创建对象。 You would use Blenders bmesh module to create the mesh data. 您可以使用Blenders bmesh模块来创建网格数据。 You might be able to find some examples like this at blender.stackexchange where you can ask for more specific help generating the mesh. 你也许可以找到一些例子像这样blender.stackexchange在那里你可以要求更具体的帮助生成网格。 If you still want the obj file you can export it from blender. 如果你仍然想要obj文件,你可以从blender导出它。

Depending on the algorithm you use to make your mesh, you may also be able to make use of the math function object generators that are in the extra objects addon that is included with blender. 根据您用于制作网格的算法,您还可以使用数据函数对象生成器,这些生成器位于blender附带的额外对象插件中。 This addon is also another place for example scripts. 这个插件也是脚本的另一个地方。

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

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