Use scripting API to set source and analysis time steps for Imported Displacemen
TAGGED: #ACT#AnsysACT#Ansys, ironpython
-
-
August 7, 2025 at 1:14 am
mscal
SubscriberEssentially, I am trying to automate the creation and definition of a Cut Boundary Constraint for a submodel. This is using the ironPython in the console embedded in Mechanical. With the Macro Recorder I have figured most of it out. However, I cannot figure out how to access this worksheet that comes for specifying the "Source TIme" property.  Neither the Ansys.ACT.Automation.Mechanical.ImportedLoads.ImportedLoadGroup object, or Ansys.ACT.Automation.Mechanical.ImportedLoads.ImportedDisplacement object, have an input/output property that I am used to filling our tabular loads. Â
Can anyone assist? Here is what I have so far:
analysis = Model.Analyses[0]
analysis.AnalysisSettings.NumberOfSteps = 2
analysis.AnalysisSettings.LargeDeflection = False
iload = analysis.AddImportedLoadResultFile()
iload.ResultFile = r'path\to\source\file.rst'
icut = iload.AddImportedCutBoundaryConstraint()
# Set scoping method to Named Selection
icut.PropertyByName('GeometryDefineBy').InternalValue = 1 Â
# Set to BC faces
icut.PropertyByName('ComponentSelection').InternalValue = NamedSelection.ObjectID # Assume I have defined a Named SelectionÂ
-
August 8, 2025 at 11:05 am
Matthew Middleton
Ansys Employeetable = icut.GetTableByName("Data View")
#table.Columns   # lists column header names, which are row dictionary keys
row1 = table.Item[0]
#row1.Item is dictionary with keys as shown from table.Columns
# table changes will not be seen in the table unless click away and on imported load again, or use ExtAPI.DataModel.Tree.Refresh()
row1.Item['Source Time'] = 1 Â Â Setting to zero will set to 'End Time' when using internal transferred loads (Not External Data system)
row1.Item['Analysis Time'] = 1.2
# Can also access with two indices: table[row][column]
# to add a row:
#row2 = Ansys.ACT.Automation.Mechanical.WorksheetRow()
# set dictionary entries like row1 above
#table.Add(row2)
# table.Add(None) Â # If you want to fill in the columns afterward
ExtAPI.DataModel.Tree.Refresh()
iload.ImportLoad()Â -
August 8, 2025 at 2:38 pm
mscal
SubscriberIt works, thank you. Is this method/property GetTableByName, and the resulting interface to the table, documented anywhere?
-
August 8, 2025 at 8:01 pm
Matthew Middleton
Ansys Employeehttps://ansyshelp.ansys.com/account/secured?returnurl=/Views/Secured/corp/v252/en/act_script/MechAPIsImportLoad.html
-
- You must be logged in to reply to this topic.
-
6600
-
1906
-
1463
-
1311
-
1022
© 2026 Copyright ANSYS, Inc. All rights reserved.
