Automated mass calc

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

I have a model with around 1400 property cards. I need to know the mass of the elements for each property. I started doing this manually by right-clicking property -> 'isolate only', selecting all visible elements, and doing mass calc. However, this will take forever to do for all 1400 properties. Is there any way to automate this process?

 

Alternatively, if there is a way to calculate the mass for each material card, that would be useful as well. However, parts of the model are composites with multiple materials in a property, so this probably isn't possible.

Tagged:

Answers

  • Udhay Rohith
    Udhay Rohith Altair Community Member
    edited November 2018

    Goto model browser and select component view (3rd icon) . You can see the mass, thickness, material everything assigned to the components there.

     

     

    image.png.2f8087035201b243210a0460340b0c68.png

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2018

    Thank you for responding, Udhay. Unfortunately, that won't work in this case because each component in my model has around 200 different properties within it. The masses I'm looking for aren't for the components, but the mass of all of the elements that have a specific property assigned. I can do this manually by isolating the elements of that property, selecting them, and using the mass calc tool, but that would take forever to do for 1400 properties. I was wondering if this was possible to do with a macro, for example, to speed it up.

  • vipin_22401
    vipin_22401 Altair Community Member
    edited November 2018

    Hi @paul_a,

     

    You can try a macro like this to save property information to csv file.

     

    set fpt [open [tk_getSaveFile -defaultextension .csv] w]
    puts $fpt 'property name,mass'
    set allProps [hm_entitylist props name]
    foreach pName $allProps {
        *createmark elems 1 'by property name' $pName
        set temp [hm_getmass elems 1]
        set mass [lindex $temp 0]
        puts $fpt '$pName,$mass'
    }
    close $fpt

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2018

    Vipin, thank you so much, this worked and saved me about 12 hours of repetitive clicking.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited April 2019

    Hi @paul_a,

     

    You can try a macro like this to save property information to csv file.

     

    set fpt [open [tk_getSaveFile -defaultextension .csv] w]
    puts $fpt 'property name,mass'
    set allProps [hm_entitylist props name]
    foreach pName $allProps {
        *createmark elems 1 'by property name' $pName
        set temp [hm_getmass elems 1]
        set mass [lindex $temp 0]
        puts $fpt '$pName,$mass'
    }
    close $fpt

    Hello Vipin, I need to use comps instead of elems and extract the masses to a variable. I'm trying the same procedure as you mentioned, but not able to get mass for all components. Can you help. TIA.

  • vipin_22401
    vipin_22401 Altair Community Member
    edited April 2019

    Hi @rrishav,

     

    Use  'by comp name' instead.