[vtkusers] Is this the correct way to use QuadricLODActor with 3D unstructuredGrids?

scotsman60 doug at beachmailing.com
Fri Dec 29 14:25:38 EST 2017


Hello,

The below code runs and produces the expected LOD reduction during view
manipulation.

But since I'm unable to find any examples of QuadricLOD on unstructured
solids, I'd like some confirmation that this is indeed the recommended
pattern.

import vtk

#Set up the unstructured grid reader
unstructuredGridFileName = r'E:\xxxxxx\enginem10.vtu'
reader=vtk.vtkXMLUnstructuredGridReader() 
reader.SetFileName(unstructuredGridFileName)
reader.Update()

# Populate the grid
rgrid = vtk.vtkUnstructuredGrid()
rgrid = reader.GetOutput()

#Extract the free faces from the (solid) grid 
surfaceFilter = vtk.vtkDataSetSurfaceFilter()
surfaceFilter.SetInputData(rgrid);

# Connect the free faces to the mapper
surfaceMapper = vtk.vtkPolyDataMapper()
surfaceMapper.SetInputConnection(surfaceFilter.GetOutputPort())

#Connect the mapper to the QaudricLOActor
actor = vtk.vtkQuadricLODActor()
actor.SetMapper(surfaceMapper)


# A renderer and render window
renderer = vtk.vtkRenderer()
renderWindow = vtk.vtkRenderWindow()
renderWindow.AddRenderer(renderer)

# An interactor
renderWindowInteractor = vtk.vtkRenderWindowInteractor()
renderWindowInteractor.SetRenderWindow(renderWindow)

#Adjust the aggresiveness of the LOD 
renderWindowInteractor.SetDesiredUpdateRate(2)

renderer.AddActor(actor)
renderWindow.Render()
renderWindowInteractor.Start()



Thanks in advance,

Doug 



--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html


More information about the vtkusers mailing list