[vtkusers] Trouble creating isosurface from unstructuredGrid of Tetras

scotsman60 doug at beachmailing.com
Fri Aug 25 02:54:23 EDT 2017


Newbie here, having trouble creating an isosurface on a unstructredGrid of

I'm using Python 3.6 with VTK V7.1

I'm pretty sure my unstructuredGrid is good - I've attached the .vtk file -
I can see the points, cells and scalar data associated with the points.

I've cobbled together the code below from looking at examples on the web

The code runs, the render window is displayed and there are no errors, but
nothing is displayed

I'm pretty sure that things are going wring in the vtkContourFilter. When I
look at the contents of 'contour' in the debugger after setting the data and
the isoSurfaceValue I'm not seeing any data at all...

Any help will be gratefully accepted!!!!!


#Builds the unstructuredGrid 
tetMesh = ReadNastran.buildMesh()

# Generate an isosurface
contour = vtk.vtkContourFilter()
#contour = vtk.vtkMarchingCubes()
contour.SetInputData( tetMesh )
contour.SetValue( 0, 0.00 )

# Take the isosurface data and create geometry
isoMapper = vtk.vtkPolyDataMapper()
isoMapper.SetInputData( contour.GetOutput() )

# Take the isosurface data and create geometry
actorIso = vtk.vtkLODActor()
actorIso.SetNumberOfCloudPoints( 1000000 )
actorIso.SetMapper( isoMapper )
actorIso.GetProperty().SetColor( 1, 1, 1 )

# From here I just pass actorIso into a renderWindow
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
iren = vtk.vtkRenderWindowInteractor()
# Add the actors to the renderer, set the background and size
ren.SetBackground(0.1, 0.2, 0.4)
renWin.SetSize(1000, 800)
# This allows the interactor to initalize itself. It has to be
# called before an event loop.
# We'll zoom in a little by accessing the camera and invoking a "Zoom"
# method on it.
# Start the event loop.


View this message in context: http://vtk.1045678.n5.nabble.com/Trouble-creating-isosurface-from-unstructuredGrid-of-Tetras-tp5744578.html
Sent from the VTK - Users mailing list archive at Nabble.com.

More information about the vtkusers mailing list