[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;
pdo =
self.GetPolyDataOutput()

newPts = vtk.vtkPoints()
for i in
range(0, numPts):
 x = i*float(length)/float(numPts)
 y =
math.sin(i*rounds*2*math.pi/numPts)
 z =
math.cos(i*rounds*2*math.pi/numPts)
 newPts.InsertPoint(i,
x,y,z)

pdo.SetPoints(newPts)
aPolyLine =
vtk.vtkPolyLine()

aPolyLine.GetPointIds().SetNumberOfIds(numPts)
for
i in range(0,numPts):
 aPolyLine.GetPointIds().SetId(i,
i)

pdo.Allocate(1,
1)
pdo.InsertNextCell(aPolyLine.GetCellType(),
aPolyLine.GetPointIds())
">
</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