Skip to main content
Ctrl+K
Dlubal API  documentation - Home Dlubal API  documentation - Home
  • Getting Started
  • API Reference
  • Examples
  • Releases
  • Getting Started
  • API Reference
  • Examples
  • Releases

Section Navigation

  • RFEM 6
    • Application
      • calculate_all
      • calculate_specific
      • close_all_models
      • close_application
      • close_connection
      • close_model
      • convert_objects
      • create_model
      • create_object
      • create_object_list
      • create_printout_report
      • delete_all_objects
      • delete_mesh
      • delete_object
      • delete_object_list
      • export_printout_report_to
      • export_to
      • generate_combinations
      • generate_mesh
      • get_active_model
      • get_application_info
      • get_base_data
      • get_conversion_tables
      • get_design_settings
      • get_mesh_settings
      • get_mesh_statistics
      • get_mesh_table
      • get_model_list
      • get_model_main_parameters
      • get_object
      • get_object_id_list
      • get_object_list
      • get_object_table
      • get_objects_to_design
      • get_objects_to_exclude
      • get_printout_report_info_list
      • get_result_contour
      • get_result_table
      • get_results
      • get_subscription_info
      • has_results
      • import_from
      • mirror_objects
      • move_objects
      • open_model
      • plausibility_check
      • print_graphics_to_file
      • rotate_objects
      • save_model
      • select_objects
      • set_active_model
      • set_base_data
      • set_conversion_tables
      • set_design_settings
      • set_mesh_settings
      • set_object_table
      • set_objects_to_design
      • set_objects_to_exclude
      • update_object
      • update_object_list
    • Model
    • BaseData
  • RSTAB 9
  • RSECTION 1
  • GeoZone Tool
  • Common
  • API Reference
  • RFEM 6
  • Application
  • print_graphics_to_file

print_graphics_to_file#

dlubal.api.rfem.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, overview_image_settings=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.

  • overview_image_settings (GraphicOverviewImageSettings | None) – Overview image settings. Renders a small thumbnail of the full model in a corner of the exported image.

  • 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)
rfem_app.print_graphics_to_file(
    filepath=os.path.abspath('./view.png'),
    graphic_export_attributes=rfem.graphic_export.PrintToImageFileAttributes()
)

# Export in high quality
rfem_app.print_graphics_to_file(
    filepath=os.path.abspath('./view_high.png'),
    graphic_export_attributes=rfem.graphic_export.PrintToImageFileAttributes(
        picture_quality=rfem.graphic_export.GRAPHIC_PICTURE_QUALITY_HIGH,
    )
)

# Export a user-defined picture size: A4 landscape at 2000 px
rfem_app.print_graphics_to_file(
    filepath=os.path.abspath('./view_a4.png'),
    graphic_export_attributes=rfem.graphic_export.PrintToImageFileAttributes(
        picture_quality=rfem.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
rfem_app.print_graphics_to_file(
    filepath=os.path.abspath('./view_grayscale.png'),
    graphic_export_attributes=rfem.graphic_export.PrintToImageFileAttributes(),
    color_mode=rfem.graphic_export.GRAPHIC_COLOR_MODE_GRAYSCALE,
    frame_type=rfem.graphic_export.GRAPHIC_FRAME_TYPE_FRAMED,
    graphic_pictures_mode=rfem.graphic_export.GRAPHIC_PICTURES_MODE_WINDOW_FILLING,
)
// Export the graphics view with default settings (PNG, medium quality)
rfemApp.print_graphics_to_file(
    filepath: Path.GetFullPath("./view.png"),
    graphicExportAttributes: Any.Pack(new PrintToImageFileAttributes())
);

// Export in high quality
rfemApp.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
rfemApp.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
rfemApp.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 RFEM 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.

Example: Import/Export - Print Graphics to File

previous

plausibility_check

next

rotate_objects

On this page
  • print_graphics_to_file()

© Copyright 2001-2026 Dlubal Software GmbH | All rights reserved.