Skip to main content

Rocky PrePost scripting 2026 R1

RAProject

Last update: 23.02.2026

class RAProject

Rocky PrePost Scripting wrapper for a project.

The RAProject class serves as the main access point for a project’s RAStudy and the project entities that aren’t directly related to a simulation’s configuration, such as the time filter, the collection of user processes, etc.

The RAProject can be obtained directly via the app global object. Example usage:

project = app.CreateProject()
study = project.GetStudy()
user_processes = project.GetUserProcessCollection()
input_variables = project.GetInputVariables()

project.SaveProject('my_project.rocky')
project.SaveProjectForRestart('my_restart_project.rocky', timestep_or_index=10)

Methods:

Name Description
CloseProject([check_save_state]) Close the current project.
CreateStudy([study_name]) Creates a new study and returns its wrapper
GetInputVariables() Get the PrePost Scripting wrapper for the project's Input Variables.
GetModelElement(model_element_id) Get the model element associated with the given ID
GetModelStudy(model_item) Get the study model associated with a given model item
GetParametricVariables() Get the PrePost Scripting wrapper for the project's Parametric Variables.
GetProjectFilename() Get the current project's filename.
GetStudy([study_name]) Get the project's Study.
GetTimeFilter() Utility function to return the api object representing the project's time filter
GetUserProcessCollection() Get the project's collection of User Processes.
HasUnsavedChanges() Check if the current project has unsaved changes.
RemoveProcess(process) Removes the given process from the project.
SaveProject([filename]) Save the currently opened project.
SaveProjectForRestart(filename[, ...]) Create a new restart project from the current project.

CloseProject(check_save_state: bool = True)

Close the current project.

  • Parameters: check_save_state – If False, it will close without asking the user to save it first.

CreateStudy(study_name: str | None = None)

Creates a new study and returns its wrapper

  • Parameters: study_name – The name of the study

GetInputVariables()

Get the PrePost Scripting wrapper for the project’s Input Variables.

GetModelElement(model_element_id)

Get the model element associated with the given ID

  • Parameters: model_element_id (unicode) – The element id

@return : The wrapped object with the given ID

classmethod GetModelStudy(model_item)

Get the study model associated with a given model item

  • Parameters: model_item (Subject) – A study child

@return RAStudy or None if no study was found for the given element

GetParametricVariables()

Get the PrePost Scripting wrapper for the project’s Parametric Variables.

GetProjectFilename()

Get the current project’s filename.

  • Returns: The current project’s file name, or None if there is no current project or if the project hasn’t been saved yet.

GetStudy(study_name: str | None = None)

Get the project’s Study.

  • Parameters: study_name – The name of the study If None is given the first model will be returned

GetTimeFilter()

Utility function to return the api object representing the project’s time filter

GetUserProcessCollection()

Get the project’s collection of User Processes.

HasUnsavedChanges()

Check if the current project has unsaved changes.

  • Returns: True if the project is modified (unsaved changes), False otherwise.

RemoveProcess(process: RAGridProcessElementItem | str)

Removes the given process from the project.

  • Parameters: process – a process or process name

SaveProject(filename: str | None = None)

Save the currently opened project.

  • Parameters: filename – The name of the file to save the project or None if to update the current file

SaveProjectForRestart(filename: str, timestep_or_index: TimeStep | int | None = None)

Create a new restart project from the current project.

  • Parameters:
    • filename – The new filename to be saved.
    • timestep_or_index – Either the index of the timestep, or the timestep itself, in which to create the restart project. If None is passed, the application’s current timestep will be used.

Connect with Ansys