<div dir="ltr">Hi Felipe,<div><br></div><div>When I try this script to transform from cartesian to cylindrical coordinates after I have applied the CleantoGrid Filter:</div><div><br></div><div><div class="im" style="font-family:arial,sans-serif;font-size:13px">
<div style="margin:0px">pdi = self.GetInput()</div><div style="margin:0px">pdo = self.GetOutput()</div><div style="margin:0px">newPoints = vtk.vtkPoints()</div><div style="margin:0px">numPoints = pdi.GetNumberOfPoints()</div>
<div style="margin:0px">for i in range(0, numPoints):</div><div style="margin:0px">coord = pdi.GetPoint(i)</div><div style="margin:0px">x, y, z = coord[:3]</div><div style="margin:0px">r = x * cos(y)</div><div style="margin:0px">
t = x * sin(y)</div><div style="margin:0px">newPoints.InsertPoint(i, r, t, z)</div><div style="margin:0px">pdo.SetPoints(newPoints)</div></div><div style="font-family:arial,sans-serif;font-size:13px;margin:0px">pdo.GetPointData().AddArray(pdi.GetPointData().GetArray(0))</div>
<div style="font-family:arial,sans-serif;font-size:13px;margin:0px">pdo.GetPointData().AddArray(pdi.GetPointData().GetArray(1))</div><div style="font-family:arial,sans-serif;font-size:13px;margin:0px">pdo.GetPointData().AddArray(pdi.GetPointData().GetArray(2))</div>
</div><div style="font-family:arial,sans-serif;font-size:13px;margin:0px"><br></div><div style="font-family:arial,sans-serif;font-size:13px;margin:0px">it creates two more pipelines, one for CleantoGrid and one for Programmable Filter. Both pipelines are linked to the original pipeline and both pipelines require the same memory as the original pipeline. Is there a way to to delete the previous two pipelines (original with cartesian coordinates and cleantoGrid) so that I only use one memory amount and not three?</div>
<div style="font-family:arial,sans-serif;font-size:13px;margin:0px"><br></div><div style="font-family:arial,sans-serif;font-size:13px;margin:0px">Nikos</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Wed, Apr 3, 2013 at 12:05 PM, Felipe Bordeu <span dir="ltr"><<a href="mailto:felipe.bordeu@ec-nantes.fr" target="_blank">felipe.bordeu@ec-nantes.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>you need to copy the point data: add
this line to the end of your script:<br>
<br>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">pdo.GetPointData().AddArray(pdi.GetPointData().GetArray(0))</p>
<br>
this will work only for one field, you can put this line inside a
loop to add all the pointdata.<br>
<br>
Felipe<br>
<br>
Le 03/04/2013 17:59, Nikolaos Beratlis a écrit :<br>
</div><div><div class="h5">
<blockquote type="cite">
<div dir="ltr">I did and it shows me the transformed grid, but the
ProgrammableFilter doesn't contain the variable var. I cannot
plot contours. Should I change the script?</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">
On Wed, Apr 3, 2013 at 11:48 AM, Felipe Bordeu <span dir="ltr"><<a href="mailto:felipe.bordeu@ec-nantes.fr" target="_blank">felipe.bordeu@ec-nantes.fr</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>You must apply the programmablefilter to the
cleantoGrid not to the var3d.xmf. <br>
<br>
look at the screenshot.<br>
<br>
Felipe<br>
<br>
<img src="cid:part2.02070503.02060302@ec-nantes.fr" alt=""><br>
<br>
Le 03/04/2013 17:43, Nikolaos Beratlis a écrit :<br>
</div>
<div>
<div>
<blockquote type="cite">
<div dir="ltr">Hi Felipe,
<div><br>
</div>
<div>I applied the CleanToGrid Filter first and
then applied the following script:</div>
<div>
<p style="margin:0px"><br>
</p>
<p style="margin:0px">pdi = self.GetInput()</p>
<p style="margin:0px">pdo = self.GetOutput()</p>
<p style="margin:0px">newPoints =
vtk.vtkPoints()</p>
<p style="margin:0px">numPoints =
pdi.GetNumberOfPoints()</p>
<p style="margin:0px">for i in range(0,
numPoints):</p>
<p style="margin:0px"> coord = pdi.GetPoint(i)</p>
<p style="margin:0px"> x, y, z = coord[:3]</p>
<p style="margin:0px"> r = x * <span style="background-color:rgb(243,243,243)"><font color="#ff0000">cos</font></span>(y)</p>
<p style="margin:0px"> t = x * <font color="#ff0000">sin</font>(y)</p>
<p style="margin:0px"> newPoints.InsertPoint(i,
r, t, z)</p>
<p style="margin:0px">pdo.SetPoints(newPoints)</p>
</div>
<div><br>
</div>
<div>Notice the indentation and also the change of
the cos(y) and sin(y) assignments. </div>
<div><br>
</div>
<div>but I got this error:</div>
<br>
Traceback (most recent call last):<br>
<br>
File "<string>", line 26, in <module><br>
<br>
File "<string>", line 12, in RequestData<br>
<br>
AttributeError: SetPoints
<div>
<p style="margin:0px"> </p>
</div>
<div><br>
</div>
<div>What am I doing wrong?</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Wed, Apr 3, 2013 at
11:13 AM, Felipe Bordeu <span dir="ltr"><<a href="mailto:felipe.bordeu@ec-nantes.fr" target="_blank">felipe.bordeu@ec-nantes.fr</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>apply a CleanToGrid filter before the
python programmable filter and this is a
corrected version of your script:<br>
<br>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">pdi
= self.GetInput()</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">pdo
= self.GetOutput()</p>
<div>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">newPoints
= vtk.vtkPoints()</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">numPoints
= pdi.GetNumberOfPoints()</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">for
i in range(0, numPoints):</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">
coord = pdi.GetPoint(i)</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">
x, y, z = coord[:3]</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">
r = x * sin(y)</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">
t = x * cos(y)</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">
newPoints.InsertPoint(i, r, t, z)</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">pdo.SetPoints(newPoints)</p>
<br>
<br>
</div>
Felipe<br>
<br>
Le 03/04/2013 04:55, Nikolaos Beratlis a
écrit :<br>
</div>
<blockquote type="cite">
<div>
<div>
<div dir="ltr">
<div>Hi,</div>
<div><br>
</div>
I am reading the following xmf file
(attached as var3d.xmf) into
Paraview:
<div><br>
</div>
<div>
<div><?xml version="1.0" ?></div>
<div><!DOCTYPE Xdmf SYSTEM
"Xdmf.dtd" []></div>
<div><Xdmf Version="2.2"></div>
<div><Domain></div>
<div><Grid
GridType="Uniform"></div>
<div><Topology
TopologyType="3DRectMesh"
Dimensions=" 2 4
3"/></div>
<div><Geometry
GeometryType="VXVYVZ"></div>
<div><DataItem Dimensions="
3" NumberType="Float"
Precision="4" Format="XML"></div>
<div> 0.0000 1.0000 2.0000</div>
<div></DataItem></div>
<div><DataItem Dimensions="
4" NumberType="Float"
Precision="4" Format="XML"></div>
<div> 0.0000 <a href="tel:2.0944%20%C2%A0%204.1888" value="+12094441888" target="_blank">2.0944 4.1888</a>
6.2832</div>
<div></DataItem></div>
<div><DataItem Dimensions="
2" NumberType="Float"
Precision="4" Format="XML"></div>
<div> 1.0000 2.0000</div>
<div></DataItem></div>
<div></Geometry></div>
<div> <Attribute Name="var"
AttributeType="Scalar"
Center="Node"></div>
<div><DataItem Dimensions="24"
NumberType="Float" Precision="4"
Format="XML"></div>
<div>0 1 2 3 4 5 6 7 8 9 10 11 12
13 14 15 16 17 18 19 20 21 22 23</div>
<div></DataItem></div>
<div></Attribute></div>
<div></Grid></div>
<div></Domain></div>
<div></Xdmf></div>
<div><br>
</div>
<div> The grid is a 3D orthogonal
grid read in cartesian
coordinates (see attached image
showing grid and contours of
variable). I then want to
transform the grid from
cartesian to cylindrical
coordinates. I tried using the
following Python script:</div>
<div><br>
</div>
<div>
<p style="margin:0px">pdi =
self.GetPolyDataInput()</p>
<p style="margin:0px">pdo =
self.GetPolyDataOutput()</p>
<p style="margin:0px">newPoints
= vtk.vtkPoints()</p>
<p style="margin:0px">numPoints
= pdi.GetNumberOfPoints()</p>
<p style="margin:0px">for i in
range(0, numPoints):</p>
<p style="margin:0px"> coord =
pdi.GetPoint(i)</p>
<p style="margin:0px"> x, y, z =
coord[:3]</p>
<p style="margin:0px"> r = x *
sin(y)</p>
<p style="margin:0px"> t = x *
cos(y)</p>
<p style="margin:0px">
newPoints.InsertPoint(i, r, t,
z)</p>
<p style="margin:0px">pdo.SetPoints(newPoints)</p>
<p style="margin:0px"><br>
</p>
<p style="margin:0px">with
Output Data Set Type chosen to
be the Same as Input, but I
get this error:</p>
<p style="margin:0px"><br>
</p>
Traceback (most recent call
last):<br>
File "<string>", line 26,
in <module><br>
File "<string>", line 12,
in RequestData<br>
AttributeError: 'NoneType'
object has no attribute
'SetPoints'</div>
</div>
<div><br>
</div>
<div>I have no experience with
Python scripting. What am I doing
wrong?</div>
<div><br>
</div>
<div>Thank you,</div>
<div><br>
</div>
<div>Nikos</div>
</div>
<br>
<fieldset></fieldset>
<br>
</div>
</div>
<pre>_______________________________________________
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a>
Follow this link to subscribe/unsubscribe:
<a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><span><font color="#888888">
</font></span></pre>
<span><font color="#888888"> </font></span></blockquote>
<span><font color="#888888"> <br>
<br>
<pre cols="72">--
Felipe Bordeu Weldt
Ingénieur de Recherche
-------------------------------------
Tél. : <a href="tel:33%20%280%292%2040%2037%2016" value="+13302403716" target="_blank">33 (0)2 40 37 16</a> 57
Fax. : <a href="tel:33%20%280%292%2040%2074%2074" value="+13302407474" target="_blank">33 (0)2 40 74 74</a> 06
<a href="mailto:Felipe.Bordeu@ec-nantes.fr" target="_blank">Felipe.Bordeu@ec-nantes.fr</a>
Institut GeM - UMR CNRS 6183
École Centrale Nantes
1 Rue de La Noë, 44321 Nantes, FRANCE
-------------------------------------</pre>
</font></span></div>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the
ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
<br>
<pre cols="72">--
Felipe Bordeu Weldt
Ingénieur de Recherche
-------------------------------------
Tél. : <a href="tel:33%20%280%292%2040%2037%2016" value="+13302403716" target="_blank">33 (0)2 40 37 16</a> 57
Fax. : <a href="tel:33%20%280%292%2040%2074%2074" value="+13302407474" target="_blank">33 (0)2 40 74 74</a> 06
<a href="mailto:Felipe.Bordeu@ec-nantes.fr" target="_blank">Felipe.Bordeu@ec-nantes.fr</a>
Institut GeM - UMR CNRS 6183
École Centrale Nantes
1 Rue de La Noë, 44321 Nantes, FRANCE
-------------------------------------</pre>
</div>
</div>
</div>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki
at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
<br>
<pre cols="72">--
Felipe Bordeu Weldt
Ingénieur de Recherche
-------------------------------------
Tél. : <a href="tel:33%20%280%292%2040%2037%2016" value="+13302403716" target="_blank">33 (0)2 40 37 16</a> 57
Fax. : <a href="tel:33%20%280%292%2040%2074%2074" value="+13302407474" target="_blank">33 (0)2 40 74 74</a> 06
<a href="mailto:Felipe.Bordeu@ec-nantes.fr" target="_blank">Felipe.Bordeu@ec-nantes.fr</a>
Institut GeM - UMR CNRS 6183
École Centrale Nantes
1 Rue de La Noë, 44321 Nantes, FRANCE
-------------------------------------</pre>
</div></div></div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
<br></blockquote></div><br></div>