pySimBlocks.gui.addons.sofa.sofa_service

class pySimBlocks.gui.addons.sofa.sofa_service.SofaService(project_state: ProjectState, project_controller: ProjectController)[source]

Bases: object

Manage SOFA-specific validation, export, and execution workflows.

project_state

Project state used to resolve blocks and files.

project_controller

Controller used to access current view state.

sofa_path

Path to the runSofa executable.

gui

Selected SOFA GUI backend.

scene_file

Resolved SOFA scene file path.

get_scene_file()[source]

Resolve and cache the scene file used by the SOFA block.

Returns:

Tuple containing success flag, title, and details message.

can_use_sofa()[source]

Check whether the current project can be driven by SOFA.

Returns:

Tuple containing success flag, title, and details message.

export_controller(window, saver)[source]

Export the generated SOFA controller for the current project.

Parameters:
  • window – Main window used for save confirmation.

  • saver – Project saver used to persist the project before export.

Raises:

ValueError – If the project directory is not defined.

run()[source]

Run the configured SOFA scene and collect its execution output.

Returns:

Tuple containing success flag, title, and details message.