[Paraview] Modifying the filters available in Paraview ?

Axel Steuwer steuwer at ill.fr
Wed Sep 22 10:04:27 EDT 2004


Hi,

the code below is taken from the Mayavi code (/Misc/RenderWindow.py)
from Prabhu (thanks!)
and defines the function for exporting with the vtkGL2PSExporter.
Does that help?

Axel



---------------------------------------------------------------
    def save_gl2ps (self, file_name="", exp=None):        
        """Save scene to a vector PostScript/EPS/PDF/TeX file using
        GL2PS.  If you choose to use a TeX file then note that only
        the text output is saved to the file.  You will need to save
        the graphics separately.

        Keyword Arguments:

        file_name -- Optional file name to save to.  (default '').  If
        no file name is given then a dialog will pop up asking for the
        file name.

        exp -- Optionally configured vtkGL2PSExporter object.
        Defaults to None and this will result in a pop-up window
        asking for configuration options.        
        """
        debug ("In RenderWindow::save_gl2ps ()")
        # Make sure the exporter is available.
        if not hasattr(vtkpython, 'vtkGL2PSExporter'):
            msg = "Saving as a vector PS/EPS/PDF/TeX file using GL2PS is
"\
                  "either not supported by your version of VTK or "\
                  "you have not configured VTK to work with GL2PS --
read "\
                  "the documentation for the vtkGL2PSExporter class."
            Common.print_err (msg)
            return

        # Get a filename
        if not file_name:
            file_name = tk_fsave (title="Export to PS/EPS/PDF/TeX", 
                                  initialdir=Common.config.initial_dir,
                                  defaultextension=".eps",
                                  filetypes=[("All files", "*"),
                                             ("EPS files", "*.eps"),
                                             ("PS files", "*.ps"),
                                             ("PDF files", "*.pdf"),
                                             ("TeX files", "*.tex")])
        
        if len(file_name) != 0:
            f_prefix, f_ext = os.path.splitext(file_name)
            ex = None
            if exp:
                ex = exp
                if not isinstance(exp, vtkpython.vtkGL2PSExporter):
                    msg = "Need a vtkGL2PSExporter you passed a "\
                          "%s"%exp.__class__.__name__
                ex.SetFilePrefix(f_prefix)
            else:
                ex = vtkpython.vtkGL2PSExporter()
                # defaults
                ex.SetFilePrefix(f_prefix)
                if f_ext == ".ps":
                    ex.SetFileFormatToPS()
                elif f_ext == ".tex":
                    ex.SetFileFormatToTeX()
                elif f_ext == ".pdf":
                    ex.SetFileFormatToPDF()
                else:
                    ex.SetFileFormatToEPS()
                ex.SetSortToBSP()
                # configure the exporter.
                c = vtkPipeline.ConfigVtkObj.ConfigVtkObj(self.renwin)
                c.configure(self.frame, ex, get=[], auto_update=1,
                            one_frame=1, run_command=0)
                self.frame.update()
                c.root.transient(self.frame)
                self.frame.wait_window(c.root)
            
            self.lift()
            ex.SetRenderWindow(self.renwin)
            Common.state.busy()
            ex.Write()
            Common.state.idle()       








 

-----Original Message-----
From: paraview-bounces at paraview.org
[mailto:paraview-bounces at paraview.org] On Behalf Of Berk Geveci
Sent: 22 September 2004 15:53
To: Axel Steuwer
Cc: 'ParaView Mailing List'


I can't :-) I never did it. Currently, there is no way of adding
exporters to ParaView using xml files. One would have to change ParaView
code to do it. If someone explains how gl2ps works 
(what calls are made to enable it etc.), I might have some pointers.

On Wed, 2004-09-22 at 09:18, Axel Steuwer wrote:
> Berk,
> 
> could you perhaps comment on how to use the GL2PS exporter
> in Paraview?
> Many thanks,
> 
> Axel
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>  
> 
> -----Original Message-----
> From: paraview-bounces at paraview.org 
> [mailto:paraview-bounces at paraview.org] On Behalf Of Berk Geveci
> Sent: 22 September 2004 15:08
> To: Vidya Raghavan
> Cc: vtkusers at vtk.org; ParaView Mailing List
> 
> 
> Use --start-empty (or -e) option and create your own xml files. 
> However, once you do this, you have to provide all xml files. You 
> might want to create a PV_INTERFACE_PATH directory and copy some of 
> the default xml files (from GUI/Client/Resources in 1.6) there.
> 
> -Berk
> 
> On Wed, 2004-09-22 at 01:32, Vidya Raghavan wrote:
> > Hi,
> > 
> > I am trying to modify the list of filters available in Paraview from
> > the
> > Filters drop-down menu. I basically want only a few to be displayed
> and
> > available. Is there any way I can modify this?
> > 
> > Thanks,
> > 
> > Vidya
> > 
> > _________________________________________________________________
> > Search for your life partner made easy. 
> > http://www.bharatmatrimony.com/cgi-bin/bmclicks1.cgi?74 On 
> > BharatMatrimony.com
> > 
> > _______________________________________________
> > ParaView mailing list
> > ParaView at paraview.org
> > http://www.paraview.org/mailman/listinfo/paraview
-- 
Berk Geveci <berklist at nycap.rr.com>

_______________________________________________
ParaView mailing list
ParaView at paraview.org http://www.paraview.org/mailman/listinfo/paraview



More information about the ParaView mailing list