Is it possible to delete an imported material using script?

Collins
Collins Member Posts: 24
10 Comments 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, GitHub-issue-creator Posts: 334
    50 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭
    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
    10 Comments Name Dropper
    **

    Thank you so much @Landon Mitchell Kanner

    Super helpful feedback.