Change System names

Erik Kostson
Erik Kostson Member, Employee Posts: 233
50 Answers 100 Comments Second Anniversary 25 Likes
✭✭✭✭
edited November 2023 in Structures

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

Tagged:

Best Answers

  • Erik Kostson
    Erik Kostson Member, Employee Posts: 233
    50 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭
    Answer ✓

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

  • Erik Kostson
    Erik Kostson Member, Employee Posts: 233
    50 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭
    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()