RAProject#

class ansys.rocky.app.ra_project.RAProject#

Bases: ansys.rocky.app.api_element_item.ApiElementItem

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)

Overview#

GetWrappedClass

GetClassName

GetModelStudy

Get the study model associated with a given model item

CloseProject

Close the current project.

SaveProject

Save the currently opened project.

SaveProjectForRestart

Create a new restart project from the current project.

GetProjectFilename

Get the current project’s filename.

HasUnsavedChanges

Check if the current project has unsaved changes.

CreateStudy

Creates a new study and returns its wrapper

GetStudyNames

GetStudy

Get the project’s Study.

GetModelElement

Get the model element associated with the given ID

GetUserProcessCollection

Get the project’s collection of User Processes.

GetUserProcess

GetTimeFilter

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

GetParametricVariables

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

GetInputVariables

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

RemoveProcess

Removes the given process from the project.

GetElementNames

GetElement

Import detail#

from ansys.rocky.app.ra_project import RAProject

Method detail#

RAProject.CloseProject(check_save_state: bool = True) None#

Close the current project.

Parameters:

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

RAProject.SaveProject(filename: str | None = 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

RAProject.SaveProjectForRestart(filename: str, timestep_or_index: RATimeOrIndex | None = 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.

RAProject.GetProjectFilename() str#

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.

RAProject.HasUnsavedChanges() bool#

Check if the current project has unsaved changes.

Returns:

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

classmethod RAProject.GetWrappedClass() type[petroapp10.plugins.entities.petroapp10_project.Petroapp10Project]#
classmethod RAProject.GetClassName() str#
RAProject.CreateStudy(study_name: str | None = None) ansys.rocky.app.ra_study.RAStudy#

Creates a new study and returns its wrapper

Parameters:

study_name – The name of the study

RAProject.GetStudyNames() list[str]#
RAProject.GetStudy(study_name: str | None = None) ansys.rocky.app.ra_study.RAStudy | None#

Get the project’s Study.

Parameters:

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

classmethod RAProject.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

RAProject.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

RAProject.GetUserProcessCollection() ansys.rocky.app.ra_user_process_collection.RAUserProcessCollection | None#

Get the project’s collection of User Processes.

RAProject.GetUserProcess(process_name)#
RAProject.GetTimeFilter() ansys.rocky.app.ra_time_filter.RATimeFilter | None#

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

RAProject.GetParametricVariables() ansys.rocky.app.ra_parametric_variables.RAParametricVariables#

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

RAProject.GetInputVariables() ansys.rocky.app.ra_input_variables.RAInputVariables#

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

RAProject.RemoveProcess(process: ansys.rocky.app.ra_grid_process_element.RAGridProcessElementItem | str) None#

Removes the given process from the project.

Parameters:

process – a process or process name

RAProject.GetElementNames(type_name=None)#
RAProject.GetElement(element_name=None, type_name=None, raise_if_no_found: bool = True)#