[vtkusers] vtkStructuredGrid with dimensions (x, y=1, z=1) or (x, y=1) bug?

da remywendy at gmail.com
Mon Oct 5 14:03:47 EDT 2009


Hi all,

I posted this problem a few months back, and still haven't been able to
figure this out so I figured I would try again on the mailing list.

The problem is that vtkStructuredGrid dimensions of (x,y=1,z=1) or (x, y=1)
do not seem to display correctly (and doesn't display at all on Paraview).
In my application, after passing through a vtkStructuredGridGeometryFilter
and vtkDataSetMapper, the vtkActor->GetProperty()->SetRepresentationTo(xxx)
no longer works; I cannot see points or surface or wireframe (it always
shows an outline, which is the same as what it would look like in
wireframe).

Attached is a (x,y=1,z=1) plot3d file that you can open up with Paraview to
see the problem. (options= unselect everything, not binary or any other
option).

Because a vtkStructuredGrid with (x,y,z=1) displays fine, I'm guessing this
has to do with the structured grid having ncells = npoints-1, and the cells
types are all lines; somehow its not being mapped or rendered correctly? Or
am I not implementing the correct pipeline after
vtkStructuredGridGeometryFilter?



Currently, what I do when I read a structured grid with dimensions of
(x,y=1,z=1) or (x, y=1), I manually convert the vtkStructuredGrid to a
vtkPolyData with the following, just so it displays correctly. However, I
want to get rid of this and fix the core of the problem. Any ideas
appreciated.

    int counter_oneD = 0;
    for (int a=0; a<3;a++){
        if (dim[a]==1)
            counter_oneD++;
    }
    if (counter_oneD==2)
    {
        vtkPolyData *polyData = vtkPolyData::New();
        polyData->SetPoints(points);
        vtkCellArray *carray = vtkCellArray::New();
        for (int a=0; a<ntemp; a++)
        {
            carray->InsertNextCell(1, &a);
        }
        polyData->SetVerts(carray);
        vtkPolyDataMapper *polyMapper = vtkPolyDataMapper::New();
        polyMapper->SetInput(polyData);

        // need to make member...
        if (!m_ActorFix)
            m_ActorFix = vtkActor::New();

m_ActorFix->GetProperty()->SetRepresentation(this->m_Representation);
        m_ActorFix->GetProperty()->SetPointSize(this->m_PointSize);
        m_ActorFix->GetProperty()->SetColor(this->m_Color[0],
this->m_Color[1], this->m_Color[2]);
        m_ActorFix->SetMapper(polyMapper);
        renderer->AddActor(m_ActorFix);
    }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091005/65f7819b/attachment.htm>


More information about the vtkusers mailing list