Print File Generator
Workspace
A Workspace defines an exposure area based on a light engine and stitching parameters, centered around its given position. A Workspace is initialized with a printer and pixel size, which it uses to look up the appropriate light engine. Multiple components can be placed in the Workspace, and it checks that they fit within the light engine's exposure region. If a subcomponent somewhere in a component's hierarchy uses a different light engine than its parent, you can adjust the light engine exposure position for that subcomponent.
__init__
__init__(
printer: Printer,
pixel_size: float,
exposure_abs_pos_um: tuple[float, float],
light_engine_stitching: tuple[int, int] = (1, 1),
)
Initialize a Workspace.
Parameters:
- printer: The printer object containing printer settings.
- pixel_size: The pixel size of the components in the workspace.
- exposure_abs_pos_um: The absolute position of the exposure region in micrometers.
- light_engine_stitching: The stitching configuration of the light engine exposure region.
add_component
add_component(
name: str, component: Component, centered: bool = True
)
Add a component to the workspace. To position component use standard translation functions Component is centered in workspace by default with translations modifying that position relative to the workspaces's center.
Parameters:
- component: The component to add.
- centered: Whether to center the component in the workspace. Default is True.
adjust_subcomponent_light_engine_position
adjust_subcomponent_light_engine_position(
subcomponent_fqn: str,
exposure_rel_pos_um: tuple[float, float],
)
Adjust the light engine exposure position for a subcomponent which uses a different light engine than the parent component.
Parameters:
- subcomponent_fqn: The fully qualified name of the subcomponent.
- exposure_rel_pos_um: The relative position of the exposure region in micrometers.
PrintFileGenerator
__init__
__init__(
filename: str,
author: str = "",
purpose: str = "",
description: str = "",
component: list[Component] = None,
workspaces: list[Workspace] = None,
printer: Printer = None,
resin: ResinType = None,
special_print_techniques: list = None,
minimize_file: bool = True,
zip_output: bool = True,
)
Initialize the PrintFileGenerator. Accepts either a component or a list of workspaces. If a component is provided, it will be wrapped in a default workspace for slicing. If multiple components are going to be printed, they should be placed in a workspace.
Parameters:
- filename: Name of the output file/folder.
- author: Name of the author.
- purpose: Purpose of the print job.
- description: Description of the print job.
- component: Used for simple slicing of a single component. If multiple components are used, use workspaces instead.
- workspaces: List of workspaces to be sliced.
- printer: Printer object containing printer settings.
- resin: ResinType object containing resin formulation.
- special_print_techniques: List of SpecialPrintTechniques to apply.
- minimize_file: Whether to minimize the output file size.
- zip_output: Whether to output as a zip file.
run
run(overwrite=False, save_temp_files=False) -> bool
Generate a print file based on the provided component and settings. This function will create a temporary directory, slice the component's components, generate secondary and membrane images, create a JSON file with the print data, and create a print job zip or directory.
Parameters:
- overwrite (bool): If True, existing output files will be overwritten. If False, the function will check for existing output and return False if it exists.
- save_temp_files (bool): If True, the temporary files will be saved for debugging purposes.