Marc57
January 7, 2020, 1:06pm
1
Hello everyone,
I would like to access the data point array coming from a clip of a 3D Geometry.
I have the below python code:
mesh = STLReader(FileNames=["D:/STL/Part.stl"])
clip1 = Clip(Input=mesh, ClipType = 'Plane')
clip1.ClipType.Origin = [0, 0.0, 0.0]
angleRad = math.radians(0)
clip1.ClipType.Normal = [0.0, -math.cos(angleRad), math.sin(angleRad)]
a = PlotOnIntersectionCurves(Input = clip1, SliceType = 'Plane')
SaveData('test.csv',proxy=a)
Today I use SaveData to save the data points to external file but I would like to get the points data and treat them before writing them to external file.
I have tried a lot of different things but could not find a way to access the points coordinates before writing them to an external file.
Thanks in advance for any support.
Regards,
Marc.
mwestphal
(Mathieu Westphal (Kitware))
January 7, 2020, 1:15pm
2
You need to use servermanager.fetch for that.
It can be costly if your data is big and if you are working remotelly.
Marc57
January 7, 2020, 1:20pm
3
I tried this but maybe not in the good way
a = PlotOnIntersectionCurves(Input = clip1, SliceType = ‘Plane’)
b=paraview.servermanager.Fetch(a)
c=b.GetPointData()
But do not know what to do next with c ? I would like to have an array of points coordinates.
Thanks again.
mwestphal
(Mathieu Westphal (Kitware))
January 7, 2020, 1:31pm
4
a = PlotOnIntersectionCurves(Input = clip1, SliceType = ‘Plane’)
b=paraview.servermanager.Fetch(a)
c=b.GetPoint(0)
1 Like
Marc57
January 7, 2020, 1:35pm
5
I receive such error when I tried b.GetPoint(0)
Traceback (most recent call last):
File “”, line 1, in
AttributeError: ‘vtkCommonDataModelPython.vtkMultiBlockDataSet’ object has no attribute ‘GetPoint’
mwestphal
(Mathieu Westphal (Kitware))
January 7, 2020, 1:37pm
6
a=PlotOnIntersectionCurves(Input = clip1, SliceType = ‘Plane’)
b=paraview.servermanager.Fetch(a)
c=b.GetBlock(0)
d=c.GetPoint(0)
Marc57
January 7, 2020, 2:32pm
7
Still not able to get it to work:
c=b.GetBlock(0)
d=c.GetPoint(0)
Traceback (most recent call last):
File “”, line 1, in
AttributeError: ‘NoneType’ object has no attribute ‘GetPoint’
Honestly I am surprised how difficult this can be for such simple task right?
mwestphal
(Mathieu Westphal (Kitware))
January 7, 2020, 2:42pm
8
In order to inspect your data, you first have to understand how it is formatted.
Looks like you have a multiblock dataset output. If you do not care about it, you could just use a MergeBlock filters before using my first script.
Marc57
January 7, 2020, 3:03pm
9
I started it from scratch and it seems now ok to use your last solution.
Many thanks for all the support. I found it pretty difficult honestly for beginner. Did not find any tutorial on that, specially the MergeBlock part.
Thanks again.
mwestphal
(Mathieu Westphal (Kitware))
January 7, 2020, 3:06pm
10
MergeBlocks filter :
https://kitware.github.io/paraview-docs/latest/python/paraview.simple.MergeBlocks.html
ParaView Tutorial and Guide :
https://www.paraview.org/download/ (documentation)
TBH fetch is quite an advanced feature. If you are looking to just see the values of the points, you should use the Spreadsheet view.