Skip to main content

Mechanical scripting interface 2026 R1

`PythonCodeEventBased`

Last update: 09.03.2026

class Ansys.ACT.Automation.Mechanical.PythonCodeEventBased

Bases: object

Defines a PythonCodeEventBased.

Overview

Methods

Name Description
Activate Activate the current object.
Connect Register the python code.
CopyTo Copies all visible properties from this object to another.
CreateParameter Creates a new parameter for a Property.
Delete Run the Delete action.
Duplicate Creates a copy of the current DataModelObject.
GetParameter Gets the parameter corresponding to the given property.
GroupAllSimilarChildren Run the GroupAllSimilarChildren action.
GroupSimilarObjects Run the GroupSimilarObjects action.
PropertyByAPIName Get a property by its API name.
PropertyByName Get a property by its unique name.
ReloadProperties Reload properties to update properties provided by the provider.
RemoveParameter Removes the parameter from the parameter set corresponding to the given property.
ResetPropertyProviderText Resets the code inside the property provider tab with default property provider text. Any changes made to the property provider text are lost.

Properties

Name Description
AllowRecursion Gets or Sets whether the PythonCode allows recursion.
Connected Gets whether the callbacks are currently connected.
DataModelObjectCategory Gets the current DataModelObject's category.
InternalObject Gets the internal object. For advanced usage only.
InvalidateSolution Gets or sets the InvalidateSolution.
Properties Gets the list of properties for this object.
PropertyProvider Gets or sets the property provider instance associated with this python code object.
PropertyProviderText Gets or sets the text in the property provider tab for the Python Code object.
ScriptEngineType Gets or sets what type of engine used to execute the scripts associated with the Python Code object.
ScriptExecutionScope The scope identifier in which the code execution will take place.
SolverTarget Gets the SolverTarget.
Suppressed Gets or sets the Suppressed.
TargetCallback Gets or sets the TargetCallback.
Text Gets or sets the text in the script tab for the Python Code object.
VisibleProperties Gets the list of properties that are visible for this object.

Property detail

property PythonCodeEventBased.AllowRecursion : bool | None

Gets or Sets whether the PythonCode allows recursion.

property PythonCodeEventBased.Connected : bool | None

Gets whether the callbacks are currently connected.

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

Gets the current DataModelObject's category.

property PythonCodeEventBased.InternalObject : Ansys.Common.Interop.DSObjectsAuto.IDSPythonCodeEventBasedAuto | None

Gets the internal object. For advanced usage only.

property PythonCodeEventBased.InvalidateSolution : bool | None

Gets or sets the InvalidateSolution.

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

Gets the list of properties for this object.

property PythonCodeEventBased.PropertyProvider : Ansys.ACT.Interfaces.Mechanical.IPropertyProvider | None

Gets or sets the property provider instance associated with this python code object.

property PythonCodeEventBased.PropertyProviderText : str | None

Gets or sets the text in the property provider tab for the Python Code object.

property PythonCodeEventBased.ScriptEngineType : Ansys.Mechanical.DataModel.MechanicalEnums.Scripting.EngineType | None

Gets or sets what type of engine used to execute the scripts associated with the Python Code object.

property PythonCodeEventBased.ScriptExecutionScope : str | None

The scope identifier in which the code execution will take place.

property PythonCodeEventBased.SolverTarget : Ansys.Mechanical.DataModel.Enums.CommandEditorTarget | None

Gets the SolverTarget.

property PythonCodeEventBased.Suppressed : bool | None

Gets or sets the Suppressed.

property PythonCodeEventBased.TargetCallback : Ansys.Mechanical.DataModel.Enums.PythonCodeTargetCallback | None

Gets or sets the TargetCallback.

property PythonCodeEventBased.Text : str | None

Gets or sets the text in the script tab for the Python Code object.

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

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

Method detail

PythonCodeEventBased.Activate() → None

Activate the current object.

PythonCodeEventBased.Connect() → None

Register the python code.

PythonCodeEventBased.CopyTo(other: Ansys.ACT.Automation.Mechanical.DataModelObject) → None

Copies all visible properties from this object to another.

PythonCodeEventBased.CreateParameter(propName: str) → Ansys.ACT.Interfaces.Mechanical.IParameter

Creates a new parameter for a Property.

PythonCodeEventBased.Delete() → None

Run the Delete action.

PythonCodeEventBased.Duplicate() → Ansys.Mechanical.DataModel.Interfaces.IDataModelObject

Creates a copy of the current DataModelObject.

PythonCodeEventBased.GetParameter(propName: str) → Ansys.ACT.Interfaces.Mechanical.IParameter

Gets the parameter corresponding to the given property.

PythonCodeEventBased.GroupAllSimilarChildren() → None

Run the GroupAllSimilarChildren action.

PythonCodeEventBased.GroupSimilarObjects() → Ansys.ACT.Automation.Mechanical.TreeGroupingFolder

Run the GroupSimilarObjects action.

PythonCodeEventBased.PropertyByAPIName(name: str) → Ansys.ACT.Automation.Mechanical.Property

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.

PythonCodeEventBased.PropertyByName(name: str) → Ansys.ACT.Automation.Mechanical.Property

Get a property by its unique name.

PythonCodeEventBased.ReloadProperties() → None

Reload properties to update properties provided by the provider.

PythonCodeEventBased.RemoveParameter(propName: str) → None

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

PythonCodeEventBased.ResetPropertyProviderText() → None

Resets the code inside the property provider tab with default property provider text. Any changes made to the property provider text are lost.

Connect with Ansys