[Paraview] XML source questions

David Doria daviddoria at gmail.com
Fri May 29 08:39:36 EDT 2009


I am looking at the HelixSource xml example. With something like this:
     <StringVectorProperty
       name="NumberOfRounds"
       command="SetParameter"
       number_of_elements="2"
       default_values_delimiter=";"
       default_values="rounds;3">
     </StringVectorProperty>

It is displaying a label with a description of the property, a textbox with
the name of the property, and another textbox with the value of the
property. Is there anyway to skip the textbox with the name of the property
(because it doesn't really make sense for the user to change this - so why
allow it?)

Also, the script itself seems to be set like this:
     <StringVectorProperty
        name="Script"
        command="SetScript"
        number_of_elements="1"
        default_values="import math;&#xa;pdo =
self.GetPolyDataOutput()&#xa;&#xa;newPts = vtk.vtkPoints()&#xa;for i in
range(0, numPts):&#xa;   x = i*float(length)/float(numPts)&#xa;   y =
math.sin(i*rounds*2*math.pi/numPts)&#xa;   z =
math.cos(i*rounds*2*math.pi/numPts)&#xa;   newPts.InsertPoint(i,
x,y,z)&#xa;&#xa;pdo.SetPoints(newPts)&#xa;aPolyLine =
vtk.vtkPolyLine()&#xa;&#xa;aPolyLine.GetPointIds().SetNumberOfIds(numPts)&#xa;for
i in range(0,numPts):&#xa;   aPolyLine.GetPointIds().SetId(i,
i)&#xa;&#xa;pdo.Allocate(1,
1)&#xa;pdo.InsertNextCell(aPolyLine.GetCellType(),
aPolyLine.GetPointIds())&#xa;">
     </StringVectorProperty>

That is a pretty cryptic way to have to write code - is there a way to take
a normal looking script:
import math
pdo = self.GetPolyDataOutput()
newPts = vtk.vtkPoints()
etc.

and point the xml to it - so you can edit the script in a .py file and the
xml just points to that file? This also kind of stems from the first
question - but I also would like to NOT display the script in the GUI - only
the tunable parameters - is that possible?

Thanks,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20090529/43789786/attachment.htm>


More information about the ParaView mailing list