[Paraview] paraview plugins and python

Paul Edwards paul.m.edwards at gmail.com
Tue May 22 13:38:37 EDT 2012


Ok, found the solution - VTK_PYTHON_INCLUDE_DIR

Sorry for the noise!

On 22 May 2012 18:22, Paul Edwards <paul.m.edwards at gmail.com> wrote:

> Is there a way here to get the python include directory that was used by
> VTK? i.e. in the wrap_python function I need the following lines:
>     include_directories(${library_name}PythonD ${PYTHON_INCLUDE_DIR})
>     include_directories(${library_name}Python ${PYTHON_INCLUDE_DIR})
>
> But, I'm not sure how to get the PYTHON_INCLUDE_DIR from VTK (other that
> set it again when configuring).
>
> Thanks,
> Paul
>
>
> On 3 May 2012 13:52, Paul Edwards <paul.m.edwards at gmail.com> wrote:
>
>> Thanks Pat, it works :)
>>
>>
>> On 2 May 2012 18:05, Pat Marion <pat.marion at kitware.com> wrote:
>>
>>> This will do it:
>>>
>>> # CMakeLists.txt
>>>
>>> include(wrap-python.cmake)
>>>
>>> add_paraview_plugin(${library_name} ...)
>>> target_link_libraries(${library_name} ${deps})
>>>
>>> if(VTK_WRAP_PYTHON)
>>>   wrap_python(${library_name} "${sources}")
>>> endif()
>>>
>>>
>>>
>>>
>>> # wrap-python.cmake
>>> if(NOT DEFINED VTK_CMAKE_DIR)
>>>   message(SEND_ERROR "VTK_CMAKE_DIR is not defined, cannot load
>>> vtkWrapPython.cmake")
>>> endif()
>>>
>>> if(NOT VTK_WRAP_PYTHON)
>>>   message(FATAL_ERROR "VTK was built without Python enabled
>>> (VTK_WRAP_PYTHON=FALSE).")
>>> endif()
>>>
>>> include(${VTK_CMAKE_DIR}/vtkWrapPython.cmake)
>>> function(wrap_python library_name sources)
>>>   vtk_wrap_python3(${library_name}Python generated_python_sources
>>> "${sources}")
>>>   add_library(${library_name}PythonD ${generated_python_sources})
>>>   add_library(${library_name}Python MODULE ${library_name}PythonInit.cxx)
>>>   target_link_libraries(${library_name}PythonD ${library_name})
>>>   foreach(c ${VTK_LIBRARIES})
>>>     target_link_libraries(${library_name}PythonD ${c}PythonD)
>>>   endforeach(c)
>>>   target_link_libraries(${library_name}Python ${library_name}PythonD)
>>>   set_target_properties(${library_name}Python PROPERTIES PREFIX "")
>>>   if(WIN32 AND NOT CYGWIN)
>>>     set_target_properties(${library_name}Python PROPERTIES SUFFIX ".pyd")
>>>   endif(WIN32 AND NOT CYGWIN)
>>> endfunction()
>>>
>>>
>>>
>>> Pat
>>>
>>>
>>>
>>> On Wed, May 2, 2012 at 11:56 AM, Sebastien Jourdain <
>>> sebastien.jourdain at kitware.com> wrote:
>>>
>>>> Hi Paul,
>>>>
>>>> it is not a CMake option but a CMake macro/function that need to be
>>>> called inside your Plugin CMake file... But I have no clue how, has I
>>>> took another path when I solved that exact same problem.
>>>> In my case, I simply extended ParaView itself instead of relying on a
>>>> plugin...
>>>>
>>>> Seb
>>>>
>>>> On Wed, May 2, 2012 at 11:49 AM, Paul Edwards <paul.m.edwards at gmail.com>
>>>> wrote:
>>>> > I'm actually wanting the VTK classes rather than the proxy.
>>>> >
>>>> > Sebastian: are you referring to the VTK_WRAP_PYTHON_SIP option?  I
>>>> don't
>>>> > have that enabled atm but could try...
>>>> >
>>>> > Thanks,
>>>> > Paul
>>>> >
>>>> >
>>>> > On 2 May 2012 16:43, Andy Bauer <andy.bauer at kitware.com> wrote:
>>>> >>
>>>> >> I'm not sure this is what you're looking for but the proxy does get
>>>> >> wrapped such that it's available through pvpython and pvbatch.  When
>>>> you
>>>> >> load the plugin, do "LoadPlugin("<shared lib location>", True,
>>>> globals())"
>>>> >> and it should be available.  If you're want the actual VTK class to
>>>> by
>>>> >> python wrapped, I think Sebastien is correct though.
>>>> >>
>>>> >> Andy
>>>> >>
>>>> >>
>>>> >> On Wed, May 2, 2012 at 11:32 AM, Sebastien Jourdain
>>>> >> <sebastien.jourdain at kitware.com> wrote:
>>>> >>>
>>>> >>> Hi Paul,
>>>> >>>
>>>> >>> your vtk class are not "python" wrapped automatically when provided
>>>> >>> from plugin. But you might be able to use a CMake macro that has
>>>> been
>>>> >>> defined in ParaView to force your vtk classes to be Python wrapped.
>>>> >>> Although, I'm not fully certain that will just work.
>>>> >>> Unfortunately I don't have much insight on where to look.
>>>> >>>
>>>> >>> Dave DeMarle might be able to point you to the right direction...
>>>> >>>
>>>> >>> Seb
>>>> >>>
>>>> >>> On Wed, May 2, 2012 at 10:56 AM, Paul Edwards <
>>>> paul.m.edwards at gmail.com>
>>>> >>> wrote:
>>>> >>> > Hi,
>>>> >>> >
>>>> >>> > Do my VTK classes get wrapped when I create a paraview plugin?
>>>>  If so,
>>>> >>> > how
>>>> >>> > do I access them? And, if not, is it possible to do this?
>>>> >>> >
>>>> >>> > Thanks,
>>>> >>> > Paul
>>>> >>> >
>>>> >>> > _______________________________________________
>>>> >>> > 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 ParaView Wiki at:
>>>> >>> > http://paraview.org/Wiki/ParaView
>>>> >>> >
>>>> >>> > Follow this link to subscribe/unsubscribe:
>>>> >>> > http://www.paraview.org/mailman/listinfo/paraview
>>>> >>> >
>>>> >>> _______________________________________________
>>>> >>> 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 ParaView Wiki at:
>>>> >>> http://paraview.org/Wiki/ParaView
>>>> >>>
>>>> >>> Follow this link to subscribe/unsubscribe:
>>>> >>> http://www.paraview.org/mailman/listinfo/paraview
>>>> >>
>>>> >>
>>>> >
>>>> _______________________________________________
>>>> 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 ParaView Wiki at:
>>>> http://paraview.org/Wiki/ParaView
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://www.paraview.org/mailman/listinfo/paraview
>>>>
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20120522/270dd304/attachment-0001.htm>


More information about the ParaView mailing list