Author Topic: About the FreezePropertyModifier  (Read 194 times)

lx_pico

  • Newbie
  • *
  • Posts: 13
About the FreezePropertyModifier
« 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?  :-[
« Last Edit: April 12, 2019, 03:10:40 AM by lx_pico »

Constanze Kalcher

  • Administrator
  • Sr. Member
  • *****
  • Posts: 301
Re: About the FreezePropertyModifier
« Reply #1 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

-Constanze