Canvas

Canvas(
    self,
    engine='EEVEE',
    resolution=(1280, 720),
    transparent=False,
    template='Molecular Nodes',
)

A class to handle canvas and render settings in Blender.

This class provides properties to get and set various render settings like resolution, render engine, samples, FPS, and frame ranges.

Attributes

Name Description
fps Get the frames per second setting.
frame_end Get the end frame of the animation.
frame_start Get the start frame of the animation.
resolution Get the render resolution.
transparent Get the transparency setting for rendering.
view_transform Get the current view transform setting.

Methods

Name Description
animation Render an animation of the current scene.
clear Clear all entities from the scene without affecting lighting or render settings.
frame_object Frame an object or Molecular entity
frame_view Frame one or more views of Molecular entities
snapshot Render an image of the current scene.

animation

Canvas.animation(path=None, frame_start=None, frame_end=None, render_scale=100)

Render an animation of the current scene.

Parameters

Name Type Description Default
path str | Path | None File path to write the rendered animation to. None
frame_start int Start frame of the animation. When not specified, current scene’s start frame is used None
frame_end int End frame of the animation. When not specified, current scene’s end frame is used None
render_scale int Scale of the rendered animation frames with respect to the resolution. 100

clear

Canvas.clear()

Clear all entities from the scene without affecting lighting or render settings.

frame_object

Canvas.frame_object(obj, viewpoint=None)

Frame an object or Molecular entity

Parameters

Name Type Description Default
obj bpy.types.Object | MolecularEntity Blender object or Molecular entity to frame. required
viewpoint Viewpoints Viewing direction along an axis One of [“default”, “front”, “back”, “top”, “bottom”, “left”, “right”] None

frame_view

Canvas.frame_view(view, viewpoint=None)

Frame one or more views of Molecular entities Multiple views can be added with + to combine into a single view

Parameters

Name Type Description Default
view list[tuple] | MolecularEntity A bounding box (set of 8 3D vertices) of the region of interest required
viewpoint Viewpoints Viewing direction along an axis One of [“default”, “front”, “back”, “top”, “bottom”, “left”, “right”] None

snapshot

Canvas.snapshot(path=None, frame=None, file_format='PNG')

Render an image of the current scene.

Parameters

Name Type Description Default
path str | Path | None File path to write the rendered image to. None
frame int Frame number of scene to render. When not specified, current scene’s current_frame is used None
file_format str File format of the rendered image. 'PNG'