Control paraview interactively using IDLE?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Control paraview interactively using IDLE?

Amine Aboufirass

I am trying to control Paraview interactively using IDLE. This would involve sending commands from IDLE and seeing the changes occur in Paraview. I would rather not use the in-Paraview python shell.

So far, I have succeeded in importing the Paraview modules (simple, servermanager…etc) from IDLE. However the commands sent do not reflect in Paraview. For instance:

>>> from paraview.simple import *
>>> cone = Cone()
>>> Show()
>>> Render()

does indeed create a cone. However the cone is output to a new, independent OpenGL window, and not the Paraview GUI.

Is it possible to control Paraview interactively using IDLE? If so how to accomplish this? Thanks


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=Paraview-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview-developers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Control paraview interactively using IDLE?

Cory Quammen-2
Amine,

As far as I am aware, I'm afraid that you will not be able to control
the paraview UI from an external Python. The ParaView GUI owns its
internal Python environment, and the Python environment (including the
paraview.simple module) does not have a direct reference to the
ParaView GUI side of things. It may appear that you are controlling
the GUI via Python in ParaView's Python console, but that happens
indirectly. Your Python script change objects in ParaView, but the UI
changes you see are the result of observers in the UI listening for
updates to ParaView's state and updating themselves based on the new
values. The Python script does not control the UI elements directly.

The reason you see a separate render window is because running pure
Python scripts through pvpython or pvbatch, which are basically Python
executables with some additional path information, is explicitly
supported - the lone window appears when rendering commands are issued
in the script. What you have done with an external (and compatible)
Python is also supported, but it does not let you invoke the GUI
application, let alone control it.

Hope that helps,
Cory

On Sat, Jul 22, 2017 at 2:02 AM, Amine Aboufirass
<[hidden email]> wrote:

> I am trying to control Paraview interactively using IDLE. This would involve
> sending commands from IDLE and seeing the changes occur in Paraview. I would
> rather not use the in-Paraview python shell.
>
> So far, I have succeeded in importing the Paraview modules (simple,
> servermanager…etc) from IDLE. However the commands sent do not reflect in
> Paraview. For instance:
>
>>>> from paraview.simple import *
>>>> cone = Cone()
>>>> Show()
>>>> Render()
>
> does indeed create a cone. However the cone is output to a new, independent
> OpenGL window, and not the Paraview GUI.
>
> Is it possible to control Paraview interactively using IDLE? If so how to
> accomplish this? Thanks
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Search the list archives at:
> http://markmail.org/search/?q=Paraview-developers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/paraview-developers
>



--
Cory Quammen
Staff R&D Engineer
Kitware, Inc.
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=Paraview-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview-developers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Control paraview interactively using IDLE?

Amine Aboufirass
Hi Cory,

Thanks for your response. That is quite unfortunate. I think it would be very helpful for new, inexperienced users to "play around" with the interface in such a manner. Of course, I am one of these inexperienced users and so I have no idea of the development effort it would take to be able to do such a thing.

On another note, I would like to ask about python versioning for the existing Paraview API. As you might know python is up to version 3.6 now. As far as I'm aware Paraview.simple works only on Python 2.7? Most libraries are now using at least 3.4 or so, especially libraries I would like to use Paraview with.

Is an upgrade of the Paraview module underway? If not would it be possible for a lambda user to recompile them into later versions of python and use them?

I had one guy from kitware tell me the following: 

No, recompilation is required to have the Python extensions using C to use Python3. The easiest fix right now is to recompile ParaView yourself, sorry
 
Of course I can try to recompile it but this would be a huge pain. So I don't want to embark on this adventure unless it is feasible within a reasonable time frame (which I doubt)....

What's your take? Is it possible to use the API with Python 3?

Regards,

Amine
 

On Sat, Jul 22, 2017 at 3:44 PM, Cory Quammen <[hidden email]> wrote:
Amine,

As far as I am aware, I'm afraid that you will not be able to control
the paraview UI from an external Python. The ParaView GUI owns its
internal Python environment, and the Python environment (including the
paraview.simple module) does not have a direct reference to the
ParaView GUI side of things. It may appear that you are controlling
the GUI via Python in ParaView's Python console, but that happens
indirectly. Your Python script change objects in ParaView, but the UI
changes you see are the result of observers in the UI listening for
updates to ParaView's state and updating themselves based on the new
values. The Python script does not control the UI elements directly.

The reason you see a separate render window is because running pure
Python scripts through pvpython or pvbatch, which are basically Python
executables with some additional path information, is explicitly
supported - the lone window appears when rendering commands are issued
in the script. What you have done with an external (and compatible)
Python is also supported, but it does not let you invoke the GUI
application, let alone control it.

Hope that helps,
Cory

On Sat, Jul 22, 2017 at 2:02 AM, Amine Aboufirass
<[hidden email]> wrote:
> I am trying to control Paraview interactively using IDLE. This would involve
> sending commands from IDLE and seeing the changes occur in Paraview. I would
> rather not use the in-Paraview python shell.
>
> So far, I have succeeded in importing the Paraview modules (simple,
> servermanager…etc) from IDLE. However the commands sent do not reflect in
> Paraview. For instance:
>
>>>> from paraview.simple import *
>>>> cone = Cone()
>>>> Show()
>>>> Render()
>
> does indeed create a cone. However the cone is output to a new, independent
> OpenGL window, and not the Paraview GUI.
>
> Is it possible to control Paraview interactively using IDLE? If so how to
> accomplish this? Thanks
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Search the list archives at:
> http://markmail.org/search/?q=Paraview-developers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/paraview-developers
>



--
Cory Quammen
Staff R&D Engineer
Kitware, Inc.


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=Paraview-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview-developers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Control paraview interactively using IDLE?

Cory Quammen-2
Amine,

No, you won't be able to use the Python API from within a binary you
have downloaded from paraview.org with Python 3. You would indeed need
to compile ParaView with Python 3. Doing so is officially supported
(we have regular test builds against Python 3), we just don't ship the
binaries with Python 3 for now. I'm not sure when we will ship
binaries with Python 3, perhaps in the next couple releases.

Best regards,
Cory


On Fri, Aug 4, 2017 at 10:29 AM, Amine Aboufirass
<[hidden email]> wrote:

> Hi Cory,
>
> Thanks for your response. That is quite unfortunate. I think it would be
> very helpful for new, inexperienced users to "play around" with the
> interface in such a manner. Of course, I am one of these inexperienced users
> and so I have no idea of the development effort it would take to be able to
> do such a thing.
>
> On another note, I would like to ask about python versioning for the
> existing Paraview API. As you might know python is up to version 3.6 now. As
> far as I'm aware Paraview.simple works only on Python 2.7? Most libraries
> are now using at least 3.4 or so, especially libraries I would like to use
> Paraview with.
>
> Is an upgrade of the Paraview module underway? If not would it be possible
> for a lambda user to recompile them into later versions of python and use
> them?
>
> I had one guy from kitware tell me the following:
>
>> No, recompilation is required to have the Python extensions using C to use
>> Python3. The easiest fix right now is to recompile ParaView yourself, sorry
>
>
> Of course I can try to recompile it but this would be a huge pain. So I
> don't want to embark on this adventure unless it is feasible within a
> reasonable time frame (which I doubt)....
>
> What's your take? Is it possible to use the API with Python 3?
>
> Regards,
>
> Amine
>
>
> On Sat, Jul 22, 2017 at 3:44 PM, Cory Quammen <[hidden email]>
> wrote:
>>
>> Amine,
>>
>> As far as I am aware, I'm afraid that you will not be able to control
>> the paraview UI from an external Python. The ParaView GUI owns its
>> internal Python environment, and the Python environment (including the
>> paraview.simple module) does not have a direct reference to the
>> ParaView GUI side of things. It may appear that you are controlling
>> the GUI via Python in ParaView's Python console, but that happens
>> indirectly. Your Python script change objects in ParaView, but the UI
>> changes you see are the result of observers in the UI listening for
>> updates to ParaView's state and updating themselves based on the new
>> values. The Python script does not control the UI elements directly.
>>
>> The reason you see a separate render window is because running pure
>> Python scripts through pvpython or pvbatch, which are basically Python
>> executables with some additional path information, is explicitly
>> supported - the lone window appears when rendering commands are issued
>> in the script. What you have done with an external (and compatible)
>> Python is also supported, but it does not let you invoke the GUI
>> application, let alone control it.
>>
>> Hope that helps,
>> Cory
>>
>> On Sat, Jul 22, 2017 at 2:02 AM, Amine Aboufirass
>> <[hidden email]> wrote:
>> > I am trying to control Paraview interactively using IDLE. This would
>> > involve
>> > sending commands from IDLE and seeing the changes occur in Paraview. I
>> > would
>> > rather not use the in-Paraview python shell.
>> >
>> > So far, I have succeeded in importing the Paraview modules (simple,
>> > servermanager…etc) from IDLE. However the commands sent do not reflect
>> > in
>> > Paraview. For instance:
>> >
>> >>>> from paraview.simple import *
>> >>>> cone = Cone()
>> >>>> Show()
>> >>>> Render()
>> >
>> > does indeed create a cone. However the cone is output to a new,
>> > independent
>> > OpenGL window, and not the Paraview GUI.
>> >
>> > Is it possible to control Paraview interactively using IDLE? If so how
>> > to
>> > accomplish this? Thanks
>> >
>> >
>> > _______________________________________________
>> > Powered by www.kitware.com
>> >
>> > Visit other Kitware open-source projects at
>> > http://www.kitware.com/opensource/opensource.html
>> >
>> > Search the list archives at:
>> > http://markmail.org/search/?q=Paraview-developers
>> >
>> > Follow this link to subscribe/unsubscribe:
>> > http://public.kitware.com/mailman/listinfo/paraview-developers
>> >
>>
>>
>>
>> --
>> Cory Quammen
>> Staff R&D Engineer
>> Kitware, Inc.
>
>



--
Cory Quammen
Staff R&D Engineer
Kitware, Inc.
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=Paraview-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview-developers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Control paraview interactively using IDLE?

Bob Pepin
In reply to this post by Amine Aboufirass
(sorry for out-of-thread message, I only joined the mailing list today and saw this in the archives)

Hi Amine,
I have had some success controlling paraview from Python using multi-client mode. Basically you need to start pvserver using the --multi-clients option, then connect to the same server both with a GUI and a Python client. You can now create objects from the Python client and have them appear in the GUI, and there is even limited support for playing around with Layouts and such. However, I have to say that it was quite easy to crash paraview when playing around with this.

My original motivation for doing this was to see if I could replace Matlab with Python plus some plotting software that can zoom, pick points and do some 3d (interactivity  in the common Python plotting packages is surprisingly limited). ParaView looks promising but I haven't pursued the interactive part much since my initial experiments with multi-client mode, for me it worked well enough just to write data out to hdf5 files and create little xdmf3 files to go with it.

Hope this helps,
Bob

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=Paraview-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview-developers
Loading...