How to output selection the name selection with mechanical script?

Feng Zhu
Feng Zhu Member Posts: 7
Name Dropper First Anniversary First Comment
**



As the figs shown, I want to output the name selection result data, but the mechanical scripting doesn't record the hangdling operation. Can you give me a hand?

Comments

  • Mike.Thompson
    Mike.Thompson Member, Employee Posts: 385
    25 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭

    Try this out.

    NamedSelNames = ['face','face2']
    NSs = [ExtAPI.DataModel.GetObjectsByName(NamedSelName)[0] for Name in NamedSelNames]
    AS = Model.Analyses[0].AnalysisSettings
    AS.OutputSelection=OutputSelection.NamedSelection
    AS.NamedSelection=NSs
    
  • Feng Zhu
    Feng Zhu Member Posts: 7
    Name Dropper First Anniversary First Comment
    **
    edited March 4

    @Mike.Thompson

    Hi, Mike
    Thanks for your help.

    I made some minor changes, it's OK now.

    NamedSelNames = ['face','face2']
    NSs_nested = [ExtAPI.DataModel.GetObjectsByName(Name) for Name in NamedSelNames]
    NSs = [item for sublist in NSs_nested for item in sublist]
    AS = Model.Analyses[0].AnalysisSettings
    AS.OutputSelection=OutputSelection.NamedSelection
    AS.NamedSelection=NSs