How to get the component id
Hi all,
My objective was to write a program to select the components from the file and i want to print the ID's of the component which i have selected in order.
when i try to print those i am getting the ID's in ascending order..
I want those ID's in the order i have selected..
I selected the components using this option.
*createmarkpanel comps 1 'Select Components//s'
set compList [hm_getmark comps 0]
Thanks in Advance.
Karthikeyan
Find more posts tagged with
yes, that's right. I hope altairians will make it possible soon for comps
you can repeat 'hm_getmark' to monitor changing in the mark and can get the comp list as in order
for example
set complist {}
set repeat_on 1
repeat_hm_getmark
*createmarkpanel comps 1 'select comps:'
*clearmark comps 1
set repeat_on 0
tk_messageBox -message $complist
this is minimum example of proc 'repeat_hm_getmark'
proc repeat_hm_getmark {} {
foreach compid [hm_getmark comps 1] {
if {[lsearch $::complist $compid]==-1} {lappend ::complist $compid}
}
if {$::repeat_on} {after 100 repeat_hm_getmark}
}
Thanks for the Reply!!!
I am new to the Tcl scripting and i know how to convert from cmf to tcl and to use some loops to do the repeated tasks..
i came up with a different idea, like get the components one by one and print it on a file.
set fileName 'component_id.txt'
set fileId [open $fileName 'a+']
set i 0
set length 5
while {$i < $length} {
*createmarkpanel comps 1 'Select One Component'
set compList [hm_getmark comps 1]
set id [lindex $compList 0]
puts -nonewline $fileId '$id'
puts -nonewline $fileId ' '
set i [expr {$i + 1}]
}
close $fileId
But, the problem with this is it will get only 5 components from the user.. Is there anyway doing like getting the input till the user press a key, For Example 'ESC'...If he presses ESC it should come out of the loop and the file should be written with the given inputs..
Hello,
try the following...
*createmarkpanel components 1 'Select components ...'
set compList [hm_getmark components 1]
hm_markclear components 1
foreach compID $compList {
set compName [hm_getcollectorname comp $compID]
tk_messageBox -message 'CompName (CompID): $compName ($compID)'
}
Regards,
Mario