我正在使用 Autodesk Fusion 360 对 3D 零件进行建模(参见下图),然后可以将其导出并保存为 .step、.iges、.sat 或 .smt 文件。
我想要实现的目标是将这部分转换为Python中的3D numpy数组。数组的每个元素将是0 or 1指示该位置是否有固体材料或根本没有材料(空气)。
For example, if my object has the dimensions of the figure, each element of an array of size 100x100x50 would represent a volume of 1 mm3 of the object. All the light blue little cubes will have a value of 1 to show that there is solid material at this position, while the red cube will have a value of 0 to indicate that this space does not consist of solid material.
这可以使用 FreeCAD API 来完成吗?或者是否有其他方法可以在 Python 中导入 .step/.iges/.sat/.smt 文件并转换/解析它以创建所需的数组?
我终于找到了一种适合我的方法,并且实际上可以更好地解释我一直在努力实现的目标。
显然,FreeCAD 有一个选项,在激活“点”工作台后,您可以选择将对象转换为“点云 https://en.wikipedia.org/wiki/Point_cloud“。每个点没有任何质量,整个新的点云结构可以导出到以空格分隔的“.asc”文件中。
之后,将其导入 Python numpy 数组就很简单了。我个人用过一个基于体素的 https://en.wikipedia.org/wiki/Voxel表示在 Python 中可视化导入的对象,这可以使用最新的 matplotlib 或 mayavi 来完成(这是我至少尝试过的两个)。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)