Skip to main content

Mechanical scripting interface

Project

Last update: 14.01.2025

class Ansys.ACT.Automation.Mechanical.Project

Bases: object

Defines a Project.

Overview

Methods

Name Description
Activate Activate the current object.
AddComment Creates a new child Comment.
AddImage Creates a new child Image.
Archive For Mechanical opened independently, without Workbench. Archive a Mechanical project.
ClearGeneratedData Run the ClearGeneratedData action.
CombineTextFiles Combines two text(.txt / .dmig / .inp / .dat) files. The secondary file will be appened to the primary file
CopyTo Copies all visible properties from this object to another.
CreateParameter Creates a new parameter for a Property.
Duplicate Creates a copy of the current DataModelObject.
GetChildren Gets the list of children, filtered by type.
GetParameter Gets the parameter corresponding to the given property.
GroupAllSimilarChildren Run the GroupAllSimilarChildren action.
GroupSimilarObjects Run the GroupSimilarObjects action.
New For Mechanical opened independently, without Workbench. Start a new Mechanical project.
Open For Mechanical opened independently, without Workbench. Open an existing Mechanical project.
PropertyByAPIName Get a property by its API name.
PropertyByName Get a property by its unique name.
RemoveParameter Removes the parameter from the parameter set corresponding to the given property.
Save For Mechanical opened independently, without Workbench. Save current Mechanical project.
SaveAs For Mechanical opened independently, without Workbench. Save current Mechanical project to given filePath.
SpecifyMetricTemperatureInCelsius Specify the use of Celsius thermal units for metric unit systems.
SpecifyMetricTemperatureInKelvin Specify the use of Kelvin thermal units for metric unit systems.
Unarchive For Mechanical opened independently, without Workbench. Unarchive a Mechanical project and open it.

Properties

Name Description
Author Gets or sets the Author.
Children Gets the list of children.
Comments Gets the list of associated comments.
CreationDate Gets the CreationDate.
CreationTime Gets the CreationTime.
DataModelObjectCategory Gets the current DataModelObject’s category.
FilePath Gets the Mechanical Project file path of current Mechanical session.
FirstSaved Gets the FirstSaved.
Images Gets the list of associated images.
ImportedSource Gets the ImportedSource.
ImportedVersion Gets the ImportedVersion.
InternalObject Gets the internal object. For advanced usage only.
LastSaved Gets the LastSaved.
Model Gets the Model.
Models Gets the Model.
PreparedFor Gets or sets the PreparedFor.
ProductVersion Gets the ProductVersion.
ProjectDirectory Gets the Project Directory
Properties Gets the list of properties for this object.
SaveProjectAfterSolution Gets or sets the SaveProjectAfterSolution.
SaveProjectBeforeSolution Gets or sets the SaveProjectBeforeSolution.
Subject Gets or sets the Subject.
UnitSystem Change the Unit System.
UserFiles Gets the path of the user files folder of current project.
VisibleProperties Gets the list of properties that are visible for this object.

Property detail

property Project.Author : str | None

Gets or sets the Author.

property Project.Children : List[Ansys.Mechanical.DataModel.Interfaces.IDataModelObject] | None

Gets the list of children.

property Project.Comments : Iterable[Ansys.ACT.Automation.Mechanical.Comment] | None

Gets the list of associated comments.

property Project.CreationDate : str | None

Gets the CreationDate.

property Project.CreationTime : str | None

Gets the CreationTime.

property Project.DataModelObjectCategory : Ansys.Mechanical.DataModel.Enums.DataModelObjectCategory | None

Gets the current DataModelObject’s category.

property Project.FilePath : str | None

Gets the Mechanical Project file path of current Mechanical session.

property Project.FirstSaved : str | None

Gets the FirstSaved.

property Project.Images : Iterable[Ansys.ACT.Automation.Mechanical.Image] | None

Gets the list of associated images.

property Project.ImportedSource : str | None

Gets the ImportedSource.

property Project.ImportedVersion : str | None

Gets the ImportedVersion.

property Project.InternalObject : Ansys.Common.Interop.DSObjectsAuto.IDSProjectAuto | None

Gets the internal object. For advanced usage only.

property Project.LastSaved : str | None

Gets the LastSaved.

property Project.Model : Ansys.ACT.Automation.Mechanical.Model | None

Gets the Model.

property Project.Models : Iterable[Ansys.ACT.Automation.Mechanical.Model] | None

Gets the Model.

property Project.PreparedFor : str | None

Gets or sets the PreparedFor.

property Project.ProductVersion : str | None

Gets the ProductVersion.

property Project.ProjectDirectory : str | None

Gets the Project Directory

property Project.Properties : tuple[Ansys.ACT.Automation.Mechanical.Property] | None

Gets the list of properties for this object.

property Project.SaveProjectAfterSolution : bool | None

Gets or sets the SaveProjectAfterSolution.

property Project.SaveProjectBeforeSolution : bool | None

Gets or sets the SaveProjectBeforeSolution.

property Project.Subject : str | None

Gets or sets the Subject.

property Project.UnitSystem : Ansys.Mechanical.DataModel.Enums.UserUnitSystemType | None

Change the Unit System.

property Project.UserFiles : str | None

Gets the path of the user files folder of current project.

property Project.VisibleProperties : tuple[Ansys.ACT.Automation.Mechanical.Property] | None

Gets the list of properties that are visible for this object.

Method detail

Project.Activate()

Activate the current object.

Project.AddComment()

Creates a new child Comment.

Project.AddImage(filePath: str)

Creates a new child Image.
If a filePath is provided, the image will be loaded from that file,
if not, the image will be a screen capture of the Geometry window.

Project.Archive(archivePath: str, overwrite: bool, settings: Ansys.ACT.Automation.Mechanical.ArchiveSettings)

For Mechanical opened independently, without Workbench. Archive a Mechanical project.

Project.ClearGeneratedData()

Run the ClearGeneratedData action.

Project.CombineTextFiles(PrimaryFileName: str, SecondaryFileName: str)

Combines two text(.txt / .dmig / .inp / .dat) files. The secondary file will be appened to the primary file

Project.CopyTo(other: Ansys.ACT.Automation.Mechanical.DataModelObject)

Copies all visible properties from this object to another.

Project.CreateParameter(propName: str)

Creates a new parameter for a Property.

Project.Duplicate()

Creates a copy of the current DataModelObject.

Project.GetChildren(recurses: bool, children: List[ChildrenType])

Gets the list of children, filtered by type.

Project.GetParameter(propName: str)

Gets the parameter corresponding to the given property.

Project.GroupAllSimilarChildren()

Run the GroupAllSimilarChildren action.

Project.GroupSimilarObjects()

Run the GroupSimilarObjects action.

Project.New()

For Mechanical opened independently, without Workbench. Start a new Mechanical project.

Project.Open(filePath: str)

For Mechanical opened independently, without Workbench. Open an existing Mechanical project.

Project.PropertyByAPIName(name: str)

Get a property by its API name.
If multiple properties have the same API Name, only the first property with that name will be returned.

Project.PropertyByName(name: str)

Get a property by its unique name.

Project.RemoveParameter(propName: str)

Removes the parameter from the parameter set corresponding to the given property.

Project.Save()

For Mechanical opened independently, without Workbench. Save current Mechanical project.

Project.SaveAs(filePath: str, overwrite: bool)

For Mechanical opened independently, without Workbench. Save current Mechanical project to given filePath.

Project.SpecifyMetricTemperatureInCelsius()

Specify the use of Celsius thermal units for metric unit systems.

Project.SpecifyMetricTemperatureInKelvin()

Specify the use of Kelvin thermal units for metric unit systems.

Project.Unarchive(archivePath: str, projectPath: str, overwrite: bool)

For Mechanical opened independently, without Workbench. Unarchive a Mechanical project and open it.
If projectPath is provided, the project will be unarchived to this given projectPath.
If projectPath is not provided or is null or empty, the project will be unarchived to a temporary folder.
Returns a path to the unarchived project database file.