Skip to content

Commit

Permalink
Removed screenshot function for now
Browse files Browse the repository at this point in the history
  • Loading branch information
YHordijk committed Nov 6, 2023
1 parent dae112d commit 6a8020c
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions src/tcviewer/screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,15 @@




class Screen:
def __init__(self, **kwargs):
self.screenshot_file = kwargs.get('screenshot_file')
self.meshes = []

def __enter__(self):
return self

def __exit__(self, *args, **kwargs):
if self.screenshot_file is None:
o3d.visualization.draw(self.meshes, show_skybox=False, title='TCViewer')
return

vis = o3d.visualization.Visualizer()
vis.create_window()
[vis.add_geometry(mesh) for mesh in self.meshes]
# vis.update_geometry()
# vis.update_renderer()
vis.capture_screen_image(self.screenshot_file, True)
vis.destroy_window()



o3d.visualization.draw(self.meshes, show_skybox=False, title='TCViewer')

def add_mesh(self, geometry, name=None, material=None):
self.meshes.append(dict(geometry=geometry, name=name or str(id(geometry)), material=material))
Expand Down Expand Up @@ -160,7 +145,7 @@ def draw_axes(self, center=[0, 0, 0], length=1, width=.04, **kwargs):

for mo_index in range(len(energies)):
mo = MolecularOrbital(aos, coefficients[:, mo_index], mol)
with Screen(screenshot_file='test.png') as scr:
with Screen() as scr:
scr.draw_molecule(mol)
scr.draw_orbital(mo)
scr.draw_axes()

0 comments on commit 6a8020c

Please sign in to comment.