Manage projects#

The SysML2ProjectManager class provides methods for managing projects on the server: listing, creating, updating, and deleting them.

To use these methods, you need an instance of the SysML2ProjectManager (see Use a connector).

List projects#

Retrieve all projects accessible to the connected user:

projects = project_manager.get_projects()
for p in projects:
    print(f"{p['name']} (id: {p['@id']})")

Create a project#

Create a new project on the server. The project is automatically built and returned as a Python object, ready to use.

Two methods are available depending on the approach. Both accept the same optional load flags as get_scripting_project() and get_sysml_project():

  • resolve_standard_libraries (default False): resolve and map standard library element contents.

  • includes_derived (default True): include derived properties from the API.

  • includes_inherited (default True): include inherited memberships and features.

When includes_derived is False, PySAM rebuilds the local derived collections from ownedRelationship (and from inheritedMembership when present), for example ownedElement, ownedFeature, feature, and requirement text from each documentation.body.

project = project_manager.create_scripting_project(
    name="My New Project",
    description="A project created via PySAM SysML2",
    resolve_standard_libraries=False,
    includes_derived=True,
    includes_inherited=True,
)
project = project_manager.create_sysml_project(
    name="My New Project",
    description="A project created via PySAM SysML2",
    resolve_standard_libraries=False,
    includes_derived=True,
    includes_inherited=True,
)

Both methods create the project on the server and return a fully loaded project object, similar to calling get_scripting_project() or get_sysml_project() on an existing project.

Update a project#

Rename a project or change its description:

updated = project_manager.update_project(
    project_id="<Project ID>",
    name="My Renamed Project",
    description="Updated description",
)

Both name and description parameters are optional. Only the provided fields are updated.

Delete a project#

Delete a project from the server:

deleted = project_manager.delete_project(project_id="<Project ID>")

Warning

Deleting a project is irreversible. All data associated with the project is permanently removed.

Previous step

Dynamic vs static approaches

Dynamic versus static approaches
Next step

Load a model

Load a model