[vtkusers] Trouble creating isosurface from unstructuredGrid of Tetras

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


Hello!!,

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

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!!!!!

Thanx



#Builds the unstructuredGrid 
tetMesh = ReadNastran.buildMesh()


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



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


# 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()
renWin.AddRenderer(ren)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
 
# Add the actors to the renderer, set the background and size
ren.AddActor(actorIso)
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.
iren.Initialize()
 
# We'll zoom in a little by accessing the camera and invoking a "Zoom"
# method on it.
ren.ResetCamera()
ren.GetActiveCamera().Zoom(1.5)
renWin.Render()
 
# Start the event loop.
iren.Start()

 



--
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