Author Topic: Creating modifiers  (Read 232 times)


  • Newbie
  • *
  • Posts: 1
Creating modifiers
« on: December 12, 2017, 02:09:13 PM »
I am trying to create a modifier. Then, I did the 'exercise' proposed on the Ovito's documentation:

from ovito.modifiers import *
m = AssignColorModifier()
m.color = (0.2, 1.0, 0.9)

This is OVITO's interactive IPython interpreter. Use quit() or Ctrl-D to exit.
In [1]: from ovito.modifiers import *
In [2]: m = AssignColorModifier()
In [3]: m.color = (0.2, 1.0, 0.9)
In [4]: node.modifiers.append(m)
NameError                                 Traceback (most recent call last)
<ipython-input-4-bee02021f91e> in <module>()
----> 1 node.modifiers.append(m)

As one can see I got an error. Can anyone tell me what I doing wrong?
NameError: name 'node' is not defined

Alexander Stukowski

  • Administrator
  • Sr. Member
  • *****
  • Posts: 398
Re: Creating modifiers
« Reply #1 on: December 12, 2017, 04:26:39 PM »
Note that this example snippet is not a self-contained script. It assumes that you have loaded some data from a file first, as explained earlier in the documentation. See

Calling the import_file() function creates a new ObjectNode object, which is assigned to the "node" Python variable. Later, in the snippet you posted, the new modifier is inserted into the data pipeline of that ObjectNode.