我使用一个stl文件使用Paraview分割stl。我在paraview中使用python跟踪来跟踪该方法
现在,我使用python中的代码来运行它。它可以完美地运行,但不会根据需要保存分割的网格。代码根据从paraview获得的跟踪使用。下面是使用SaveData保存文件的代码片段。如何保存stl文件
import sys #sys- append path
import numpy as np
ParaViewBuildPath = "/home/ParaView-5.7.0/"
sys.path.append(ParaViewBuildPath + "lib/")
sys.path.append(ParaViewBuildPath + "lib/python3.7/site-packages")
sys.path.append(ParaViewBuildPath + "lib/python3.7/site-packages/vtkmodules")
from paraview.simple import *
import vtk
# find source
mesh176_rightstl = FindSource('mesh176_right.stl')
generateSurfaceNormals1 = GenerateSurfaceNormals(Input=mesh176_rightstl)
# Properties modified on generateSurfaceNormals1
generateSurfaceNormals1.FeatureAngle = 15.0
# create a new 'Connectivity'
connectivity1 = Connectivity(Input=generateSurfaceNormals1)
# create a new 'Threshold'
threshold1 = Threshold(Input=connectivity1)
#threshold1.Scalars = ['POINTS', 'RegionId']
# Properties modified on threshold1
threshold1.ThresholdRange = [10.0, 982.0]
# create a new 'Extract Surface'
extractSurface1 = ExtractSurface(Input=threshold1)
# save data
SaveData('surf176.stl', proxy=extractSurface1, FileType='Ascii')
我已经从“generateSurfaceNormals1”一行中解决了我面临的错误
[paraview]vtkdemandrivenpipeline:713 ERR | vtkpvcompositedappipeline(0x556f782fe7c0):算法vtkpolydatanormals(0x556f7a16b2a0)的输入端口0有0个连接,但不是可选的。
如何克服这个错误
任何线索将不胜感激
问候,, Sunag R A
错误消息意味着
mesh176_rightstl
是None,因此FindSource
没有找到任何内容。源名称正确吗?数据加载是否正确出现错误时,脚本将停止,并且不会调用
SaveData
。但它的语法是正确的测试stl编写器的最少代码:
它使用ParaView 5.9正确生成stl文件
编辑
你应该取消这行的注释
因为直到您请求(例如使用SaveData)时才执行管道,所以在创建阈值时找不到默认数组
相关问题 更多 >
编程相关推荐