RENAMING COMP COLLECTORS IN HYPERMESH using TCL scripts
Hi All,
Anyone can tell me the How to Rename the comp collectors in HyperMesh using TCL scripts.
For suppose Comp name : ABC12345_2.00T and PID : 1 OUTPUT : ABC12345_1
i want to keep that first eight digits, and i want to delete that thickness information and i want to rename with its PID
please tell me If anyone know
Regards,
Sudhakar
Answers
-
Here is my not-yet-tested code:
proc make_new_name { name } {
# do some thing over current name to create new one
return $newname;
}
*createmarkpanel components 1 'Select compo'
set listComp [ hm_getmark components 1 0 ]
foreach compID $listComp {
set name [hm_entityinfo name components $compID]
set newName [make_new_name $name]
eval *renamecollector components $name $newName;
}0 -
Hi
below is a sample of 'make_new_name':
proc make_new_name {name} {
set i 1
set _new_name [string range $name 0 [string last '_' $name]]
set new_name ${_new_name}$i
while {[hm_entityinfo exist comps $new_name]} {set new_name ${_new_name}[incr i]}
set new_name
}0 -
hi Q.NGUYEN-DAI,
Thanks for your support.
but i didn't get exactly '# do some thing over current name to create new one'
what it means.
Regards,
Sudhakar
0 -
Hi Tinh,
Thanks for your support,
But Above what you mentioned TCL code not running.
Regards,
Sudhakar
0 -
Altair Forum User said:
hi Q.NGUYEN-DAI,
Thanks for your support.
but i didn't get exactly '# do some thing over current name to create new one'
what it means.
Regards,
Sudhakar
Do you have some programming skill with TCL ?
0 -
Altair Forum User said:
Do you have some programming skill with TCL ?
I have very basic Knowledge.
0 -
Hi Tinh,
Thanks for your valuable support,
using your TCL code i prepared tcl script to rename all the collectors.
Thanks,
Sudhakar Donepudi
0 -
hi Sudhakar,
What changes you made to the script provided by Tinh?
If possible can you paste the complete TCL script you used
0 -
Altair Forum User said:
hi Sudhakar,
What changes you made to the script provided by Tinh?
If possible can you paste the complete TCL script you used
Hi,
you can use this function
proc make_new_name {name} {set i 0set name_ [string range $name 0 [string last '_' $name]]while {[hm_entityinfo exist comps '${name_}[incr i]' -byname]} {}return ${name_}$i}
0 -
0
-
How to rename the components by thicknesswise by using script? please help me out.
0 -
Hi,
try this
foreach compname [hm_entitylist comps name] {
*renamecollector comps $compname $compname_[hm_getthickness [hm_getentityvalue comps $compname id 0 -byname]]
}
and above 'proc make_new_name' is unneccessary, use hm_getincrementalname instead.
0