[Paraview] Python: Save Screenshot in parallel projection

Jonas Asche asche.j at googlemail.com
Thu Jul 16 16:41:13 EDT 2015


Of course i will CC the list, sorry.
Here is what i wrote in the mail Cory mentioned:

Hello Cory,
> I am using Paraview 4.2.0 on a Windows 7 Computer. My question
>  was actually if there is a bug when using it in a Python scipt and how
> you would set up such a script because mine did not work. I realize now
> that i could have put that information in my first mail :P
>
> I tried again after cleaning some code (positions were copied from the
> Trace function etc) but still there is no difference in enabling/disabling
> parallel projection. I do this while setting up the View
> (CreateRenderView()).
>
> Thank you,
>
> Jonas


I installed version 4.3.1 . My script is working now. I hate to admit it
but from all my testing i forgot to remove one line of code that was
constantly toggling ON parallel projection. So it did not matter if i
toggle it in a function befor because it got resettet al the time...

I also testet it with version 4.2.0 and it does work.

Sorry for wasting some of your time by this mistake of mine. And thank you
for your effort Cory.


Jonas


PS. since i know how helpful these emails can be in the future, here the
code to toggle parallel projection:

(assuming my_view is an object created by 'my_view = CreateRenderView()')

my_view.CameraParallelProjection = 1  # 1 = parallel
my__view.CameraParallelScale = 1.0



2015-07-16 21:33 GMT+02:00 Cory Quammen <cory.quammen at kitware.com>:

> Hi Jonas,
>
> Please remember to CC the list so that others may benefit from and
> contribute to the conversation.
>
> Could you download and try version 4.3.1 and let us know if you have
> problems with that version?
>
> Thanks,
> Cory
>
> On Thu, Jul 16, 2015 at 3:30 PM, Jonas Asche <asche.j at googlemail.com>
> wrote:
>
>> Hello Cory,
>> I am using Paraview 4.2.0 on a Windows 7 Computer. My question
>>  was actually if there is a bug when using it in a Python scipt and how
>> you would set up such a script because mine did not work. I realize now
>> that i could have put that information in my first mail :P
>>
>> I tried again after cleaning some code (positions were copied from the
>> Trace function etc) but still there is no difference in enabling/disabling
>> parallel projection. I do this while setting up the View
>> (CreateRenderView()).
>>
>> Thank you,
>>
>> Jonas
>>
>>
>> 2015-07-15 15:59 GMT+02:00 Cory Quammen <cory.quammen at kitware.com>:
>>
>>> Jonas,
>>>
>>> What version of ParaView are you using? I am using the latest master
>>> branch and saving a screenshot of with parallel projection seems to work
>>> fine on this version.
>>>
>>> Thanks,
>>> Cory
>>>
>>> On Mon, Jul 13, 2015 at 7:10 AM, Jonas Asche via ParaView <
>>> paraview at paraview.org> wrote:
>>>
>>>> Hello, when i try to switch to parallel projection on in my script i
>>>> can only save a screenshot with parallel projection disabled:
>>>>
>>>> self.__getView().CameraParallelProjection = 1
>>>> self.__getView().CameraParallelScale = 1.0
>>>> self.__getView().CameraViewUp = [0.0, 0.0, 1.0]
>>>> self.__getView().CameraPosition = camdirection[axis]
>>>> self.__getView().CameraFocalPoint = [0.0, 0.0, 33.32500076293945]
>>>> self.__getView().CameraClippingRange = [154.56988142373606, 215.9545612783452]
>>>>
>>>> SaveScreenshot(str(self.__getConfig().get("save", "path") + 'img-') + str(axis) + "-" + str(distribution) + '.png', self.__getView())
>>>>
>>>> When when i print out the parallel scale AFTER savin the screenshot it is set to 46.6471043813.
>>>>
>>>>
>>>> is this the same bug like here: http://paraview.org/Bug/view.php?id=7466
>>>>
>>>> ?
>>>>
>>>> Is there a workaround or am i doing something wrong?
>>>>
>>>> Thanks,
>>>>
>>>> Jonas
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> 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
>>>>
>>>> Search the list archives at: http://markmail.org/search/?q=ParaView
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://public.kitware.com/mailman/listinfo/paraview
>>>>
>>>>
>>>
>>>
>>> --
>>> Cory Quammen
>>> R&D Engineer
>>> Kitware, Inc.
>>>
>>
>>
>
>
> --
> Cory Quammen
> R&D Engineer
> Kitware, Inc.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20150716/9d49732b/attachment.html>


More information about the ParaView mailing list