    

 ## On this page

  

 

 # `CommandSnippet`

 Last update: 16.07.2025 

<a id="ansys.mechanical.stubs.v241.Ansys.ACT.Automation.Mechanical.CommandSnippet"></a>

#### *class* Ansys.ACT.Automation.Mechanical.CommandSnippet

Bases: [`object`](https://docs.python.org/3/library/functions.html#object)

Defines a CommandSnippet.

<a id="overview"></a>

## Overview

### Methods

NameDescription[`Activate`](#CommandSnippet.Activate)Activate the current object.[`AddComment`](#CommandSnippet.AddComment)Creates a new child Comment.[`AddFigure`](#CommandSnippet.AddFigure)Creates a new child Figure.[`AddImage`](#CommandSnippet.AddImage)Creates a new child Image.[`AppendText`](#CommandSnippet.AppendText)Append Text.[`CopyTo`](#CommandSnippet.CopyTo)Copies all visible properties from this object to another.[`CreateParameter`](#CommandSnippet.CreateParameter)Creates a new parameter for a Property.[`Delete`](#CommandSnippet.Delete)Run the Delete action.[`Duplicate`](#CommandSnippet.Duplicate)Creates a copy of the current DataModelObject.[`ExportTextFile`](#CommandSnippet.ExportTextFile)Export to Textfile.[`GetChildren`](#CommandSnippet.GetChildren)Gets the list of children, filtered by type.[`GetParameter`](#CommandSnippet.GetParameter)Gets the parameter corresponding to the given property.[`GroupAllSimilarChildren`](#CommandSnippet.GroupAllSimilarChildren)Run the GroupAllSimilarChildren action.[`GroupSimilarObjects`](#CommandSnippet.GroupSimilarObjects)Run the GroupSimilarObjects action.[`ImportTextFile`](#CommandSnippet.ImportTextFile)Import from Textfile.[`PropertyByAPIName`](#CommandSnippet.PropertyByAPIName)Get a property by its API name.[`PropertyByName`](#CommandSnippet.PropertyByName)Get a property by its unique name.[`RemoveParameter`](#CommandSnippet.RemoveParameter)Removes the parameter from the parameter set corresponding to the given property.[`RenameBasedOnDefinition`](#CommandSnippet.RenameBasedOnDefinition)Run the RenameBasedOnDefinition action.### Properties

NameDescription[`Children`](#CommandSnippet.Children)Gets the list of children.[`Comments`](#CommandSnippet.Comments)Gets the list of associated comments.[`DataModelObjectCategory`](#CommandSnippet.DataModelObjectCategory)Gets the current DataModelObject’s category.[`Figures`](#CommandSnippet.Figures)Gets the list of associated figures.[`FileName`](#CommandSnippet.FileName)Gets the FileName.[`Images`](#CommandSnippet.Images)Gets the list of associated images.[`Input`](#CommandSnippet.Input)Gets or sets the Text.[`InputArgument1`](#CommandSnippet.InputArgument1)Gets or sets the InputArgument1.[`InputArgument2`](#CommandSnippet.InputArgument2)Gets or sets the InputArgument2.[`InputArgument3`](#CommandSnippet.InputArgument3)Gets or sets the InputArgument3.[`InputArgument4`](#CommandSnippet.InputArgument4)Gets or sets the InputArgument4.[`InputArgument5`](#CommandSnippet.InputArgument5)Gets or sets the InputArgument5.[`InputArgument6`](#CommandSnippet.InputArgument6)Gets or sets the InputArgument6.[`InputArgument7`](#CommandSnippet.InputArgument7)Gets or sets the InputArgument7.[`InputArgument8`](#CommandSnippet.InputArgument8)Gets or sets the InputArgument8.[`InputArgument9`](#CommandSnippet.InputArgument9)Gets or sets the InputArgument9.[`InternalObject`](#CommandSnippet.InternalObject)Gets the internal object. For advanced usage only.[`InvalidateSolution`](#CommandSnippet.InvalidateSolution)Gets or sets the InvalidateSolution.[`IssueSolveCommand`](#CommandSnippet.IssueSolveCommand)Gets or sets the IssueSolveCommand.[`OutputParameters`](#CommandSnippet.OutputParameters)Gets a list of the command snippet’s output parameters.[`OutputSearchPrefix`](#CommandSnippet.OutputSearchPrefix)Gets or sets the OutputSearchPrefix.[`Properties`](#CommandSnippet.Properties)Gets the list of properties for this object.[`ReadOnly`](#CommandSnippet.ReadOnly)Gets or sets the ReadOnly.[`SnippetFileStatus`](#CommandSnippet.SnippetFileStatus)Gets the SnippetFileStatus.[`SolverTarget`](#CommandSnippet.SolverTarget)Gets the SolverTarget.[`StepNumber`](#CommandSnippet.StepNumber)Gets or sets the StepNumber.[`StepSelectionMode`](#CommandSnippet.StepSelectionMode)Gets or sets the StepSelectionMode.[`Suppressed`](#CommandSnippet.Suppressed)Gets or sets the Suppressed.[`VisibleProperties`](#CommandSnippet.VisibleProperties)Gets the list of properties that are visible for this object.<a id="property-detail"></a>

## Property detail

<a id="CommandSnippet.Children"></a>

### *property* CommandSnippet.Children *: List\[Ansys.Mechanical.DataModel.Interfaces.IDataModelObject\] | [None](https://docs.python.org/3/library/constants.html#None)*

Gets the list of children.

<a id="CommandSnippet.Comments"></a>

### *property* CommandSnippet.Comments *: Iterable\[[Ansys.ACT.Automation.Mechanical.Comment](Comment.md#ansys.mechanical.stubs.v241.Ansys.ACT.Automation.Mechanical.Comment)\] | [None](https://docs.python.org/3/library/constants.html#None)*

Gets the list of associated comments.

<a id="CommandSnippet.DataModelObjectCategory"></a>

### *property* CommandSnippet.DataModelObjectCategory *: [Ansys.Mechanical.DataModel.Enums.DataModelObjectCategory](../../../Mechanical/DataModel/Enums/DataModelObjectCategory.md#ansys.mechanical.stubs.v241.Ansys.Mechanical.DataModel.Enums.DataModelObjectCategory) | [None](https://docs.python.org/3/library/constants.html#None)*

Gets the current DataModelObject’s category.

<a id="CommandSnippet.Figures"></a>

### *property* CommandSnippet.Figures *: Iterable\[[Ansys.ACT.Automation.Mechanical.Figure](Figure.md#ansys.mechanical.stubs.v241.Ansys.ACT.Automation.Mechanical.Figure)\] | [None](https://docs.python.org/3/library/constants.html#None)*

Gets the list of associated figures.

<a id="CommandSnippet.FileName"></a>

### *property* CommandSnippet.FileName *: [str](https://docs.python.org/3/library/stdtypes.html#str) | [None](https://docs.python.org/3/library/constants.html#None)*

Gets the FileName.

<a id="CommandSnippet.Images"></a>

### *property* CommandSnippet.Images *: Iterable\[[Ansys.ACT.Automation.Mechanical.Image](Image.md#ansys.mechanical.stubs.v241.Ansys.ACT.Automation.Mechanical.Image)\] | [None](https://docs.python.org/3/library/constants.html#None)*

Gets the list of associated images.

<a id="CommandSnippet.Input"></a>

### *property* CommandSnippet.Input *: [str](https://docs.python.org/3/library/stdtypes.html#str) | [None](https://docs.python.org/3/library/constants.html#None)*

Gets or sets the Text.

<a id="CommandSnippet.InputArgument1"></a>

### *property* CommandSnippet.InputArgument1 *: [str](https://docs.python.org/3/library/stdtypes.html#str) | [None](https://docs.python.org/3/library/constants.html#None)*

Gets or sets the InputArgument1.

<a id="CommandSnippet.InputArgument2"></a>

### *property* CommandSnippet.InputArgument2 *: [str](https://docs.python.org/3/library/stdtypes.html#str) | [None](https://docs.python.org/3/library/constants.html#None)*

Gets or sets the InputArgument2.

<a id="CommandSnippet.InputArgument3"></a>

### *property* CommandSnippet.InputArgument3 *: [str](https://docs.python.org/3/library/stdtypes.html#str) | [None](https://docs.python.org/3/library/constants.html#None)*

Gets or sets the InputArgument3.

<a id="CommandSnippet.InputArgument4"></a>

### *property* CommandSnippet.InputArgument4 *: [str](https://docs.python.org/3/library/stdtypes.html#str) | [None](https://docs.python.org/3/library/constants.html#None)*

Gets or sets the InputArgument4.

<a id="CommandSnippet.InputArgument5"></a>

### *property* CommandSnippet.InputArgument5 *: [str](https://docs.python.org/3/library/stdtypes.html#str) | [None](https://docs.python.org/3/library/constants.html#None)*

Gets or sets the InputArgument5.

<a id="CommandSnippet.InputArgument6"></a>

### *property* CommandSnippet.InputArgument6 *: [str](https://docs.python.org/3/library/stdtypes.html#str) | [None](https://docs.python.org/3/library/constants.html#None)*

Gets or sets the InputArgument6.

<a id="CommandSnippet.InputArgument7"></a>

### *property* CommandSnippet.InputArgument7 *: [str](https://docs.python.org/3/library/stdtypes.html#str) | [None](https://docs.python.org/3/library/constants.html#None)*

Gets or sets the InputArgument7.

<a id="CommandSnippet.InputArgument8"></a>

### *property* CommandSnippet.InputArgument8 *: [str](https://docs.python.org/3/library/stdtypes.html#str) | [None](https://docs.python.org/3/library/constants.html#None)*

Gets or sets the InputArgument8.

<a id="CommandSnippet.InputArgument9"></a>

### *property* CommandSnippet.InputArgument9 *: [str](https://docs.python.org/3/library/stdtypes.html#str) | [None](https://docs.python.org/3/library/constants.html#None)*

Gets or sets the InputArgument9.

<a id="CommandSnippet.InternalObject"></a>

### *property* CommandSnippet.InternalObject *: Ansys.Common.Interop.DSObjectsAuto.IDSCommandEditorAuto | [None](https://docs.python.org/3/library/constants.html#None)*

Gets the internal object. For advanced usage only.

<a id="CommandSnippet.InvalidateSolution"></a>

### *property* CommandSnippet.InvalidateSolution *: [bool](https://docs.python.org/3/library/functions.html#bool) | [None](https://docs.python.org/3/library/constants.html#None)*

Gets or sets the InvalidateSolution.

<a id="CommandSnippet.IssueSolveCommand"></a>

### *property* CommandSnippet.IssueSolveCommand *: [bool](https://docs.python.org/3/library/functions.html#bool) | [None](https://docs.python.org/3/library/constants.html#None)*

Gets or sets the IssueSolveCommand.

<a id="CommandSnippet.OutputParameters"></a>

### *property* CommandSnippet.OutputParameters *: [tuple](https://docs.python.org/3/library/stdtypes.html#tuple)\[Ansys.ACT.Automation.Mechanical.CommandOutputParameter\] | [None](https://docs.python.org/3/library/constants.html#None)*

Gets a list of the command snippet’s output parameters.

<a id="CommandSnippet.OutputSearchPrefix"></a>

### *property* CommandSnippet.OutputSearchPrefix *: [str](https://docs.python.org/3/library/stdtypes.html#str) | [None](https://docs.python.org/3/library/constants.html#None)*

Gets or sets the OutputSearchPrefix.

<a id="CommandSnippet.Properties"></a>

### *property* CommandSnippet.Properties *: [tuple](https://docs.python.org/3/library/stdtypes.html#tuple)\[Ansys.ACT.Automation.Mechanical.Property\] | [None](https://docs.python.org/3/library/constants.html#None)*

Gets the list of properties for this object.

<a id="CommandSnippet.ReadOnly"></a>

### *property* CommandSnippet.ReadOnly *: [bool](https://docs.python.org/3/library/functions.html#bool) | [None](https://docs.python.org/3/library/constants.html#None)*

Gets or sets the ReadOnly.

<a id="CommandSnippet.SnippetFileStatus"></a>

### *property* CommandSnippet.SnippetFileStatus *: [int](https://docs.python.org/3/library/functions.html#int) | [None](https://docs.python.org/3/library/constants.html#None)*

Gets the SnippetFileStatus.

<a id="CommandSnippet.SolverTarget"></a>

### *property* CommandSnippet.SolverTarget *: [Ansys.Mechanical.DataModel.Enums.CommandEditorTarget](../../../Mechanical/DataModel/Enums/CommandEditorTarget.md#ansys.mechanical.stubs.v241.Ansys.Mechanical.DataModel.Enums.CommandEditorTarget) | [None](https://docs.python.org/3/library/constants.html#None)*

Gets the SolverTarget.

<a id="CommandSnippet.StepNumber"></a>

### *property* CommandSnippet.StepNumber *: [int](https://docs.python.org/3/library/functions.html#int) | [None](https://docs.python.org/3/library/constants.html#None)*

Gets or sets the StepNumber.

<a id="CommandSnippet.StepSelectionMode"></a>

### *property* CommandSnippet.StepSelectionMode *: [Ansys.Mechanical.DataModel.Enums.SequenceSelectionType](../../../Mechanical/DataModel/Enums/SequenceSelectionType.md#ansys.mechanical.stubs.v241.Ansys.Mechanical.DataModel.Enums.SequenceSelectionType) | [None](https://docs.python.org/3/library/constants.html#None)*

Gets or sets the StepSelectionMode.

<a id="CommandSnippet.Suppressed"></a>

### *property* CommandSnippet.Suppressed *: [bool](https://docs.python.org/3/library/functions.html#bool) | [None](https://docs.python.org/3/library/constants.html#None)*

Gets or sets the Suppressed.

<a id="CommandSnippet.VisibleProperties"></a>

### *property* CommandSnippet.VisibleProperties *: [tuple](https://docs.python.org/3/library/stdtypes.html#tuple)\[Ansys.ACT.Automation.Mechanical.Property\] | [None](https://docs.python.org/3/library/constants.html#None)*

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

<a id="method-detail"></a>

## Method detail

<a id="CommandSnippet.Activate"></a>

### CommandSnippet.Activate()

Activate the current object.

<a id="CommandSnippet.AddComment"></a>

### CommandSnippet.AddComment()

Creates a new child Comment.

<a id="CommandSnippet.AddFigure"></a>

### CommandSnippet.AddFigure()

Creates a new child Figure.

<a id="CommandSnippet.AddImage"></a>

### CommandSnippet.AddImage(filePath: [str](https://docs.python.org/3/library/stdtypes.html#str))

```text
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.

```

<a id="CommandSnippet.AppendText"></a>

### CommandSnippet.AppendText(NewText: [str](https://docs.python.org/3/library/stdtypes.html#str))

Append Text.

<a id="CommandSnippet.CopyTo"></a>

### CommandSnippet.CopyTo(other: Ansys.ACT.Automation.Mechanical.DataModelObject)

Copies all visible properties from this object to another.

<a id="CommandSnippet.CreateParameter"></a>

### CommandSnippet.CreateParameter(propName: [str](https://docs.python.org/3/library/stdtypes.html#str))

Creates a new parameter for a Property.

<a id="CommandSnippet.Delete"></a>

### CommandSnippet.Delete()

Run the Delete action.

<a id="CommandSnippet.Duplicate"></a>

### CommandSnippet.Duplicate()

Creates a copy of the current DataModelObject.

<a id="CommandSnippet.ExportTextFile"></a>

### CommandSnippet.ExportTextFile(TextFile: [str](https://docs.python.org/3/library/stdtypes.html#str))

Export to Textfile.

<a id="CommandSnippet.GetChildren"></a>

### CommandSnippet.GetChildren(recurses: [bool](https://docs.python.org/3/library/functions.html#bool), children: List\[ChildrenType\])

Gets the list of children, filtered by type.

<a id="CommandSnippet.GetParameter"></a>

### CommandSnippet.GetParameter(propName: [str](https://docs.python.org/3/library/stdtypes.html#str))

Gets the parameter corresponding to the given property.

<a id="CommandSnippet.GroupAllSimilarChildren"></a>

### CommandSnippet.GroupAllSimilarChildren()

Run the GroupAllSimilarChildren action.

<a id="CommandSnippet.GroupSimilarObjects"></a>

### CommandSnippet.GroupSimilarObjects()

Run the GroupSimilarObjects action.

<a id="CommandSnippet.ImportTextFile"></a>

### CommandSnippet.ImportTextFile(TextFile: [str](https://docs.python.org/3/library/stdtypes.html#str))

Import from Textfile.

<a id="CommandSnippet.PropertyByAPIName"></a>

### CommandSnippet.PropertyByAPIName(name: [str](https://docs.python.org/3/library/stdtypes.html#str))

```text
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.

```

<a id="CommandSnippet.PropertyByName"></a>

### CommandSnippet.PropertyByName(name: [str](https://docs.python.org/3/library/stdtypes.html#str))

Get a property by its unique name.

<a id="CommandSnippet.RemoveParameter"></a>

### CommandSnippet.RemoveParameter(propName: [str](https://docs.python.org/3/library/stdtypes.html#str))

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

<a id="CommandSnippet.RenameBasedOnDefinition"></a>

### CommandSnippet.RenameBasedOnDefinition()

Run the RenameBasedOnDefinition action.