mirror of
https://github.com/OpenFOAM/ThirdParty-6.git
synced 2025-12-08 06:57:43 +00:00
72 lines
2.8 KiB
XML
72 lines
2.8 KiB
XML
|
|
<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>
|
|
|
|
|