Find and change characters for Named Selections inside Spaceclaim

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

Say we have a some Named Selections inside Spaceclaim with the "." character inside their name.

We would like to replace this character by "_".

Can we use scripting to do that?

Comments

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

    Below is a Spaceclaim script that finds . in the groups/Named Selections, and replaces it with _

    groups = GetActiveWindow().ActiveWindow.Groups
    for ns in groups:
        nm=ns.GetName()
        if nm.find(".") !=-1:
            print(nm)
            newnm = nm.replace(".", "_")
            NamedSelection.Rename(nm, newnm)
    
This discussion has been closed.