Hypermesh - selecting components with names containing a certain string

Andy@LamteqSolutions
Andy@LamteqSolutions Altair Community Member
edited October 2020 in Community Q&A

Hi all,

 

Am trying to find a line of code which will select a component / assembly / set etc, when the name contains a certain string... for instance the assembly name may read 'apples-001001a' but I want a script to select that assembly if the name contains 'apples' as the number could change in the future.

 

Any ideas?

 

Cheers

Andy

Answers

  • tinh
    tinh Altair Community Member
    edited September 2018

    Below cmd could work:

    *createmark comps 1 'contains value' name apples* 1

    puts [hm_getmark comps 1]

  • Andy@LamteqSolutions
    Andy@LamteqSolutions Altair Community Member
    edited September 2018

    Awesome Ting,

     

    Many thanks again.

     

    Cheers

    Andy

  • Andy@LamteqSolutions
    Andy@LamteqSolutions Altair Community Member
    edited September 2018

    What I would like to do is createmark elements by assembly name where assemblies contain the word Apples...

     

    *createmark elements 1 'by assembly name' Apples

     

    I've tried *createmark elements 1 'by assembly name' 'contains value' Apples* 1 but that's not it....

     

    Any ideas?

     

  • tinh
    tinh Altair Community Member
    edited September 2018

    This is it:

    *createmark assems 1 'contains value' name Apples* 1

    *createmark elems 1 'by assem id' {*}[hm_getmark assems 1]

  • Andy@LamteqSolutions
    Andy@LamteqSolutions Altair Community Member
    edited September 2018

    Ah got ya. Thanks again Tinh (apologies, I realise that I actually mis-spelt your name earlier)