[vtkusers] Does anybody know how to use vtkIdType in Python?

Youbing Zhao zhaoyoubing at gmail.com
Mon Jan 11 09:36:28 EST 2010


Thank you very much, yes I made a mistake on the argument type.  The problem
has been solved now :)

The code looks like the following

    num = model.GetNumberOfPoints()
    ids = vtk.vtkIdList()
    ids.SetNumberOfIds(num);
    model.Allocate(1,1)

    for i in range(0, num):
        ids.SetId(i, i)
        model.InsertNextCell(vtk.VTK_VERTEX, ids)

On Mon, Jan 11, 2010 at 3:13 PM, David Gobbi <david.gobbi at gmail.com> wrote:

> Hi Youbing,
>
> For the second parameter for InsertNextCell() use a vtkIdList, not a
> vtkIdType.  But as for for vtkIdType, it's just a typedef as Jerome
> says.  In Python, you can use a python "int" or "long" for vtkIdType.
>
>   David
>
> On Mon, Jan 11, 2010 at 7:10 AM, Jérôme <jerome.velut at gmail.com> wrote:
> > Hi,
> >
> > In python, as far as I remember, the type of the data is given by the
> first
> > affectation. And in vtkType.h,
> > vtkIdType is a simple c++ define of int (basically speaking. It seems to
> > handle 64/32 integer cases.).
> > I think you should not have to give such a type to your "id"...
> >
> > Can you be more precise about your problem? eg giving code, error
> messages,
> > etc. ?
> >
> > Jerome
> >
> > 2010/1/11 Youbing Zhao <zhaoyoubing at gmail.com>
> >>
> >> Dear Guys,
> >>
> >> I'm try to call vtkPolyData.InsertNextCell(1, id) in Python which
> requires
> >> a vtkIdType variable as the second input.
> >>
> >> But I have no idea of setup a vtkIdType variable. I tried vtk.vtkIdType,
> >> but it's not in the module.
> >>
> >> Does anybody has the experience?
> >>
> >> Thank you very much
> >>
> >> Youbing
> >>
> >> _______________________________________________
> >> 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
> >>
> >> Follow this link to subscribe/unsubscribe:
> >> http://www.vtk.org/mailman/listinfo/vtkusers
> >>
> >
> >
> > _______________________________________________
> > 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
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
> >
> >
>



-- 
Youbing Zhao(趙友兵)
Phone: (+44) 75 0202 1598  (UK)
          (+86) 135 8571 8767 (中國)
Email : zhaoyoubing at gmail.com
MSN  : zhaoyoubing at hotmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100111/89fa9155/attachment.htm>


More information about the vtkusers mailing list