[vtkusers] Re. how to draw a 3D spring

Jonathan Massheder jonathan at simulistics.com
Sun Jan 16 16:23:31 EST 2005


There's an example on one of the VTK books. It uses 
vtkRotationalExtrusionFilter to sweep out a volume. I write a procedure in 
Tcl based on that example which I attach. You'll have to check the VTK 
documentation to the detail of the VTK classes.

Jonathan

proc  HelixSource {name} {
    vtkDiskSource disk
    disk SetCircumferentialResolution 20
    disk SetInnerRadius 0.0
    disk SetOuterRadius 0.2

    # must make the disk perpendicular to axis of roation (z)
    vtkTransform tran
    tran RotateX 90
    tran Translate 1 0 0

    vtkTransformPolyDataFilter transf
    transf SetInput [disk GetOutput]
    transf SetTransform tran

    vtkRotationalExtrusionFilter extrude
    extrude SetInput [transf GetOutput]
    extrude SetResolution 360; #360; # resolution of sweep operation.
    extrude SetTranslation 6; #total amount of translation along the z-axis
    extrude SetDeltaRadius 0.0; #change in radius during sweep process
    extrude SetAngle [expr {360*6}]; #2160.0; # 6 revs,  angle of rotation

    vtkPolyDataNormals $name
    $name SetInput [extrude GetOutput]
    $name SetFeatureAngle 60
}





More information about the vtkusers mailing list