Trouble creating isosurface from unstructuredGrid of Tetras

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Trouble creating isosurface from unstructuredGrid of Tetras

scotsman60
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()

 
Reply | Threaded
Open this post in threaded view
|

Re: Trouble creating isosurface from unstructuredGrid of Tetras - Fixed!!!

scotsman60
So,

The problem is that we need to call the Update method on the vtkContourFiler() before passing it to the vtkPolyDataMapper.......

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

Everything seems to be OK now.......
Reply | Threaded
Open this post in threaded view
|

Re: Trouble creating isosurface from unstructuredGrid of Tetras - Fixed!!!

Bill Lorensen
Or you could replace:
isoMapper.SetInputData( contour.GetOutput() )
with
isoMapper.SetInputConnection(contour.GetOutputPort())


On Fri, Aug 25, 2017 at 4:13 AM, scotsman60 <[hidden email]> wrote:

> So,
>
> The problem is that we need to call the Update method on the
> vtkContourFiler() before passing it to the vtkPolyDataMapper.......
>
> # Generate an isosurface
> contour = vtk.vtkContourFilter()
> #contour = vtk.vtkMarchingCubes()
> contour.SetInputData( tetMesh )
> contour.ComputeNormalsOn()
> contour.SetValue( 0, 0.00 )
> *contour.Update()*
>
> Everything seems to be OK now.......
>
>
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/Trouble-creating-isosurface-from-unstructuredGrid-of-Tetras-tp5744578p5744579.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers



--
Unpaid intern in BillsBasement at noware dot com
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers