AnsysProject#

class ansys.sam.sysml2.tools.ansys_project.AnsysProject(server_url: str, token: str, organization_id: str, project_id: str, use_ssl: bool = True)#

Complete Ansys SysML2 project implementation with integrated capabilities.

Overview#

download_diagram

Download a single diagram and save it to disk.

download_all_diagrams

Download all diagrams as a ZIP archive.

is_diagrams_available

Check if diagram functionality is available for this project.

get_project_diagrams_info

Get information about available diagrams in the project.

get_single_diagram_info

Get information about a diagram in the project.

factory

Getter property for factory.

Import detail#

from ansys.sam.sysml2.tools.ansys_project import AnsysProject

Property detail#

property AnsysProject.factory: ansys.sam.sysml2.tools.factory.Factory#

Getter property for factory.

Method detail#

AnsysProject.download_diagram(diagram_id: str, path: str | pathlib.Path, file_format: str = 'svg', filename: str = '') str#

Download a single diagram and save it to disk.

Parameters:
diagram_idstr

The diagram id to download.

pathstr or Path

Destination file or directory.

file_formatstr

Format of the diagram (e.g., ‘svg’, ‘png’, ‘jpeg’).

filenamestr, optional

Name of the file. Default is diagram ID.

Returns:
str

Return the path of the file created.

Raises:
DiagramNotAvailableException

If diagram functionality is not available for this project.

DiagramConnectorException

If the download fails or HTTP response is not 200.

AnsysProject.download_all_diagrams(path: str | pathlib.Path, file_format: str = 'svg', filename: str = '') str#

Download all diagrams as a ZIP archive.

Parameters:
pathstr or Path

Destination directory or file path for the ZIP file.

file_formatstr, optional

Format of the diagrams (e.g., ‘png’, ‘jpeg’, ‘svg’). Default is “svg”.

filenamestr, optional

Name of the file. Default is “{Project Name}_{Image Extension}_diagrams.zip”.

Returns:
str

Path to the saved ZIP file.

Raises:
DiagramNotAvailableException

If diagram functionality is not available for this project.

DiagramConnectorException

If the download fails or HTTP response is not 200.

AnsysProject.is_diagrams_available() bool#

Check if diagram functionality is available for this project.

Returns:
bool

True if diagrams can be downloaded, False otherwise.

AnsysProject.get_project_diagrams_info() dict#

Get information about available diagrams in the project.

Returns:
dict

Dictionary containing diagram information.

Raises:
DiagramNotAvailableException

If diagram functionality is not available for this project.

AnsysProject.get_single_diagram_info(diagram_id: str) dict#

Get information about a diagram in the project.

Parameters:
diagram_id: str

ID of the diagram we want info about.

Returns:
dict

Dictionary containing diagram information.

Raises:
DiagramNotAvailableException

If diagram functionality is not available for this project.