How to delete load objects in WB LS-DYNA?

Zephyr
Zephyr Member Posts: 8
Photogenic First Comment
**

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: 8
    Photogenic First Comment
    **

    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: 287
    100 Comments 25 Answers 25 Likes Photogenic
    ✭✭✭✭
    edited September 2023
    def DeleteObject(obj):
        try: ID = obj.ObjectId
        except: ID = obj.InternalObject.ID
        JScmds = 'DS.Tree.DeleteObject({})'.format(ID)
        ExtAPI.Application.ScriptByName("jscript").ExecuteCommand(JScmds)