Paraview is not saving stl file with SaveData

Dear All,

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.

Regards,
Sunag R A.

This is appropriate for discourse.paraview.org, but I’ll answer it here. It looks like your mesh176_rightstl source is not being found. Make sure it is not None - you can call print(mesh176_rightstl).

Dear Cory,

Thank you very much for the reply. I did add this question in discourse.paraview.org, but no response. Well, apart from that, I do have a file named ‘mesh176_right.stl’. I have also attached the file along with this response. I still have the same issue.

print(mesh176_right.stl) shows the directory where the file is located.

Issue: vtkDemandDrivenPipeline:713 ERR| vtkPVCompositeDataPipeline (0x5635376a06d0): Input port 0 of algorithm vtkPPolyDataNormals(0x5635376998d0) has 0 connections but is not optional.

Mesh link: Mesh

Regards,
Sunag R A.

Dear Cory,

Thank you very much for the reply.

print(mesh176_rightstl) shows ‘None’.

I changed the directory, now the error is not there, but still the file is not saving.!! I tried with basic work example as

s = Sphere()
SaveData( ‘sphere.stl’, proxy = s, FileType=‘Ascii’)

This works and saves the stl file. But not the one I needed.

Mesh link: Mesh

Regards,
Sunag R A.

Yet, I did answer to you. Closing this. Please discuss on here:
https://discourse.paraview.org/t/stl-file-is-not-saving-using-savedata-in-python/6770

1 Like