[vtkusers] Re: problem viewing merged PolyData sets using

Mathieu Malaterre mathieu.malaterre at kitware.com
Fri Feb 4 15:13:41 EST 2005


Denis,

	I changed the vtkErrorMacro commented it out with some vtkDebugMacro. 
To enable them you still need to call DebugOn() on the VTK object you 
want to debug. But there is no reason to consider an empty input as an 
error, there are cases where you cannot control your input.

HTH
Mathieu

$ cvs ci -m"ENH: Change the vtkErrorMacro commented out with 
vtkDebugMacro." 
 
/cvsroot/ParaView/ParaView/VTK/Common/vtkMatrix4x4.cxx,v  <-- 
vtkMatrix4x4.cxx
new revision: 1.59; previous revision: 1.58
/cvsroot/ParaView/ParaView/VTK/Filtering/vtkGenericEdgeTable.cxx,v  <-- 
  vtkGenericEdgeTable.cxx
new revision: 1.10; previous revision: 1.9
/cvsroot/ParaView/ParaView/VTK/Graphics/vtkAppendFilter.cxx,v  <-- 
vtkAppendFilter.cxx
new revision: 1.73; previous revision: 1.72
/cvsroot/ParaView/ParaView/VTK/Graphics/vtkAppendPolyData.cxx,v  <-- 
vtkAppendPolyData.cxx
new revision: 1.96; previous revision: 1.95
/cvsroot/ParaView/ParaView/VTK/Graphics/vtkBoxClipDataSet.cxx,v  <-- 
vtkBoxClipDataSet.cxx
new revision: 1.5; previous revision: 1.4
/cvsroot/ParaView/ParaView/VTK/Graphics/vtkClipDataSet.cxx,v  <-- 
vtkClipDataSet.cxx
new revision: 1.40; previous revision: 1.39
/cvsroot/ParaView/ParaView/VTK/Graphics/vtkClipPolyData.cxx,v  <-- 
vtkClipPolyData.cxx
new revision: 1.56; previous revision: 1.55
/cvsroot/ParaView/ParaView/VTK/Graphics/vtkElevationFilter.cxx,v  <-- 
vtkElevationFilter.cxx
new revision: 1.57; previous revision: 1.56
/cvsroot/ParaView/ParaView/VTK/Graphics/vtkFeatureEdges.cxx,v  <-- 
vtkFeatureEdges.cxx
new revision: 1.72; previous revision: 1.71
/cvsroot/ParaView/ParaView/VTK/Graphics/vtkQuadricClustering.cxx,v  <-- 
  vtkQuadricClustering.cxx
new revision: 1.77; previous revision: 1.76
/cvsroot/ParaView/ParaView/VTK/Graphics/vtkSimpleElevationFilter.cxx,v 
<--  vtkSimpleElevationFilter.cxx
new revision: 1.20; previous revision: 1.19
/cvsroot/ParaView/ParaView/VTK/Graphics/vtkSpherePuzzle.cxx,v  <-- 
vtkSpherePuzzle.cxx
new revision: 1.19; previous revision: 1.18
/cvsroot/ParaView/ParaView/VTK/Graphics/vtkStructuredGridGeometryFilter.cxx,v 
  <--  vtkStructuredGridGeometryFilter.cxx
new revision: 1.64; previous revision: 1.63
/cvsroot/ParaView/ParaView/VTK/IO/vtkDataSetReader.cxx,v  <-- 
vtkDataSetReader.cxx
new revision: 1.68; previous revision: 1.67
/cvsroot/ParaView/ParaView/VTK/IO/vtkEnSightGoldBinaryReader.cxx,v  <-- 
  vtkEnSightGoldBinaryReader.cxx
new revision: 1.59; previous revision: 1.58
/cvsroot/ParaView/ParaView/VTK/Parallel/vtkPDataSetReader.cxx,v  <-- 
vtkPDataSetReader.cxx
new revision: 1.36; previous revision: 1.35
/cvsroot/ParaView/ParaView/VTK/Parallel/vtkParallelRenderManager.cxx,v 
<--  vtkParallelRenderManager.cxx
new revision: 1.48; previous revision: 1.47
/cvsroot/ParaView/ParaView/VTK/Parallel/vtkSharedMemoryCommunicator.cxx,v 
  <--  vtkSharedMemoryCommunicator.cxx
new revision: 1.21; previous revision: 1.20


Goodwin Lawlor wrote:
> Hi Denis,
> 
> I looked up the source to vtkGlyph3D and vtkAppendPolyData...
> 
> You're right- vtkGlyph3D can use a vtkPolyData with just points set and no
> topology.
> 
> The problem you seeing is because vtkAppendPolyData appends cells to its
> output and so needs topology...
> 
> here's the code from vtkAppendPolyData
> 
>   if ( numPts < 1 || numCells < 1 )
>     {
>     //vtkErrorMacro(<<"No data to append!");
>     return 1;
>     }
> 
> maybe that error macro should be changed to a debug macro and uncommented?
> 
> Sorry for the confusion,
> 
> Goodwin
> 
> "Denis Saussus" <saussus at skynet.be> wrote in message
> news:b004f848d9c67ed63cdbd70ee72f6b37 at skynet.be...
> Thanks for the replies Goodwin. You say that vtkGlyph3D needs both geometry
> and topology to work -- is that really true? How come the code fragment I
> posted works just fine as long as the input to vtkGlyph3D is the original
> vtkPolyData object (made manually with just points) and NOT the output of
> vtkAppendPolyData().GetOutput() ?
> 
> Anyway, here is the how I created the vtkPolyData objects.
> 
> import RandomArray
> 
> points = vtk.vtkPoints()
> for n in range(1000):
> x,y,z = [ RandomArray.normal(0, 1) for i in range(3) ]
> points.InsertPoint(n, x, y, z)
> a = vtk.vtkPolyData()
> a.SetPoints(points)
> 
> ... and so on for b = vtk.vtkPolyData()
> 
> Let me clarify the problem what is at the heart of the problem (I think ;)
> 
> This works:
> ...
> a = vtk.vtkPolyData()
> a.GetNumberOfPoints()
> ...
> 
> This does not work: Why?
> ...
> a = vtk.vtkPolyData()
> apd = vtk.vtkAppendPolyData()
> apd.AddInput(a)
> apd.GetOutput().GetNumberOfPoints()
> 
> 
> 
> Can you post the code where you've added points to the vtkPolyData objects?
> 
> 
> "Denis Saussus" <dsaussus at fugro-jason.com> wrote in message
> news:F42290EAAE100A4A99A3A9BE2059504FBDB121 at MAIL.fugro-jason.local...
> How can I get the following to print the total
> number of points in the appended set?
> 
> a = vtk.vtkPolyData()
> b = vtk.vtkPolyData()
> 
> apd = vtk.vtkAppendPolyData()
> apd.AddInput(a)
> apd.AddInput(b)
> 
> print apd.GetOutput().GetNumberOfPoints()
> 
> ==> this prints '0' instead of a+b ?
> 
> I tried doing apd.Update() before but it didn't help.
> 
> What am I missing?
> 
> 
> i Denis,
> 
> At a guess, I would say your vtkPolyData's have points (geometry) but no
> vertices (topology). vtkGlyph3D needs both to work, although in theory it
> should only need the points.
> 
> Here's a trick to get it to work:
> 
> ...
> ...
> apd = vtk.vtkAppendPolyData()
> apd.AddInput(somePolyData)
> apd.AddInput(someMorePolyData)
> 
> verts = vtk.vtkMaskPoints()
> verts.SetInput(apd.GetOutput())
> verts.GenerateVerticesOn()
> verts.SetOnRatio(1)
> 
> aSphere = vtk.vtkSphereSource()
> aSphere.SetRadius(1.0)
> 
> spheres = vtk.vtkGlyph3D()
> spheres.SetInput(verts.GetOutput())
> spheres.SetSource(aSphere.GetOutput())
> 
> ...
> ...
> 
> 
> hth
> 
> Goodwin
> "Denis Saussus" <dsaussus at fugro-jason.com> wrote in message
> news:F42290EAAE100A4A99A3A9BE2059504FBDB11C at MAIL.fugro-jason.local...
> I am plotting a vtkPolyData set containing 3d points so that
> they display as spheres. I can get this to work very easily.
> 
> Now I have two vtkPolyData sets, each containing 3d points.
> I want to plot them using a single mapper/actor. I am doing this
> simply by using vtkAppendPolyData to merge the two sets into
> one. My problem is that now nothing shows up.
> 
> Below is the script I am using. Help greatly aprpeciated...
> 
> 
> 
> 
> ##########################
> # Why does this not work?
> ##########################
> 
> somePolyData = vtk.vtkPolyData()
> # assume this contains some valid 3d points
> 
> apd = vtk.vtkAppendPolyData()
> apd.AddInput(somePolyData)
> apd.AddInput(someMorePolyData)
> 
> aSphere = vtk.vtkSphereSource()
> aSphere.SetRadius(1.0)
> 
> spheres = vtk.vtkGlyph3D()
> spheres.SetInput(apd.GetOutput())
> spheres.SetSource(aSphere.GetOutput())
> 
> mapSpheres = vtk.vtkPolyDataMapper()
> mapSpheres.SetInput(spheres.GetOutput())
> 
> spheresActor = vtk.vtkActor()
> spheresActor.SetMapper(mapSpheres)
> 
> ren = vtk.vtkRenderer()
> ren.AddActor(spheresActor)
> renWin = vtk.vtkRenderWindow()
> renWin.AddRenderer(ren)
> iren = vtk.vtkRenderWindowInteractor()
> iren.SetRenderWindow(renWin)
> iren.Initialize()
> renWin.Render()
> iren.Start()
> 
> 
> 
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
> 
> 
> 
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
> 




More information about the vtkusers mailing list