Hello,
When I select some entities in GiD using the procedure:
Utilities::PickEntities the result may be in the form 1:4.
Can you suggest me a way of transforming this interval in a list with
all the components {1 2 3 4}?
Thank you,
--------------------------------------------
Mihai TEODORESCU
Ingénieur Recherche et Développement
Pièces et Accessoires Industriels
Tel: (33)05.49.25.40.71
Email: mihai.teodorescu at prevost-industries.com
--------------------------------------------
[GiDlist] Entities Selection
Moderator: GiD Team
[GiDlist] Mark D. Moeckel/0Y/Caterpillar is out of the offic
I will be out of the office starting 19May2003 and will not return until
29May2003.
29May2003.
[GiDlist] Entities Selection
Hi, you can do the following
proc ExpandGIDSelection { sellist } {
set result
proc ExpandGIDSelection { sellist } {
set result
- foreach sel $sellist {
if {[llength [set range [split $sel :]]]==1} {
lappend result $range
} else {
foreach {from to} $range break
while {$from=$to} {
lappend result $from
incr from
}
}
}
# you can also use: return $result
set result
}
best regards,
Jorge Suit
Mihai TEODORESCU wrote:
Hello,
When I select some entities in GiD using the procedure:
Utilities::PickEntities the result may be in the form 1:4.
Can you suggest me a way of transforming this interval in a list with
all the components {1 2 3 4}?
Thank you,
--------------------------------------------
Mihai TEODORESCU
Ingénieur Recherche et Développement
Pièces et Accessoires Industriels
Tel: (33)05.49.25.40.71
Email: mihai.teodorescu at prevost-industries.com
--------------------------------------------
_______________________________________________
GiDlist mailing list
GiDlist at gid.cimne.upc.es
http://gid.cimne.upc.es/mailman/listinfo/gidlist
[GiDlist] Entities Selection
This is another sample procedure, inverse of you want: convert the selection list from "expanded style" to "compact style"
#sellist must be a list of positive integer numbers (e.g, a GiD entities selection)
proc CompactGIDSelection{ sellist } {
set ret ""
set istart 0
foreach i [lsort -integer $sellist] {
if { !$istart} {
set istart $i
} else {
if {$i != [expr $iprev+1]} {
if { $istart != $iprev } {
if { [expr $istart +1] == $iprev } {
append ret "$istart $iprev "
} else {
append ret "$istart:$iprev "
}
} else {
append ret "$istart "
}
set istart $i
}
}
set iprev $i
}
if { $istart } {
if { $istart != $iprev } {
if { [expr $istart +1] == $iprev } {
append ret "$istart $iprev"
} else {
append ret "$istart:$iprev"
}
} else {
append ret "$istart"
}
}
return $ret
}
Enrique Escolano
----- Original Message -----
From: "Mihai TEODORESCU" mihai.teodorescu at prevost-industries.com
To: "GID Mailing List (E-mail)" gidlist at gatxan.cimne.upc.es
Sent: Monday, May 19, 2003 10:23 AM
Subject: [GiDlist] Entities Selection
Hello,
When I select some entities in GiD using the procedure:
Utilities::PickEntities the result may be in the form 1:4.
Can you suggest me a way of transforming this interval in a list with
all the components {1 2 3 4}?
Thank you,
--------------------------------------------
Mihai TEODORESCU
Ingénieur Recherche et Développement
Pièces et Accessoires Industriels
Tel: (33)05.49.25.40.71
Email: mihai.teodorescu at prevost-industries.com
--------------------------------------------
_______________________________________________
GiDlist mailing list
GiDlist at gid.cimne.upc.es
http://gid.cimne.upc.es/mailman/listinfo/gidlist
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20030519/0a14d1c8/attachment.htm
#sellist must be a list of positive integer numbers (e.g, a GiD entities selection)
proc CompactGIDSelection{ sellist } {
set ret ""
set istart 0
foreach i [lsort -integer $sellist] {
if { !$istart} {
set istart $i
} else {
if {$i != [expr $iprev+1]} {
if { $istart != $iprev } {
if { [expr $istart +1] == $iprev } {
append ret "$istart $iprev "
} else {
append ret "$istart:$iprev "
}
} else {
append ret "$istart "
}
set istart $i
}
}
set iprev $i
}
if { $istart } {
if { $istart != $iprev } {
if { [expr $istart +1] == $iprev } {
append ret "$istart $iprev"
} else {
append ret "$istart:$iprev"
}
} else {
append ret "$istart"
}
}
return $ret
}
Enrique Escolano
----- Original Message -----
From: "Mihai TEODORESCU" mihai.teodorescu at prevost-industries.com
To: "GID Mailing List (E-mail)" gidlist at gatxan.cimne.upc.es
Sent: Monday, May 19, 2003 10:23 AM
Subject: [GiDlist] Entities Selection
Hello,
When I select some entities in GiD using the procedure:
Utilities::PickEntities the result may be in the form 1:4.
Can you suggest me a way of transforming this interval in a list with
all the components {1 2 3 4}?
Thank you,
--------------------------------------------
Mihai TEODORESCU
Ingénieur Recherche et Développement
Pièces et Accessoires Industriels
Tel: (33)05.49.25.40.71
Email: mihai.teodorescu at prevost-industries.com
--------------------------------------------
_______________________________________________
GiDlist mailing list
GiDlist at gid.cimne.upc.es
http://gid.cimne.upc.es/mailman/listinfo/gidlist
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20030519/0a14d1c8/attachment.htm