Project#

Usage:

Project Class API Wrapper

class Project[source]#

Bases: object

Wrapper for Project class of Moldflow Synergy.

attach(item_name)[source]#

Attach an item to the project.

Parameters:

item_name (str) – The name of the item.

Returns:

True if the item is attached successfully.

Return type:

bool

close(prompts=True)[source]#

Close the current project.

Parameters:

prompts (bool) – Whether to prompt for saving changes.

Returns:

True if the project is closed successfully.

Return type:

bool

close_folder(folder_name)[source]#

Close a folder.

Parameters:

folder_name (str) – The name of the folder.

Returns:

True if the folder is closed successfully.

Return type:

bool

compact()[source]#

Compacts current project by removing redundant restart files.

Returns:

True if the project is compacted successfully.

Return type:

bool

copy_study_settings(from_name, to_name)[source]#

Copy study settings from one study to another.

Parameters:
  • from_name (str) – The name of the source study.

  • to_name (str) – The name of the destination study.

Returns:

True if the settings are copied successfully.

Return type:

bool

delete_item_by_index(index)[source]#

Delete an item by index.

Parameters:

index (int) – The index of the item.

Returns:

True if the item is deleted successfully.

Return type:

bool

delete_item_by_name(item_name, item_type)[source]#

Delete an item by name.

Parameters:
  • item_name (str) – The name of the item.

  • item_type (ItemType | str) – The type of the item.

Returns:

True if the item is deleted successfully.

Return type:

bool

duplicate_study_by_index(item_index, save_study=False, duplicate_option=2)[source]#

Duplicate a study by index.

Parameters:
  • item_index (int) – The index of the study.

  • save_study (bool) – Save the study after duplication.

  • duplicate_option (DuplicateOption | int) – The option for duplication.

Returns:

True if the study is duplicated successfully.

Return type:

bool

duplicate_study_by_name(study_name, save_study=False, duplicate_option=2)[source]#

Duplicate a study by name.

Parameters:
  • study_name (str) – The name of the study.

  • save_study (bool) – Save the study after duplication.

  • duplicate_option (DuplicateOption | int) – The option for duplication.

Returns:

True if the study is duplicated successfully.

Return type:

bool

expand_folder(folder_name)[source]#

Expand a folder.

Parameters:

folder_name (str) – The name of the folder.

Returns:

True if the folder is expanded successfully.

Return type:

bool

export(file_name, selected, results, criteria_file='', restrict=False, skip_cad=False)[source]#

Export the project to a file.

Parameters:
  • file_name (str) – The name of the file to export.

  • selected (bool) – Export selected items only or all.

  • results (bool) – Export results too.

  • criteria_file (str) – Export criteria file. - Deprecated value is ignored

  • restrict (bool) – Restrict export based on criteria contents. - Deprecated value is ignored

  • skip_cad (bool) – Skip CAD Data.

Returns:

True if the project is exported successfully.

Return type:

bool

export_model(file_name, unit_index=None)[source]#

Export the model to a file.

Parameters:
  • file_name (str) – The name of the file to export.

  • unit_index (optional) – The unit index for the export.

Returns:

True if the model is exported successfully.

Return type:

bool

get_first_folder_name()[source]#

Get the first folder name.

Returns:

The name of the first folder.

Return type:

str

get_first_report_name()[source]#

Get the first report name.

Returns:

The name of the first report.

Return type:

str

get_first_study_name()[source]#

Get the first study name.

Returns:

The name of the first study.

Return type:

str

get_item_name_by_index(index)[source]#

Get the item name by index.[1-based indexing]

Parameters:

index (int) – The index of the item.

Returns:

The name of the item.

Return type:

str

get_next_folder_name(folder_name)[source]#

Get the next folder name.

Parameters:

folder_name (str) – The name of the folder.

Returns:

The name of the next folder.

Return type:

str

get_next_report_name(report_name)[source]#

Get the next report name.

Parameters:

report_name (str) – The name of the report.

Returns:

The name of the next report.

Return type:

str

get_next_study_name(study_name)[source]#

Get the next study name.

Parameters:

study_name (str) – The name of the study.

Returns:

The name of the next study.

Return type:

str

get_number_of_items()[source]#

Get the number of items in the project.

Returns:

The number of items.

Return type:

int

is_open(study_name)[source]#

Check if a study is open.

Parameters:

study_name (str) – The name of the study.

Returns:

True if the study is open.

Return type:

bool

move_item_to_folder(item_name, item_type, folder_name)[source]#

Move an item to a folder.

Parameters:
  • item_name (str) – The name of the item.

  • item_type (ItemType | str) – The type of the item.

  • folder_name (str) – The name of the folder.

Returns:

True if the item is moved successfully.

Return type:

bool

property name: str#

The name of the project.

Getter:

Get the name of the project.

Type:

str

new_folder(folder_name)[source]#

Create a new folder in the project.

Parameters:

folder_name (str) – The name of the folder.

Returns:

True if the folder is created successfully.

Return type:

bool

new_study(study_name)[source]#

Create a new study in the project.

Parameters:

study_name (str) – The name of the study.

Returns:

True if the study is created successfully.

Return type:

bool

open_item_by_index(item_index)[source]#

Open an item by index. [1-based indexing]

Parameters:

item_index (int) – The index of the item.

Returns:

True if the item is opened successfully.

Return type:

bool

open_item_by_name(item_name, item_type)[source]#

Open an item by name.

Parameters:
  • item_name (str) – The name of the item.

  • item_type (ItemType | str) – The type of the item.

Returns:

True if the item is opened successfully.

Return type:

bool

property path: str#

The path of the project.

Getter:

Get the path of the project.

Type:

str

rename_item_by_index(index, new_name)[source]#

Rename an item by index.

Parameters:
  • index (int) – The index of the item.

  • new_name (str) – The new name of the item.

Returns:

True if the item is renamed successfully.

Return type:

bool

rename_item_by_name(old_name, item_type, new_name)[source]#

Rename an item by name.

Parameters:
  • old_name (str) – The old name of the item.

  • item_type (ItemType | str) – The type of the item.

  • new_name (str) – The new name of the item.

Returns:

True if the item is renamed successfully.

Return type:

bool

save_all()[source]#

Save all open documents.

Returns:

True if the project is saved successfully.

Return type:

bool

select_folder(folder_name)[source]#

Select a folder.

Parameters:

folder_name (str) – The name of the folder.

Returns:

True if the folder is selected successfully.

Return type:

bool