<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Pat,<br>
    <br>
    Thanks for the explanation on the proper import and how to get at
    the local render window. With your help I was able to do what I
    wanted.<br>
    <br>
    I'm not a Paraview user, but I am supporting someone that is and he
    needed a way to get good looking .ps files out of Paraview. So after
    some initial reading I thought I would write a plugin, then I
    stumbled across using the python shell. Then I figured working with
    vtk objects directly through the shell might be the quickest way to
    get it done.<br>
    <br>
    I might now look into writing the proxy xml definition as you
    suggested. <br>
    <br>
    Once I follow the example that you pointed me to, does Paraview need
    to be recompiled once I put my new proxy xml definition in place and
    if so do I need to stick it in a specific place, such as the
    utilities.xml you pointed out? Or can my xml be sort of be loaded
    dynamically through Paraview's plugin manager as long as I build
    Paraview with shared libs on?<br>
    <br>
    Thanks Again for Your Help,<br>
    Marcin<br>
    <br>
    <br>
    On 06/17/2010 03:03 PM, pat marion wrote:
    <blockquote
      cite="mid:AANLkTilHKTngavigoLR2EvH80W7lhb_vu6OanyjFF24G@mail.gmail.com"
      type="cite">Hi,<br>
      <br>
      If you look at paraview's vtk/__init__.py, you'll see:<br>
      <br>
      &nbsp;&nbsp;&nbsp; from libvtkRenderingPython import vtkCamera<br>
      <br>
      So that is why vtk.vtkGL2PSExporter() doesn't work- the complete
      vtkRendering kit has not been imported.&nbsp; You could do this:<br>
      <br>
      from libvtkRenderingPython import vtkGL2PSExporter<br>
      exporter = vtkGL2PSExporter()<br>
      <br>
      or<br>
      <br>
      import libvtkRenderingPython as vtkrendering<br>
      exporter = vtkrendering.vtkGL2PSExporter()<br>
      <br>
      If you are running this in the paraview gui, you can get the local
      render window (vtkRenderWindow) by calling:<br>
      <br>
      view = GetActiveView().GetRenderWindow()<br>
      <br>
      <br>
      You should understand that you are working directly with vtk
      objects here.&nbsp; The paraview way to handle this is to write a proxy
      xml definition for the GL2PS exporter.&nbsp; You can see an example by
      searching for VRMLExporter in
      Servers/ServerManager/Resources/utilities.xml&nbsp;&nbsp; Then your script
      might be something like:<br>
      <br>
      exporters = servermanager.createModule("exporters")<br>
      <div id=":xz" class="ii gt">
        exp = exporters.GL2PSExporter(FileName="/tmp/<a
          moz-do-not-send="true" href="http://foo.ps">foo.ps</a>")<br>
        exp.View = GetActiveView()<br>
        exp.Write()</div>
      <br>
      <br>
      <br>
      Pat<br>
      <br>
      <br>
      <div class="gmail_quote">On Thu, Jun 17, 2010 at 2:26 PM, Marcin
        Sliwowski <span dir="ltr">&lt;<a moz-do-not-send="true"
            href="mailto:ms275@duke.edu">ms275@duke.edu</a>&gt;</span>
        wrote:<br>
        <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
          0.8ex; border-left: 1px solid rgb(204, 204, 204);
          padding-left: 1ex;">
          <div text="#000000" bgcolor="#FFFFFF"> Hello Peter, <br>
            <br>
            I was king of hoping you would reply, I actually saw that
            post and your method of instantiating an object on
            vtkGL2PSExporter does work after I do a from paraview.vtk
            import *<br>
            <br>
            from paraview.vtk import *<br>
            exp = vtkInstantiator.CreateInstance("vtkGL2PSExporter")<br>
            <br>
            I have tried exp.Write() but I get an error indicating:
            vtkGL2PSExporter: No render windows provided<br>
            <br>
            Then I did a couple of stabs in the dark with
            vtk.vtkRenderWindow() to try an get a Render Window object
            but with no success, I get attribute errors that I think are
            coming from me mixing up namespaces. I am doing the import
            line above and from vtk import *, I wonder if that is
            messing me up. I am going to read up on Python to get to the
            bottom of this, but a quick hint is also appreciated.<br>
            <br>
            Thanks,<br>
            Marcin
            <div>
              <div class="h5"><br>
                <br>
                <br>
                <br>
                On 06/17/2010 12:30 PM, Peter Brady wrote:
                <blockquote type="cite">Hello Marcin,<br>
                  <br>
                  Your question may have already been answered here: <a
                    moz-do-not-send="true"
                    href="http://markmail.org/message/zd2nwsztxl4xwbhm"
                    target="_blank">http://markmail.org/message/zd2nwsztxl4xwbhm</a>.<br>
                  <br>
                  However I think the last time I tried this was in 3.4
                  so things may have changed.&nbsp; In my experience the
                  vtkPostScript writer does a better job although it has
                  been quite a while since I've tried gl2ps.<br>
                  <br>
                  Good luck,<br>
                  Peter.<br>
                  <br>
                  <div class="gmail_quote">On Thu, Jun 17, 2010 at 8:23
                    AM, Marcin Sliwowski <span dir="ltr">&lt;<a
                        moz-do-not-send="true"
                        href="mailto:ms275@duke.edu" target="_blank">ms275@duke.edu</a>&gt;</span>
                    wrote:<br>
                    <blockquote class="gmail_quote" style="margin: 0pt
                      0pt 0pt 0.8ex; border-left: 1px solid rgb(204,
                      204, 204); padding-left: 1ex;">
                      <div text="#000000" bgcolor="#FFFFFF"> Hello,<br>
                        <br>
                        I am trying to figure out how to save a
                        visualization in Paraview directly to ps/eps
                        format.<br>
                        <br>
                        I have compiled from source paraview 3.6 with
                        the configuration option VTK_USE_GL2PS set to
                        ON.<br>
                        <br>
                        There are many hits in the mailing list archives
                        regarding trying to use vtkGL2PSExporter to
                        achieve this but I couldn't find anything that I
                        could make work.<br>
                        <br>
                        I know that I can just use
                        WriteImage("test.eps",
                        Writer="vtkPostScriptWriter") in the python
                        shell to get what I am asking for.<br>
                        <br>
                        However, I wonder if GL2PS could provide a
                        better looking eps file, and having spent a
                        couple of hours on this, I would really like to
                        get to the bottom of this.<br>
                        <br>
                        I have looked at the vtkGL2PSExporter class
                        reference at <a moz-do-not-send="true"
                          href="http://www.vtk.org/doc/nightly/html/classvtkGL2PSExporter.html"
                          target="_blank">http://www.vtk.org/doc/nightly/html/classvtkGL2PSExporter.html</a>
                        and from there followed the vtkGL2PSExporter
                        (Tests) link which provides examples of unit
                        testing that is done on the class. One example
                        is actually titled "test vector EPS output" <br>
                        <br>
                        However, even after doing a: from paraview
                        import vtk in the python shell, when I try to
                        follow the test example and do exp =
                        vtk.vtkGL2PSExporter() I get the following
                        error:<br>
                        <br>
                        <p style="margin: 0px; text-indent: 0px;"><span
                            style="font-family: 'Courier'; font-size:
                            9pt; color: rgb(255, 0, 0);">AttributeError:
                            'module' object has no attribute
                            'vtkGL2PSExporter'</span></p>
                        <br>
                        Can anyone shine any light on how to actually
                        utilize the vtkGL2PSExporter in Paraview to
                        export an .eps, my impression is that it has to
                        be done in the Python Shell, and I am not very
                        familiar with Python.<br>
                        <br>
                        Thank You,<br>
                        Marcin Sliwowski<br>
                      </div>
                      <br>
                      _______________________________________________<br>
                      Powered by <a moz-do-not-send="true"
                        href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
                      <br>
                      Visit other Kitware open-source projects at <a
                        moz-do-not-send="true"
                        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 moz-do-not-send="true"
                        href="http://paraview.org/Wiki/ParaView"
                        target="_blank">http://paraview.org/Wiki/ParaView</a><br>
                      <br>
                      Follow this link to subscribe/unsubscribe:<br>
                      <a moz-do-not-send="true"
                        href="http://www.paraview.org/mailman/listinfo/paraview"
                        target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
                      <br>
                    </blockquote>
                  </div>
                  <br>
                </blockquote>
                <br>
                <br>
              </div>
            </div>
            <pre cols="72">-- 
Marcin Sliwowski
Systems Programmer
Duke University - Pratt School of Engineering
Office: 919-660-8450
</pre>
          </div>
          <br>
          _______________________________________________<br>
          Powered by <a moz-do-not-send="true"
            href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
          <br>
          Visit other Kitware open-source projects at <a
            moz-do-not-send="true"
            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 moz-do-not-send="true"
            href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
          <br>
          Follow this link to subscribe/unsubscribe:<br>
          <a moz-do-not-send="true"
            href="http://www.paraview.org/mailman/listinfo/paraview"
            target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
          <br>
        </blockquote>
      </div>
      <br>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Marcin Sliwowski
Systems Programmer
Duke University - Pratt School of Engineering
Office: 919-660-8450
</pre>
  </body>
</html>