Component name look up for connectors
Hello,
Can some one help me with dissecting component names. I have a multiple assemblies one has components other has weld lines. Weld lines have base components name in it.
Example of a weld line component name
2 layer line
LA7273333/2-012234 WLD LNS (X02704/X03430)
3 layer line
LA72733425/2-010104 WLD LNS (X513A12/X02704/X03430)
Example of components names
AA6383837/5-XXXX-X02704-A (PLR FRT uPPER RR FRONT)
AA671617033/5-XXXX-X03430-A (SHLD HDR REINF)
LAA6716635/4-XXXX-X513A12-A (RL RF SD FRT LHS)
I would like to look inside the weld line assembly pull out a name of the weld line sort 2 layer of 3 layer based on name inside the ( ), use the naming inside ( ) from a line name, find the components and create a connector.
Thank you for any help
Answers
-
Hi Vlad,
you can refer below for an idea on how to do this.
set lst_weldcompData [list 'LA7273333/2-012234 WLD LNS (X02704/X03430)' 'LA72733425/2-010104 WLD LNS (X513A12/X02704/X03430)'] set lst_components [list 'AA6383837/5-XXXX-X02704-A (PLR FRT uPPER RR FRONT)' 'AA671617033/5-XXXX-X03430-A (SHLD HDR REINF)' 'LAA6716635/4-XXXX-X513A12-A (RL RF SD FRT LHS)'] foreach str_weldcomp $lst_weldcompData { set str_comp1 ''; set str_comp2 ''; set str_comp3 ''; set str_simplified [ regsub {\)} [lindex [split $str_weldcomp (] end] ''] lassign [split $str_simplified / ] str_tempcomp1 str_tempcomp2 str_tempcomp3; puts '$str_tempcomp1 $str_tempcomp2 $str_tempcomp3' if {$str_tempcomp1 != ''} { set str_comp1 [lsearch -inline $lst_components *$str_tempcomp1*] } if {$str_tempcomp2 != ''} { set str_comp2 [lsearch -inline $lst_components *$str_tempcomp2*] } if {$str_tempcomp3 != ''} { set str_comp3 [lsearch -inline $lst_components *$str_tempcomp3*] } puts '$str_weldcomp has $str_comp1 , $str_comp2 , $str_comp3' }
0 -
Question on creating a list based on the names. I'm trying to create a list (lst_weldcompData) for the components that I have in a model which contain WLD LNS with following
*createmark comps 1 'contains value' name WLD LNS* 1
set lst_weldcompData [hm_getmark comps 1]I'm not getting anything from it
for the second list I will select all components which contain SHELL elements
proc Isolate2D {{opt all}} {
*displaynone
*createmark elems 1 $opt
*createmark elems 2 'by config' tria3 quad4
*markintersection elems 1 elems 2
if {[hm_marklength elems 1]} {*findmark elems 1 0 1 elems 0 2}
*clearmark elems 1
*clearmark elems 2
}
Isolate2D
*createmark comps 1 'displayed'set lst_components [hm_getmarkvalue comps 1 name 1];
Thank you for all your help
0 -
Hi Vlad,
You can try:
# search weld set lst_compNames [hm_entitylist comps name] set lst_weldcomps [lsearch -all -inline -glob $lst_compNames *WLD LNS*] # search shell *createmark elems 2 'by config' tria3 quad4 set lst_shellcomps [lsort -unique [hm_getvalue elems mark=2 dataname=component.name]]
0 -
when I execute line
set lst_weldcomps [lsearch -all -inline -glob $lst_compNames *WLD LNS*]
I get this error
: must be -all, -ascii, -decreasing, -dictionary, -exact, -glob, -increasing, -index, -inline, -integer, -nocase, -not, -real, -regexp, -sorted, -start, or -subindices
Thank you for your help
0 -
its seems like its doesn't like Space in the 'WLD LNS' so naming of the component will need to change or is there a way around it?
Thank you
0 -
yes, special characters like space ( ) will case issues. You write a script to rename all components by converting all special chars to _.
0 -
Altair Forum User said:
when I execute line
set lst_weldcomps [lsearch -all -inline -glob $lst_compNames *WLD LNS*]
I get this error
: must be -all, -ascii, -decreasing, -dictionary, -exact, -glob, -increasing, -index, -inline, -integer, -nocase, -not, -real, -regexp, -sorted, -start, or -subindices
Thank you for your help
Could you try again:
set lst_weldcomps [lsearch -all -inline -glob $lst_compNames '*WLD LNS*']
if '*WLD LNS*' has special character other than space, you can filter it by:
set lst_weldcomps [lsearch -all -inline -regexp $lst_compNames {.*WLD[:space:]*LNS.*}]
or if you are sure that component names don't have WLD and LNS then simply:
set lst_weldcomps [lsearch -all -inline -glob $lst_compNames '*WLD*LNS*']
0 -
Tinh,
Thank you both methods worked
0