How to delete load objects in WB LS-DYNA?

Options
Zephyr
Zephyr Member Posts: 3
First Comment Photogenic

How to delete load objects in WB LS-DYNA?
I have learned "How to create load objects in WB LS-DYNA" as below link.
But I cannot delete it before create new load objects.
https://discuss.ansys.com/discussion/comment/1170#Comment_1170
May anyone tell me how, thank you.

Tagged:

Best Answer

Answers

  • Zephyr
    Zephyr Member Posts: 3
    First Comment Photogenic
    Options

    Hi Aria,

    It works. Thank you.
    a=ExtAPI.DataModel.Project.Model.Analyses[0]
    target = r'targetName'
    object_id = None
    for i in a.Children:
    if i.Name == target:
    object_id = i.ObjectId
    analysis = ExtAPI.DataModel.AnalysisList[0]
    user_obj = analysis.CreateLoadObject("Section", "LSDYNA")
    DS = ExtAPI.DataModel.InternalObject["ds"]
    DS.Tree.DeleteObject(object_id)

  • Landon Mitchell Kanner
    Landon Mitchell Kanner Member, Employee Posts: 208
    First Answer First Comment 5 Likes First Anniversary
    edited September 2023
    Options
    def DeleteObject(obj):
        try: ID = obj.ObjectId
        except: ID = obj.InternalObject.ID
        JScmds = 'DS.Tree.DeleteObject({})'.format(ID)
        ExtAPI.Application.ScriptByName("jscript").ExecuteCommand(JScmds)