I used one stl file to split the stl using Paraview. I traced the method using python trace in paraview.
Now, I used the code in python to run it. It runs perfectly, but it does not save the splitted mesh as needed. The code is used as per the trace obtained from paraview. Below is the snipped of the code where SaveData is used to save the file. How to save stl file?
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 * # 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')
Please change the build path accordingly, in case of running. It also was giving me an error which says:
vtkDemandDrivenPipeline:713 ERR| vtkPVCompositeDataPipeline (0x5635376a06d0): Input port 0 of algorithm vtkPPolyDataNormals(0x5635376998d0) has 0 connections but is not optional.
How to eliminate this?
Any leads will be appreciated.
Sunag R A.