Skip to content

Commit

Permalink
Updating ovito scripting capability
Browse files Browse the repository at this point in the history
  • Loading branch information
bsrunnels committed Nov 21, 2023
1 parent 7d1efb2 commit 7f77837
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
bleMD.zip:
zip bleMD.zip bleMD/*
SRC = $(shell find bleMD)

bleMD.zip: $(SRC)
zip -r bleMD.zip bleMD/*

22 changes: 19 additions & 3 deletions bleMD/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,29 @@ class WM_OT_bleMDOpenOvitoScript(Operator):
def execute(self, context):
if "Ovito" not in bpy.data.texts.keys():
bpy.data.texts.new("Ovito")
bpy.data.texts['Ovito'].write("# You can put in your ovito script here!")
bpy.data.texts['Ovito'].write(
"""
#
# You can set up OVITO commands to run here.
#
# You are given a "pipeline" object that has already been loaded.
# All you need to do is set up the modifiers that you want to use.
# For instance, you can use the following lines to unwrap trajectories:
#
# from ovito.modifiers import UnwrapTrajectoriesModifier
# from ovito.modifiers import WrapPeriodicImagesModifier
# pipeline.modifiers.append(WrapPeriodicImagesModifier())
# pipeline.modifiers.append(UnwrapTrajectoriesModifier())
#
""")


bpy.context.window.workspace = bpy.data.workspaces['Scripting']
for area in context.screen.areas:
if area.type == "TEXT_EDITOR":
break
area.spaces[0].text = bpy.data.texts['Ovito']
for space in area.spaces:
if type(space) == bpy.types.SpaceTextEditor:
space.text = bpy.data.texts['Ovito']

return {'FINISHED'}

Expand Down
3 changes: 3 additions & 0 deletions scripts/install.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import bpy
bpy.ops.preferences.addon_install(filepath="bleMD.zip",overwrite=True)
bpy.ops.preferences.addon_enable(module='bleMD')

#bpy.context.scene.bleMD_props.lammpsfile="/home/brunnels/Downloads/qstruct_S3_fcc_N13_n17_25_Al_M99_201228.389.out"
#bpy.ops.wm.read_lammps_file()

0 comments on commit 7f77837

Please sign in to comment.