Hi again everyone,<br><br>I realized that I have an extra problem after importing paraview.simple. Everytime I import it in python/pvpython, it hangs after the 'exit()' command.<br><br>I also created a module that includes this funcionality. When a python file uses my module, it hangs also at the end of the script. <br>
<br>Everything works perfectly, but It seemes that there is something wrong with this module when finishing scripts. I have even tried with a one-line script containing just: "from paraview.simple import *" and it hangs too.<br>
<br>Any idea about this? I am using Windows 7 and Paraview 4.0.1. I tried with Paraview 3.9 and doesn't work either.<br><br>Thank you,<br><br>Daniel.<br><br><div class="gmail_quote">2013/8/2 Sebastien Jourdain <span dir="ltr"><<a href="mailto:sebastien.jourdain@kitware.com" target="_blank">sebastien.jourdain@kitware.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks Daniel for sharing your full script.</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra">
<br><br><div class="gmail_quote">On Fri, Aug 2, 2013 at 8:14 AM, Dani Mora <span dir="ltr"><<a href="mailto:daniel.mora.checa@gmail.com" target="_blank">daniel.mora.checa@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi again Sebastien,<br><br>Thanks for your answer. I attach the code I am going to use in case someone finds it useful and I will also appreciate suggestions about how to improve it:<div>
<br><br>from paraview.simple import *<br>
from paraview.vtk import *<br>from vtkPVClientServerCoreRenderingPython import *<br>from vtkPVVTKExtensionsWebGLExporterPython import *<br><br></div>vtkreader = LegacyVTKReader()<br>vtkreader.FileNames = "model.vtk"<br>
<br>dp = Show(vtkreader)<br>dp.Representation = 'Points'<br><br>elev = Elevation(vtkreader)<br>pData = elev.PointData[2]<br>range = pData.GetRange()<br><br>dp.LookupTable = MakeBlueToRedLT(range[0],range[1])<br>dp.ColorArrayName = "Pressure"<br>
<br>renderView = GetRenderView()<br># Gradient background<br>renderView.Background = [0.06274509803921569, 0.06666666666666667, 0.06274509803921569]<br>renderView.Background2 = [0.4745098039215686, 0.47058823529411764, 0.4745098039215686]<br>
# Object axis invisible<br>renderView.CenterAxesVisibility = 0<br><br># Export to HTML<div><br>view = Render().GetClientSideObject()<br>exporter = vtkPVWebGLExporter()<br></div>exporter.SetFileName("C:\\ba.html")<br>
exporter.SetRenderWindow(view.GetRenderWindow())<br>
exporter.Update()<br><br>Thanks a lot for your help.<br><br>
Daniel. <br><div><div><br><div class="gmail_quote">2013/8/1 Sebastien Jourdain <span dir="ltr"><<a href="mailto:sebastien.jourdain@kitware.com" target="_blank">sebastien.jourdain@kitware.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hi Daniel,<div><br></div><div>I thought that VTK would contain the WebGL exporter which it doesn't (for now). So you are stuck with pvpython for now.</div><div><br></div><div>Here is a pvpython script</div>
<div><br></div><div><span style="font-size:17px;font-family:Courier">>>> from paraview.simple import *</span><br></div><div>
<p style="margin:0px"><span style="font-size:17px;font-family:Courier">>>> from paraview.vtk import *</span><br></p>
<p style="margin:0px"><span style="font-size:13pt;font-family:Courier">>>> from vtkPVClientServerCoreRenderingPython import *</span></p><p style="margin:0px"><span style="font-size:13pt;font-family:Courier">>>> from vtkPVVTKExtensionsWebGLExporterPython import *</span><br>
</p><p style="margin:0px"><span style="font-size:17px;font-family:Courier"><br></span></p><p style="margin:0px"><span style="font-size:17px;font-family:Courier">>>> Cone()</span></p>
<span style="font-size:17px;font-family:Courier">>>> Show()<br></span><span style="font-size:17px;font-family:Courier">>>> </span><span style="font-size:17px;font-family:Courier">view =</span><span style="font-size:17px;font-family:Courier"> </span><span style="font-size:17px;font-family:Courier">Render()</span><span style="font-size:17px;font-family:Courier">.GetClientSideObject()</span></div>
<div><span style="font-size:17px;font-family:Courier"><br></span></div><div><p style="margin:0px"><span style="font-size:13pt;font-family:Courier">>>> exporter = vtkPVWebGLExporter()</span></p>
<p style="margin:0px"><span style="font-size:13pt;font-family:Courier">>>> exporter.SetFileName("/tmp/index.html")</span></p><p style="margin:0px">
</p><p style="margin:0px"><span style="font-size:13pt;font-family:Courier">>>> exporter.SetRenderWindow(view.GetRenderWindow())</span></p><p style="margin:0px">
</p><p style="margin:0px"><span style="font-size:13pt;font-family:Courier">>>> exporter.Update()</span></p><p></p><p></p>
<p style="margin:0px"><br></p><p style="margin:0px"></p></div></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 30, 2013 at 8:04 AM, Dani Mora <span dir="ltr"><<a href="mailto:daniel.mora.checa@gmail.com" target="_blank">daniel.mora.checa@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Sebastien,<br><br>Thanks for your answer. I tried to use the trace but it seems that it does not track the exporting process. I also downloaded and compiled the vtk kit and I could not find the vtkpython module.<span><font color="#888888"><br>
<br>
Dani.</font></span><div><div><br><br><div class="gmail_quote">2013/7/24 Sebastien Jourdain <span dir="ltr"><<a href="mailto:sebastien.jourdain@kitware.com" target="_blank">sebastien.jourdain@kitware.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">1) pvserver is not a web server. It is meant to run on a cluster for very large visualization. Which is definitely not what you are looking for.<div>
<br></div><div>2) The html page is the only file needed for you. The other files were used for development of custom web page when streaming could be involved.</div>
<div><br></div><div>Regarding your question about the scripting part, it is definitely doable but I don't know the step on the top of my head.</div><div><br></div><div>You can try to use the trace and see if that give you the proper python command for pvpython. Otherwise, you should be able to use vtkpython without ParaView.</div>
<div><br></div><div>Seb</div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On Wed, Jul 24, 2013 at 4:24 AM, Dani Mora <span dir="ltr"><<a href="mailto:daniel.mora.checa@gmail.com" target="_blank">daniel.mora.checa@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>Hello everybody,<div><br></div><div>I just started to use Paraview and I got a bit stuck. We have some JSP pages where we want to embed and visualize some .vtk models. I considered two options at first:</div>
<div><br></div>
<div>1- Deploy a server that will render the models. I tried to do that but I found that I should compile again Paraview to start the pvserver (to enable the MPI). I followed the steps here: <a href="http://paraview.org/Wiki/ParaView:Build_And_Install" target="_blank">http://paraview.org/Wiki/ParaView:Build_And_Install</a> but I got some compiler errors that I have not been to solve.</div>
<div><br></div><div>2- Export the .vtk models into webgl (using the Paraview GUI) and embed the resulting .html documents as JSP pages . This is the simple approach and works so far. Regarding this option, I have two questions:</div>
<div> </div><div> - When exporting from vtk to webgl, we get one HTML file, one WebGL file and around 20 tiny files with unknown information. Since it works using only the HTML one, what are the rest of the files for?</div>
<div><br></div><div> - I need this task (to export) to be automatized because it is possible that we will have many models in the future. I tried to use Python scripting but I could not find how to do it. Any idea about how to do it? Is there any documentation I could read? I was thinking of extracting this functionality from the source code but I am looking for a 'smarter' solution.</div>
<div><br></div><div>Thanks a lot in advance, and sorry if some of the questions are very basic.</div><div><br></div><div>Daniel.</div><div><br></div><div>PS: I am working under Windows as a constraint of the project.<br>
PS2: I recently found the X Toolkit WebGL (<a href="https://github.com/xtk/X#readme" target="_blank">https://github.com/xtk/X#readme</a>) that is currently working, but I would like to have other options anyway. <br></div>
<br></div></div>_______________________________________________<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></div><br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br>