The visquad example in Visual Basic

 

Sub visquad()

Dim renwin As New cvtkRenderWindow
Dim ren1 As New cvtkRenderer
Dim iren As New cvtkRenderWindowInteractor

Dim outlineActor As cvtkActor
Dim contActor As cvtkActor
Dim outlineMapper As cvtkPolyDataMapper: Dim contMapper As cvtkPolyDataMapper
Dim sample As cvtkSampleFunction
Dim quadric As cvtkQuadric
Dim outline As cvtkOutlineFilter
Dim contours As cvtkContourFilter

' Initialize
renwin.AddRenderer ren1
iren.SetRenderWindow renwin
renwin.SetSize 400, 400
renwin.SetWindowName "COMified vtk"
renwin.SetGlobalWarningDisplay False


'// Quadric definition
Set quadric = New cvtkQuadric
quadric.SetCoefficientsO 0.5, 1, 0.2, 0, 0.1, 0, 0, 0.2, 0, 0

Set sample = New cvtkSampleFunction
sample.SetSampleDimensions 50, 50, 50
sample.SetImplicitFunction quadric

'// Create five surfaces F(x,y,z) = constant between range specified
Set contours = New cvtkContourFilter
contours.SetInput sample.GetOutput
contours.GenerateValuesO 5, 0#, 1.2

Set contMapper = New cvtkPolyDataMapper
contMapper.SetInput contours.GetOutput
contMapper.SetScalarRange 0#, 1.2

Set contActor = New cvtkActor
contActor.SetMapper contMapper

'// Create outline
Set outline = New cvtkOutlineFilter
outline.SetInput sample.GetOutput

Set outlineMapper = New cvtkPolyDataMapper
outlineMapper.SetInput outline.GetOutput

Set outlineActor = New cvtkActor
outlineActor.SetMapper outlineMapper
outlineActor.GetProperty.SetColor 0, 0, 0

ren1.SetBackground 1, 1, 1
ren1.AddActor contActor
ren1.AddActor outlineActor

renwin.Render

Dim vrml As New cvtkVRMLExporter
vrml.SetInput renwin
' use a full path name here
vrml.SetFileName "visquad.wrl"
'vrml.Write

'// interact with data
iren.Start

'// not necessary
Set vrml = Nothing
Set quadric = Nothing: Set sample = Nothing
Set outline = Nothing: Set outlineMapper = Nothing: Set outlineActor = Nothing
Set contours = Nothing: Set contMapper = Nothing: Set contActor = Nothing


End Sub