[vtkusers] adding cell data directly

Roberson, Kyle Kyle_Roberson at duratekinc.com
Wed Apr 16 19:40:33 EDT 2003


I'm gradually closing in on the ability to construct an unstructured grid
with associated data. I can now make the grid and write it out. What I can't
do yet is add data to the cells (or points). I looked at the tutorial
presentation referenced earlier, but that syntax doesn't work for me...
vtkAddScalars is not defined.

Anyway, here I'm creating a hexahedron and adding it to an unstructured grid
through a filter. Can I add a scalar value to the cell now? Say an interger
v[1]? "C3D8R" is an ABAQUS element name...

Cheers,
Kyle

P.S. sorry if you get an html version of this message. I'm doing this in
plain text but when I see it comeback in the digest it is in html...

python code follows:

        elif v[0] == "C3D8R" :
            thingPoints = vtk.vtkPoints()
            thingPoints.SetNumberOfPoints(8)
            thingPoints.InsertPoint(0, node[v[2]][0], node[v[2]][1],
node[v[2]][2])
            thingPoints.InsertPoint(1, node[v[3]][0], node[v[3]][1],
node[v[3]][2])
            thingPoints.InsertPoint(2, node[v[4]][0], node[v[4]][1],
node[v[4]][2])
            thingPoints.InsertPoint(3, node[v[5]][0], node[v[5]][1],
node[v[5]][2])
            thingPoints.InsertPoint(4, node[v[6]][0], node[v[6]][1],
node[v[6]][2])
            thingPoints.InsertPoint(5, node[v[7]][0], node[v[7]][1],
node[v[7]][2])
            thingPoints.InsertPoint(6, node[v[8]][0], node[v[8]][1],
node[v[8]][2])
            thingPoints.InsertPoint(7, node[v[9]][0], node[v[9]][1],
node[v[9]][2])
            aThing = vtk.vtkHexahedron()
            aThing.GetPointIds().SetId(0, 0)
            aThing.GetPointIds().SetId(1, 1)
            aThing.GetPointIds().SetId(2, 2)
            aThing.GetPointIds().SetId(3, 3)
            aThing.GetPointIds().SetId(4, 4)
            aThing.GetPointIds().SetId(5, 5)
            aThing.GetPointIds().SetId(6, 6)
            aThing.GetPointIds().SetId(7, 7)
            aThingGrid = vtk.vtkUnstructuredGrid()
            aThingGrid.Allocate(1, 1)
            aThingGrid.InsertNextCell(aThing.GetCellType(),\
                                           aThing.GetPointIds())
            aThingGrid.SetPoints(thingPoints)

            pipeline.AddInput(aThingGrid)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20030416/943ff229/attachment.htm>


More information about the vtkusers mailing list