OVITO Forum

OVITO => Support Forum => Topic started by: lx_pico on April 11, 2019, 10:04:38 AM

Title: About the FreezePropertyModifier
Post by: lx_pico on April 11, 2019, 10:04:38 AM
Hi,
    I'm trying to do analysis on a layer of atoms, which is selectd from the 12th frame of a animation sequence
   i wrote a python script like:
--------------------------------------------------------------------
node = import_file("R100401.*collisions.dat")

#select atomic layer
mod5 = SelectExpressionModifier(expression = 'Position.Y>265 || Position.Y<195 ')
node.modifiers.append(mod5)

modifier = FreezePropertyModifier(source_property = 'Selection',
                                  destination_property = 'Selection')
node.modifiers.append(modifier)
modifier.take_snapshot()
-----------------------------------------------------------------------------------------------

it went well but when i change the last line to "modifier.take_snapshot(12)", an error massage appears:
AttributeError: 'PyScriptAnimation.AnimationSettings' object has no attribute 'frameToTime'

what the correct syntax is?  :-[
Title: Re: About the FreezePropertyModifier
Post by: Constanze Kalcher on April 12, 2019, 11:21:31 AM
Hi,

that is quite possibly a bug. Could you please try this:
Code: [Select]
from ovito import dataset
[...]
dataset.anim.current_frame = 12
modifier.take_snapshot()

Alternatively, I would recommend you to upgrade to the latest developer version ovito-3.0.0-dev and use:
Code: [Select]
modifier = FreezePropertyModifier(source_property = 'Selection',
                                  destination_property = 'Selection',
                                  freeze_at = 12)
node.modifiers.append(modifier)

http://ovito.org/manual_testing/python/modules/ovito_modifiers.html#ovito.modifiers.FreezePropertyModifier (http://ovito.org/manual_testing/python/modules/ovito_modifiers.html#ovito.modifiers.FreezePropertyModifier)

-Constanze