Is it possible to delete an imported material using script?

Collins
Collins Member Posts: 24
First Comment Name Dropper
**

I have some material imported already and I can delete them in Mechanical GUI but I am curious if there is a script to delete it directly in Mechanical without using any ANsys Workbench shell or code

Answers

  • Landon Mitchell Kanner
    Landon Mitchell Kanner Member, Employee Posts: 286
    First Answer First Comment 5 Likes First Anniversary
    ✭✭✭✭
    def DeleteObject(obj):
        try: ID = obj.ObjectId
        except: ID = obj.InternalObject.ID
        JScmds = 'DS.Tree.DeleteObject({})'.format(ID)
        ExtAPI.Application.ScriptByName("jscript").ExecuteCommand(JScmds)
    
  • Collins
    Collins Member Posts: 24
    First Comment Name Dropper
    **

    Thank you so much @Landon Mitchell Kanner

    Super helpful feedback.