Forum Navigation
You need to log in to create posts and topics.

How to obtain other modifiers' setting in a python script modifier using ovito 3.0.0 GUI

Hi all,

I have a Displacement Vector modifier and a Python Script modifier in the pipeline. I want to calculate the energy change between the current frame and the reference file same as in the Displacement Vector modifier. Is it possible I could obtain the reference file name from the Displacement Vector modifier in the Python Script modifier using GUI?

Thanks,
Yifan

Hi Yifan,

is it a static file source that you're using? If yes, I think you should be able to access its file name if you add this code snippet before you define the modify() function in the Python script modifier in the GUI:

import ovito
from ovito.modifiers import CalculateDisplacementsModifier

pipeline = ovito.scene.pipelines[0]
for mod in pipeline.modifiers:
   if isinstance( mod, type(CalculateDisplacementsModifier())):
       print(mod.reference.source_path)

Does that answer your question?

-Constanze

 

新的OVITO微信频道!
New for our users in China: OVITO on WeChat 

Official OVITO WeChat channel operated by Foshan Diesi Technology Co., Ltd.