Skip to main content

Preferences Operations

Application Basics 📥 Download Script

Application Preferences Operations Tutorial.

This tutorial demonstrates how to read and update application preferences through the scripting API.

Topics covered:

  • Reading the current preference values
  • Updating preferences from multiple tabs
  • Modifying CAD import defaults as a grouped options object
  • Restoring the original preference values after the example completes
Prerequisites
  • Volvicon application must be running
  • A valid license must be active

User Interface and General Preferences​

# Set UI and general preferences to new values.
preferences_operations.set_show_splash_screen(False)
preferences_operations.set_application_font_size(api.ApplicationFontSize.Medium)
preferences_operations.set_maximum_undos(25)
preferences_operations.set_undo_storage_location(api.UndoStorageLocation.Disk)
preferences_operations.set_project_file_compression_level(api.ProjectFileCompressionLevel.Balanced)

Rendering and View Preferences​

# Set rendering and view preferences to new values.
preferences_operations.set_zoom_to_cursor_position(True)
# Keep the current camera when new objects are added instead of reframing the scene each time.
preferences_operations.set_reset_camera_when_object_is_added(False)
preferences_operations.set_keep_only_whole_cells_when_clipping(True)
preferences_operations.set_3d_clipping_outline_color([0.10, 0.45, 0.80])
preferences_operations.set_enable_mask_outline_cache(False)

# Choose how each label's surface is extracted when building a multilabel mask 3D preview.
# This setting applies only when accurate surface detection is turned off:
# - SmoothClosedLabels creates complete smooth boundaries for every label.
# - VoxelizedConforming keeps unsmoothed neighboring boundaries aligned where possible.
# - SmoothSharedInterfaces keeps one internal interface copy; separated labels may be open.
preferences_operations.set_use_accurate_surface_detection_for_each_label_in_the_multilabel_mask(False)
preferences_operations.set_surface_extraction_algorithm_for_each_label_in_the_multilabel_mask(
api.SurfaceExtractionAlgorithm.SmoothClosedLabels
)

Import Preferences​

# Set import preferences to new values.
preferences_operations.set_spacing_comparison_decimal_places(4)
preferences_operations.set_origin_comparison_decimal_places(6)
preferences_operations.set_allow_import_of_images_with_mismatched_geometry(True)
preferences_operations.set_resample_mismatched_images_to_match_the_projects_active_volume(True)
preferences_operations.set_volume_interpolation_method_for_mismatched_images(api.ImageInterpolationMethod.Cubic)
preferences_operations.set_mask_interpolation_method_for_mismatched_images(api.ImageInterpolationMethod.Nearest)
preferences_operations.set_import_multi_part_files_as_single_surface_object(True)

cad_import_options : api.CadFileImportOptions = preferences_operations.get_cad_file_import_options()
cad_import_options.auto_deflections = False
cad_import_options.linear_deflection = 0.01
cad_import_options.angular_deflection = 0.4
cad_import_options.build_solid = True
preferences_operations.set_cad_file_import_options(cad_import_options)

updated_user_interface : api.UserInterfaceOptions = preferences_operations.get_user_interface_options()
updated_general : api.GeneralOptions = preferences_operations.get_general_options()
updated_rendering : api.RenderingOptions = preferences_operations.get_rendering_options()
updated_import : api.ImportOptions = preferences_operations.get_import_options()

print("Updated application preferences:")
print(f" Show splash screen: {updated_user_interface.show_splash_screen}")
print(f" Application font size: {updated_user_interface.application_font_size}")
print(f" Maximum undos: {updated_general.maximum_undos}")
print(f" Undo storage: {updated_general.undo_storage_location}")
print(f" Zoom to cursor position: {updated_rendering.zoom_to_cursor_position}")
print(f" Reset camera when a new object is added: {updated_rendering.reset_camera_when_object_is_added}")
print(f" Import multipart files as a single object: {updated_import.import_multi_part_files_as_single_surface_object}")

finally:
restore_preferences()
print("Original application preferences restored.")