We have an exciting announcement about badges coming in May 2025. Until then, we will temporarily stop issuing new badges for course completions and certifications. However, all completions will be recorded and fulfilled after May 2025.

Ansys Learning Forum Forums Discuss Simulation General Mechanical Automated Import of Load history data uisng scripts (Python or Mapdl) Reply To: Automated Import of Load history data uisng scripts (Python or Mapdl)

user deleted
Subscriber
This is my code for the Input force
import csv
filePath = 'FilePath'
timesteps = [] #Create empty list to store timestep values
loads = [] #Create empty list to store load values
with open(filePath, 'r') as csvFile:
    csvRead = csv.reader(csvFile, delimiter=',')
    next(csvRead) #Skip first line (assumed headers)
    
    for row in csvRead:
        timesteps.append(row[0]) #Populate list with first column's values
        loads.append(row[1]) #Populate list with second column's values
 
#Configure lists
timeUnit = '[sec]' #Timestep unit
loadUnit = '[N]' #Load unit
timesteps = [str(time) + timeUnit for time in timesteps] #Convert values to strings and append unit
loads = [str(load) + loadUnit for load in loads] #Convert values to strings and append unit
#Create load
analysis_104 = DataModel.GetObjectById(207)
force_207 = DataModel.GetObjectById(207)
force_207.Magnitude.Inputs[0].DiscreteValues = [Quantity(time) for time in timesteps]
force_207.Magnitude.Output.DiscreteValues = [Quantity(load) for load in loads]
Â