Change System names

Erik Kostson
Erik Kostson Member, Employee Posts: 87
First Answer Name Dropper First Anniversary Ansys Employee
edited November 2023 in Structures

How to change the System name on WB Project page using the Mechanical ACT console?

Tagged:

Best Answer

  • Erik Kostson
    Erik Kostson Member, Employee Posts: 87
    First Answer Name Dropper First Anniversary Ansys Employee
    Answer ✓

    This works only within the workbench scripting console/shell:

    for index, system in enumerate(GetAllSystems()):
        system.DisplayText = "MySystem_%s" % index   
    

    This works only within the Mechanical :

    def Test():
        ScriptCmds =r"""
    for index, system in enumerate(GetAllSystems()):
        system.DisplayText = "System_%s" % index  
    """
        import wbjn
        wbjn.ExecuteCommand(ExtAPI, ScriptCmds)
    thread=System.Threading.Thread(System.Threading.ThreadStart(Test))
    thread.Start()
    

Answers

  • Erik Kostson
    Erik Kostson Member, Employee Posts: 87
    First Answer Name Dropper First Anniversary Ansys Employee

    import wbjn
    ScriptCmds = """
    for index, system in enumerate(GetAllSystems()):
        system.DisplayText = "MySystem_%s" % index
    """
    wbjn.ExecuteCommand(ExtAPI, ScriptCmds)