How to create and fill a spline object in Motion?

Gabriel Messager
Gabriel Messager Member, Employee Posts: 59
5 Answers Second Anniversary 10 Comments 5 Likes
✭✭✭✭

How to create and fill a spline object in Motion (2024R2 and newer)?

Tagged:

Answers

  • Gabriel Messager
    Gabriel Messager Member, Employee Posts: 59
    5 Answers Second Anniversary 10 Comments 5 Likes
    ✭✭✭✭
    analysis = Model.Analyses[0]
    newspline = analysis.CreateLoadObject("Spline","ANSYSMotion")
    table = newspline.Properties.GetByName("Spline")
    newspline.Caption = "SPL_Stiffness"
    newspline.Controller.DisposeFigure(newspline)
    X = [-1e-3, 0, 0.1, 1e3]
    Y = [-100, 0, 2000, 2500]
    X_Data = table.Properties.GetByName("XData")
    Y_Data = table.Properties.GetByName("YData")
    for i in range (0,len(X)):
        table.AddRow()
        X_Data.Value = X[i]
        Y_Data.Value = Y[i]
        table.SaveActiveRow()
    table.ValidState=ValidStateEnum.StateValid
    newspline.NotifyChange()