[英]PyMeshLab - MLS projection APSS - current and proxy mesh ID for loop
I'm trying to process a batch of STL files through pymeshlab.我正在尝试通过 pymeshlab 处理一批 STL 文件。 I'm using two filters, ie, "remeshing_isotropic_explicit_remeshing" and "mls_projection_apss".
我使用了两个过滤器,即“remeshing_isotropic_explicit_remeshing”和“mls_projection_apss”。 The problem arise with filter "mls_projection_apss" which by default uses mesh id = 0 for both control and proxy mesh, resulting in algorithm always using the mesh with id 0 for all future iterations.
问题出现在过滤器“mls_projection_apss”上,默认情况下,控制和代理网格都使用网格 id = 0,导致算法始终使用 id 为 0 的网格进行所有未来迭代。
Please help me with how to define that ID of current mesh in the meshset is used as control and proxy mesh instead of default "0".请帮助我如何定义网格集中当前网格的 ID 用作控制和代理网格而不是默认的“0”。
Current code:当前代码:
for filename in os.listdir(inputdir):
if filename.endswith(".stl"):
ms.load_new_mesh (os.path.join(inputdir, filename))
print(os.path.join(filename))
ms.current_mesh_id()
print(ms.current_mesh_id())
ms.remeshing_isotropic_explicit_remeshing(targetlen=0.1, checksurfdist=True, maxsurfdist=0.1)
ms.mls_projection_apss(controlmesh=, proxymesh=, filterscale=2)
ms.save_current_mesh(os.path.join(outputdir_2, filename))
This is working for me, but I'm not sure if it is what you want.这对我有用,但我不确定它是否是您想要的。 One problem that I have detected is that
ms.mls_projection_apss()
seems to change current_mesh to 0, so ms.save_current_mesh()
is saving the original mesh and not the result of the MLS filter.我检测到的一个问题是
ms.mls_projection_apss()
似乎将 current_mesh 更改为 0,因此ms.save_current_mesh()
正在保存原始网格而不是 MLS 过滤器的结果。
import pymeshlab as ml
ms = ml.MeshSet()
for filename in os.listdir(inputdir):
if filename.endswith(".stl"):
ms.load_new_mesh (os.path.join(inputdir, filename))
m = ms.current_mesh()
print(os.path.join(filename), ms.current_mesh_id(), m.vertex_number(), 'vertex', m.face_number(), 'faces' )
ms.remeshing_isotropic_explicit_remeshing(targetlen=0.1, checksurfdist=True, maxsurfdist=0.1)
#Get the id of the last mesh in the set
last_id = ms.number_meshes()-1
ms.mls_projection_apss(controlmesh=last_id, proxymesh=last_id, filterscale=2)
#Ensure we select last mesh before saving result
ms.set_current_mesh(ms.number_meshes()-1)
m = ms.current_mesh()
print("Saving", os.path.join(outputdir_2, filename), m.vertex_number(), 'vertex', m.face_number(), 'faces' )
ms.save_current_mesh(os.path.join(outputdir_2, filename))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.