print_graphics_to_file#
- dlubal.api.rsection.Application.print_graphics_to_file(self, *, filepath, graphic_export_attributes=None, color_mode=None, frame_type=None, include_color_scale=None, graphic_pictures_mode=None, color_scale_settings=None, graphic_border_settings=None, compress_stretch_settings=None, color_of_rendered_objects_enable=None, display_factors_enable=None, text_size_factor=None, symbol_size_factor=None, to_scale_ratio=None, color_of_rendered_objects_position=None, color_rendering_mode=None, model_id=None)#
Exports the current graphics view to an image file. Supported graphic_export_attributes types: PrintToImageFileAttributes
- Parameters:
filepath (str) – Path to the output file.
graphic_export_attributes (google.protobuf.Any | None) – Export attributes specifying the output format and format-specific parameters. Supported types: PrintToImageFileAttributes
color_mode (GraphicColorMode | None) – Color mode of the exported graphics.
frame_type (GraphicFrameType | None) – Frame and title block type.
include_color_scale (bool | None) – Whether to include the color scale in the exported graphics.
graphic_pictures_mode (GraphicPicturesMode | None) – Graphics rendering mode. Default: AS_SCREEN_VIEW.
color_scale_settings (GraphicColorScaleSettings | None) – Color scale position and size settings. Applied only when include_color_scale is true.
graphic_border_settings (GraphicBorderSettings | None) – Graphic border settings.
compress_stretch_settings (GraphicCompressStretchSettings | None) – Compress or stretch model along global axes.
color_of_rendered_objects_enable (bool | None) – Whether to show the “Color of Rendered Objects” overlay. Requires color_rendering_mode to be set to a value other than GRAPHIC_COLOR_RENDERING_MODE_UNSPECIFIED.
display_factors_enable (bool | None) – Whether to apply display factors from the current display settings.
text_size_factor (float | None) – Text size scale factor relative to the default size.
symbol_size_factor (float | None) – Symbol size scale factor relative to the default size.
to_scale_ratio (int | None) – Scale denominator for TO_SCALE mode (e.g. 100 means 1:100). Default: 100.
color_of_rendered_objects_position (GraphicCornerPosition | None) – Position of the “Color of Rendered Objects” panel. Applied only when color_of_rendered_objects_enable is true.
color_rendering_mode (GraphicColorRenderingMode | None) – Color rendering mode to apply to the view during export. Required when color_of_rendered_objects_enable is true.
model_id (ModelId | None) – Unique identifier of the model. If not specified, the active model is used.
Method Type: Core
Usage
# Export the graphics view with default settings (PNG, medium quality)
rsection_app.print_graphics_to_file(
filepath=os.path.abspath('./view.png'),
graphic_export_attributes=rsection.graphic_export.PrintToImageFileAttributes()
)
# Export in high quality
rsection_app.print_graphics_to_file(
filepath=os.path.abspath('./view_high.png'),
graphic_export_attributes=rsection.graphic_export.PrintToImageFileAttributes(
picture_quality=rsection.graphic_export.GRAPHIC_PICTURE_QUALITY_HIGH,
)
)
# Export a user-defined picture size: A4 landscape at 2000 px
rsection_app.print_graphics_to_file(
filepath=os.path.abspath('./view_a4.png'),
graphic_export_attributes=rsection.graphic_export.PrintToImageFileAttributes(
picture_quality=rsection.graphic_export.GRAPHIC_PICTURE_QUALITY_USER_DEFINED,
physical_width=0.297,
physical_height=0.210,
pixel_size=2000,
)
)
# Export a grayscale, framed picture filling the whole picture area
rsection_app.print_graphics_to_file(
filepath=os.path.abspath('./view_grayscale.png'),
graphic_export_attributes=rsection.graphic_export.PrintToImageFileAttributes(),
color_mode=rsection.graphic_export.GRAPHIC_COLOR_MODE_GRAYSCALE,
frame_type=rsection.graphic_export.GRAPHIC_FRAME_TYPE_FRAMED,
graphic_pictures_mode=rsection.graphic_export.GRAPHIC_PICTURES_MODE_WINDOW_FILLING,
)
// Export the graphics view with default settings (PNG, medium quality)
rsectionApp.print_graphics_to_file(
filepath: Path.GetFullPath("./view.png"),
graphicExportAttributes: Any.Pack(new PrintToImageFileAttributes())
);
// Export in high quality
rsectionApp.print_graphics_to_file(
filepath: Path.GetFullPath("./view_high.png"),
graphicExportAttributes: Any.Pack(new PrintToImageFileAttributes
{
PictureQuality = GraphicPictureQuality.High,
})
);
// Export a user-defined picture size: A4 landscape at 2000 px
rsectionApp.print_graphics_to_file(
filepath: Path.GetFullPath("./view_a4.png"),
graphicExportAttributes: Any.Pack(new PrintToImageFileAttributes
{
PictureQuality = GraphicPictureQuality.UserDefined,
PhysicalWidth = 0.297,
PhysicalHeight = 0.210,
PixelSize = 2000,
})
);
// Export a grayscale, framed picture filling the whole picture area
rsectionApp.print_graphics_to_file(
filepath: Path.GetFullPath("./view_grayscale.png"),
graphicExportAttributes: Any.Pack(new PrintToImageFileAttributes()),
colorMode: GraphicColorMode.Grayscale,
frameType: GraphicFrameType.Framed,
graphicPicturesMode: GraphicPicturesMode.WindowFilling
);
Note
The file path is resolved by the RSECTION process, not by the client script. Always pass an absolute path.
Tip
Only PrintToImageFileAttributes is supported as graphic_export_attributes.
The image format is taken from the file extension: PNG, JPEG, BMP and TIFF are
supported.
Unlike RFEM and RSTAB, the RSECTION request has no overview_image_settings
field.