🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

Deleting Elements

User: "Altair Forum User"
Altair Employee
Updated by Altair Forum User

Hey guys,

 

I'm trying to write a script which deletes elements of a model, that have a young's modulus under a certain value ('Grenzwert').

Running the following Code, this is working as it is supposed to for the first 5 iterations. Afterwards the number of elements deleted stays the same all the time. The problem is, that there are still elements with a youngs modulus lower than 100.

Do you know what's the problem here?

 

Some annotations which may help to understand the code:

lStressValue_1 = list containing the young's modulus of every element

delete_id = element id which should be deleted

 

# Suchen aller Werte unter Grenzwert
set delete_id ''
set delete_index {}
set Grenzwert 100
set y -1
set Element ''
# y gibt den Index des Felded unter Grenzwert an wird zu einer Liste zusammengefügt
foreach Element $lStressValue_1 {
        incr y
        if {[expr $Element < $Grenzwert]} {
            lappend delete_index '$y'
        }
}
# Die Element-Ids aus der Liste der lIDs mit den Elementen unter Grundwert herauslesen
foreach Element_C $delete_index {
    append delete_id '[lindex $lID_1 $Element_C] '
}

*createmark elements 1 {*}$delete_id
*deletemark elements 1

 

Kind regards,

Simon

Find more posts tagged with