Get Name of component

sanket_patil
sanket_patil Altair Community Member
edited October 2020 in Community Q&A

What is Tcl command to get component name and split it?

Thanks.

 

Answers

  • vipin_22401
    vipin_22401 Altair Community Member
    edited November 2018
    Hi,
     
    hm_getcollectorname comps 101
    how do you want to split?
  • sanket_patil
    sanket_patil Altair Community Member
    edited November 2018

    if component name is '3532923_M-CROSSMEMBER_ENGINE MTG_BDY_SOLIDS', I only want number '3532923'. how to split it?

    Thanks!

  • Yu-Ju Chen_20500
    Yu-Ju Chen_20500 Altair Community Member
    edited November 2018

    hi, i guess you can try to rename rather than splitting 

  • sanket_patil
    sanket_patil Altair Community Member
    edited November 2018

    Hello,

    Actually i want to get that number from name and set it as that component's id. so renaming is not good option.

    Thanks.

     

  • sandeepballiwar
    sandeepballiwar New Altair Community Member
    edited November 2018

    First get the component name.

    If your compname is 123_comp_comp1. 

    use split command and get the number.

     

    after that use *<span style='background-color:transparent;color:#000000;'>rename</span>collector to change the name. 

     

    Hope this helps.

  • sanket_patil
    sanket_patil Altair Community Member
    edited November 2018

    @sandeepballiwar Thanks for help. I will try this option.

  • sanket_patil
    sanket_patil Altair Community Member
    edited November 2018

    Is there any option to rename all displayed components at a time?

     

  • sandeepballiwar
    sandeepballiwar New Altair Community Member
    edited November 2018

    i don't think there is any api to rename all components at the same time. You need to write a program in in for loop or foreach loop.

  • sanket_patil
    sanket_patil Altair Community Member
    edited November 2018

    Ok.

    Thanks for the help :)/emoticons/default_smile.png' srcset='/emoticons/smile@2x.png 2x' title=':)' width='20' />

     

  • Yu-Ju Chen_20500
    Yu-Ju Chen_20500 Altair Community Member
    edited November 2018

    i agree with you!

    i think applying a loop is a better solution

  • sanket_patil
    sanket_patil Altair Community Member
    edited November 2018

    @Yu-Ju Chen @sandeepballiwar I have used for loop and it is working good.