SysML2ProjectManager#

class ansys.sam.sysml2.builder.sysml2_project_manager.SysML2ProjectManager(connector: ansys.sam.sysml2.api.sysml2_api_connector.SysML2APIConnector)#

Provides the director class for loading and managing projects.

Overview#

get_projects

Get all projects of the connected user.

get_sysml_project

Get a SysML project with its ID from the API and map it in a Python object.

get_scripting_project

Get a scripting project with its ID from the API and map it in a Python object.

create_sysml_project

Create a new project on the server and return it as a SysML Project.

create_scripting_project

Create a new project on the server and return it as a Scripting Project.

delete_project

Delete the project with the given ID.

update_project

Update the project with the given ID.

Import detail#

from ansys.sam.sysml2.builder.sysml2_project_manager import SysML2ProjectManager

Method detail#

SysML2ProjectManager.get_projects() → list[dict]#

Get all projects of the connected user.

Returns:
list of dict

List of all project records.

SysML2ProjectManager.get_sysml_project(project_id: str, resolve_standard_libraries: bool = False, includes_derived: bool = True, includes_inherited: bool = True) → ansys.sam.sysml2.classes.project.Project#

Get a SysML project with its ID from the API and map it in a Python object.

Parameters:
project_idstr

ID of the project to load.

resolve_standard_librariesbool, default: False

When True, library element contents are resolved and mapped so they can be navigated. Only applied on first load; a cached project is returned as-is.

includes_derivedbool, default: True

When True, include derived properties from the API /elements response.

includes_inheritedbool, default: True

When True, include inherited memberships and features from the API response.

Returns:
Project

The requested project, built from the API or returned from cache.

SysML2ProjectManager.get_scripting_project(project_id: str, resolve_standard_libraries: bool = False, includes_derived: bool = True, includes_inherited: bool = True) → ansys.sam.sysml2.classes.project.Project#

Get a scripting project with its ID from the API and map it in a Python object.

Parameters:
project_idstr

ID of the project to load.

resolve_standard_librariesbool, default: False

When True, library element contents are resolved and mapped so they can be navigated. Only applied on first load; a cached project is returned as-is.

includes_derivedbool, default: True

When True, include derived properties from the API /elements response.

includes_inheritedbool, default: True

When True, include inherited memberships and features from the API response.

Returns:
Project

The requested project, built from the API or returned from cache.

SysML2ProjectManager.create_sysml_project(name: str, description: str = 'Project description', resolve_standard_libraries: bool = False, includes_derived: bool = True, includes_inherited: bool = True) → ansys.sam.sysml2.classes.project.Project#

Create a new project on the server and return it as a SysML Project.

Parameters:
namestr

Name of the project.

descriptionstr, default: "Project description"

Description of the project.

resolve_standard_librariesbool, default: False

When True, library element contents are resolved and mapped so they can be navigated.

includes_derivedbool, default: True

When True, include derived properties from the API /elements response.

includes_inheritedbool, default: True

When True, include inherited memberships and features from the API response.

Returns:
Project

The newly created project, fully built from the API.

SysML2ProjectManager.create_scripting_project(name: str, description: str = 'Project description', resolve_standard_libraries: bool = False, includes_derived: bool = True, includes_inherited: bool = True) → ansys.sam.sysml2.classes.project.Project#

Create a new project on the server and return it as a Scripting Project.

Parameters:
namestr

Name of the project.

descriptionstr, default: "Project description"

Description of the project.

resolve_standard_librariesbool, default: False

When True, library element contents are resolved and mapped so they can be navigated.

includes_derivedbool, default: True

When True, include derived properties from the API /elements response.

includes_inheritedbool, default: True

When True, include inherited memberships and features from the API response.

Returns:
Project

The newly created project, fully built from the API.

SysML2ProjectManager.delete_project(project_id: str) → dict#

Delete the project with the given ID.

Parameters:
project_idstr

ID of the project to delete.

Returns:
dict

Confirmation containing @type and @id of the deleted project.

SysML2ProjectManager.update_project(project_id: str, name: str = None, description: str = None) → dict#

Update the project with the given ID.

Parameters:
project_idstr

ID of the project to update.

namestr, optional

New name for the project.

descriptionstr, optional

New description for the project.

Returns:
dict

Updated project record.