Deleting Elements

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

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

Answers

  • tinh
    tinh Altair Community Member
    edited March 2019

    Note that from v13 you can filter entities by 'less than value' :

     

    *createmark elems 1 $IID_1

    *createmark elems 2 'less than value' collector.material.\$E $Grenzwert 0

    *markintersection elems 1 elems 2

    *deletemark elems 1

     

     

     

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited March 2019

    Thank you, this already helps me a lot!

    But somehow, the  line  *createmark elems 2 'less than value' collector.material.\$E $Grenzwert 0 marks all the elements of the model.

    Is the variable $E the youngs modulus and does it have to be declared before using the command?

    And what's the meaning of the 0 at the end of the line?

     

    Or in general: What do I have to put in here: collector.material.\$E

    The real collector names or can I leave it as it is?

  • tinh
    tinh Altair Community Member
    edited March 2019

    To know it you have to view reference help of *createmark