[vtk-developers] Initializing Python VTK object from existing VTK object

David Gobbi david.gobbi at gmail.com
Thu Aug 18 12:51:01 EDT 2016


Hi Cory,

The code that deals with this is vtkPythonUtil::GetObjectFromObject(),
which tries to decode the address with these three format string:

    "_%llx_%s"
    "Addr=0x%llx"
    "%p"

The first of these is a "SWIG-style" pointer string, the second is legacy,
and the third is what is catching your address.  I believe that whether it
accepts "0x" is platform specific.

 - David

On Thu, Aug 18, 2016 at 10:17 AM, Cory Quammen <cory.quammen at kitware.com>
wrote:

> One can create a Python object from an existing VTK object if the
> address of the VTK object is known, e.g.,
>
> address = "0xbeefbeef"
> sphereSource = vtk.vtkSphereSource(address)
>
> My question is about the address string. Can the address string keep
> the prefix "0x" or must it be removed? I've looked around the Python
> wrapping code, but haven't concluded one way or the other. Some code
> in ParaView unintentionally uses the full address with "0x" and seems
> to work, so I'm guessing either is fine.
>
> Thanks,
> Cory
>
> --
> Cory Quammen
> R&D Engineer
> Kitware, Inc.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20160818/5b042786/attachment.html>


More information about the vtk-developers mailing list