<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'><div dir='ltr'>
<div dir="ltr">Shima,</div><div dir="ltr"><br> I've CC this to the paraview mailing list, so that others might help. <br> <br>I am sorry to tell you that I don't know of a way this could be accomplished, as I have very little experience with python scripting. I would also like to be able to read in a .csv file and produce splines or lines. </div><div dir="ltr"> </div><div dir="ltr">Some information on python scripting within paraview is given here <a href="http://www.cmake.org/Wiki/ParaView#Python_Scripting">http://www.cmake.org/Wiki/ParaView#Python_Scripting</a>, and I was directed to this site from the vtk mailing list, but the code is not written for python <a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/GeometricObjects/PolyLine">http://www.vtk.org/Wiki/VTK/Examples/Cxx/GeometricObjects/PolyLine</a> . </div><div dir="ltr"> </div><div dir="ltr">My best suggestion would be to place your .csv file into a text format and try to copy and paste the xyz coordinates, just be careful of spacing changes between text from the copy and paste. This is what I plan on doing. <br><br><span class="ecxheadline">Ian </span><br><br><br><br> </div><div><hr id="stopSpelling">Date: Sun, 27 Nov 2011 10:23:04 +0100<br>Subject: Re: [Paraview] Spline Source and python script<br>From: sh.s.mostafavi@gmail.com<br>To: lesl4685@vandals.uidaho.edu<br><br><div>Hello Lan,</div>
<div>I read your code. it was really helpful for me as i had the same problem as yours. but I still need some infos. how to have access to a file which contains more than 100 points with their coordinates. Because it takes too much time to enter them in the script by their coordinates. my file is a ".csv" one and I don't know how to access that via the python shell or Macro.</div>
<div>If you could help me, I would be very thankful</div>
<div>Shima<br><br></div>
<div class="ecxgmail_quote">On Sun, Nov 27, 2011 at 3:00 AM, Ian Leslie <span dir="ltr"><<a href="mailto:lesl4685@vandals.uidaho.edu">lesl4685@vandals.uidaho.edu</a>></span> wrote:<br>
<blockquote style="padding-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px; border-left-style: solid;" class="ecxgmail_quote">
<div>
<div dir="ltr">Thanks Jerome! I got it to work. The copy and paste limitation must have been the problem. I hand typed it in and saved it as a macro and then added <br> <br>
<p style="text-indent: 0px;">DataRepresentation1 = Show()</p>DataRepresentation1.EdgeColor = [0.0, 0.0, 0.5000076295109483] before Render() and everything seems to work fine. <br> <br>Below is the code I used for the macro for anyone else who may need this. Worked for me running ParaView 3.12.0-RC3. <br>
<br>try: paraview.simple <br>
<p style="text-indent: 0px;">except: from paraview.simple import *</p><br>
<p style="text-indent: 0px;">paraview.simple._DisableFirstRenderCameraReset()</p>
<div class="ecxim">s = SplineSource()<br>s.ParametricFunction.SetPropertyWithName("Closed",1)<br>pointA = [1,2,3]<br>pointB = [6,5,4]<br>pointC = [7,8,9]<br>s.ParametricFunction.SetPropertyWithName("Points", pointA+pointB+pointC)<br>
<br></div>
<p style="text-indent: 0px;">DataRepresentation1 = Show()</p>DataRepresentation1.EdgeColor = [0.0, 0.0, 0.5000076295109483]<br><br>
<p style="text-indent: 0px;">Render()</p><br>
<p style="text-indent: 0px;"><br><span>Ian </span></p>
<div>
<hr>
Date: Sat, 26 Nov 2011 21:43:47 +0100<br>From: <a href="mailto:jerome.velut@kitware.com">jerome.velut@kitware.com</a><br>To: <a href="mailto:lesl4685@vandals.uidaho.edu">lesl4685@vandals.uidaho.edu</a><br>
CC: <a href="mailto:paraview@paraview.org">paraview@paraview.org</a><br>Subject: Re: [Paraview] Spline Source and python script
<div>
<div></div>
<div class="h5"><br><br>Hum... I guess you copied my code lines and pasted them in the python shell, right?<br><br>I found a limitation of the python shell, but I didn't take the time to report it: when I copy several lines from a file to the paraview python shell, they are not executed. Moreover, the unix-style "middle click direct copied" line is also not executed, though the characters are well written!!<br>
<br>Try this:<br>- copy/paste the lines one by one with ctrl+c / ctrl+v method<br>- or (prefered!) create a file that you execute as a macro from the "Macros" menu<br>- or re-type by hand all the lines ;)<br><br>
FYI, I compile frequently the git-master and this method always worked for me. So should be with 3.12.<br><br>HTH,<br>Jerome<br><br>On 11/26/2011 09:18 PM, Ian Leslie wrote:
<blockquote>
<div dir="ltr">
<div dir="ltr">Hi Jerome,</div>
<div dir="ltr"><br> Thanks for explaining in more detail. I tried the script but only two spline points were produced at 0,0,0 and 1,0,0. No errors are given, so I can't point to a line in the code. I am running ParaView 3.12.0, perhaps something changed between 3.10 and 3.12 to affect the script? It is also possible I am overlooking something very obvious as I have only just started to use the python scripting in paraview. </div>
<div dir="ltr"></div>
<div dir="ltr">This is the script I ran in the python shell </div>
<div dir="ltr"></div>
<div dir="ltr"><span style='color: rgb(0, 150, 0); font-family: "Courier"; font-size: 8.25pt;'><span style='color: rgb(0, 150, 0); font-family: "Courier"; font-size: 8.25pt;'><span style='color: rgb(0, 150, 0); font-family: "Courier"; font-size: 8.25pt;'><span style='color: rgb(0, 150, 0); font-family: "Courier"; font-size: 8.25pt;'>s</span></span></span> = SplineSource()</span>
<p style="text-indent: 0px;"><span style='color: rgb(0, 150, 0); font-family: "Courier"; font-size: 8.25pt;'> s.ParametricFunction.SetPropertyWithName( "Closed", 1 ) </span></p>
<p style="text-indent: 0px;"><span style='color: rgb(0, 150, 0); font-family: "Courier"; font-size: 8.25pt;'> pointA = [1,2,3]</span></p>
<p style="text-indent: 0px;"><span style='color: rgb(0, 150, 0); font-family: "Courier"; font-size: 8.25pt;'> pointB = [6,5,4]</span></p>
<p style="text-indent: 0px;"><span style='color: rgb(0, 150, 0); font-family: "Courier"; font-size: 8.25pt;'> pointC = [7,8,9]</span></p>
<p style="text-indent: 0px;"><span style='color: rgb(0, 150, 0); font-family: "Courier"; font-size: 8.25pt;'> s.ParametricFunction.SetPropertyWithName( "Points", pointA+pointB+pointC) </span></p></div>
<div dir="ltr"></div>
<div dir="ltr">My goal is to have a python script that will take multiple point locations given in the script or from a file and produce a spline without having to manually enter them into the spline source one at a time. Open to any suggestions and all ideas. </div>
<div dir="ltr"></div>
<div dir="ltr">Thanks, <br><br><span>Ian </span><br><br><br><br> </div>
<div>
<hr>
Date: Sat, 26 Nov 2011 13:02:12 +0100<br>From: <a href="mailto:jerome.velut@gmail.com">jerome.velut@gmail.com</a><br>To: <a href="mailto:lesl4685@vandals.uidaho.edu">lesl4685@vandals.uidaho.edu</a><br>
CC: <a href="mailto:paraview@paraview.org">paraview@paraview.org</a><br>Subject: Re: [vtkusers] Spline Source and python script<br><br>Hi,<br>it is more a ParaView-related question, so I changed the list name ;)<br>
<br>I tried again the solution Pat proposed in the post, and I am sorry to tell you that it works without changing anything...<br>I just can be more precise. Please follow these steps in the paraview python shell :<br>s = SplineSource()<br>
s.ParametricFunction.SetPropertyWithName( "Closed", 1 ) # Now, the "Closed Spline" property toggles to "checked"<br>pointA = [1,2,3]<br>pointB = [6,5,4]<br>pointC = [7,8,9]<br>s.ParametricFunction.SetPropertyWithName( "Points", pointA+pointB+pointC) # Now, the three points appear in the spline points list<br>
<br>Then press apply : the spline appears in the render window.<br>If you experience problems, please tell me which steps are guilty.<br><br>HTH,<br>Jerome<br><br>On 11/26/2011 08:04 AM, Ian Leslie wrote:
<blockquote>
<div dir="ltr">Hi,<br> I saw your post on getting the spline function to work in the pyhthon shell within ParaView on the <a href="http://vtk.org/" target="_blank">vtk.org</a> users mailing list and was wondering if you would be willing to share your solution with me. I wasn't able to implement the suggested solution based on the post alone <a href="http://markmail.org/search/list%3aparaview?q=SplineSource+and+python+script#query:list:paraview%20SplineSource%20and%20python%20script+page:1+mid:hhzkv5vj33zv6hky+state:results" target="_blank">http://markmail.org/search/list:paraview?q=SplineSource+and+python+script#query:list%3Aparaview%20SplineSource%20and%20python%20script+page:1+mid:hhzkv5vj33zv6hky+state:results</a><br>
<br>Thanks, <br><br><span>Ian </span><br></div><br>
<fieldset></fieldset> <br><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 VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a>
Follow this link to subscribe/unsubscribe:
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a>
</pre></blockquote><br><br></div></div><br>
<fieldset></fieldset> <br><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>
</pre></blockquote><br></div></div></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> </div></body>
</html>