1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
<ServerManagerConfiguration>
<ProxyGroup name="sources">
<!-- server manager xml for a python script that creates a helix
the auto generated panel for this exposes everything more than we want so
a custom panel would be good -->
<SourceProxy name="HelixSource" class="vtkPythonProgrammableFilter"
label="Helix Source">
<Documentation
long_help="Creates a helix using a python script using parameters filled in by the user."
short_help="Creates a helix.">
This source will execute a python script to produce a helix dataset.
</Documentation>
<!-- data set type -->
<IntVectorProperty
name="OutputDataSetType"
command="SetOutputDataSetType"
number_of_elements="1"
default_values="0">
<!-- value of 0 means vtkPolyData -->
</IntVectorProperty>
<!-- the script -->
<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())
">
<Hints>
<Widget type="multi_line"/>
</Hints>
</StringVectorProperty>
<!-- python script references a variable "numPts"
we expose this as a property allowing the user to set it -->
<StringVectorProperty
name="NumberOfPoints"
command="SetParameter"
number_of_elements="2"
default_values_delimiter=";"
default_values="numPts;80">
</StringVectorProperty>
<!-- python script references a variable "length"
we expose this as a property allowing the user to set it -->
<StringVectorProperty
name="Length"
command="SetParameter"
number_of_elements="2"
default_values_delimiter=";"
default_values="length;2.0">
</StringVectorProperty>
<!-- python script references a variable "rounds"
we expose this as a property allowing the user to set it -->
<StringVectorProperty
name="NumberOfRounds"
command="SetParameter"
number_of_elements="2"
default_values_delimiter=";"
default_values="rounds;3">
</StringVectorProperty>
<!-- End HelixSource -->
</SourceProxy>
</ProxyGroup>
</ServerManagerConfiguration>
|