Extract element volume

Joao_21860
Joao_21860 Altair Community Member
edited October 2020 in Community Q&A

Dear all,

 

I need to carry out some calculations and for that, I need to know the volume of each element separately.

 

Is there an easy way I can extract these values from hypermesh or even hyperview?

Tagged:

Answers

  • Q.Nguyen-Dai
    Q.Nguyen-Dai Altair Community Member
    edited February 2020

    Try:

     hm_getvalue elems id=<Elem-ID> dataname=volume

     

  • Joao_21860
    Joao_21860 Altair Community Member
    edited February 2020

    Try:

      hm_getvalue elems id=<Elem-ID> dataname=volume

     

    How would I apply this command line? Scripting?

  • Q.Nguyen-Dai
    Q.Nguyen-Dai Altair Community Member
    edited February 2020

    You can execute this command directly within command window (below of graphical area) or write it into a TCL script.

  • Joao_21860
    Joao_21860 Altair Community Member
    edited February 2020

    You can execute this command directly within command window (below of graphical area) or write it into a TCL script.

     

    I applied this command but it seems to extract the volume from single elements. I have a component with 1 million + elements so what I need is to extract the volume of every element and save it into a file.

    Is there a way to adapt this command to automatically do it? Or is there another way?

  • Q.Nguyen-Dai
    Q.Nguyen-Dai Altair Community Member
    edited February 2020

    Write your own TCL script !

    • Select elements
    • Loop overs selected elements
    • Each element, query the volume
    • Write to file
  • Joao_21860
    Joao_21860 Altair Community Member
    edited February 2020

    Thank you!

     

    Btw, I also found that you can easily plot and extract it from Hyperview by using derived results

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2020

    Thank you!

     

    Btw, I also found that you can easily plot and extract it from Hyperview by using derived results

    Hey, friend. I'm also trying to extract the volume of all elements in a model. Could you tell me how did you make it in Hyperview? T

  • Adriano A. Koga
    Adriano A. Koga
    Altair Employee
    edited June 2020

    You could perform this in HV using Result Math. You need to load your result files and choose 'Advance' in Math Template.

    image.png.b2425b4209842ad980372fda1b86eca5.png

     

    Then, go to 'Derived Results' tab, and create a new expression, giving it a name.

    This lets you created derived expressions based on some results, math, etc.

    You will edit the expression using the command' Volume()' and save it.

    After that, you will have a new result with the name you gave. Contour this result in 'Contour' tab and then use query to request all the elements, then export it as a CSV.

    <?xml version="1.0" encoding="UTF-8"?>image.thumb.png.4e9d8bb0f76ec3daec1a0e4c7eb06e05.png

     

     

    In HM you can use the command line mentioned in above replies with a few changes.

     

    #user selects elements and stores in a variable elems_list

    *createmarkpanel elems 1 'select elements to calculate volume from:'

    set elems_list [hm_getmark elems 1]

    *clearmark elem 1

     

    $retrieves the volume of all the elements stored in mark 1

    eval '*createmark elems 1 $elems_list'

    set volume_list [hm_getvalue elems mark=1 dataname=volume] 

    *clearmark elems 1

     

    #writes the data to a CSV file

    set fo [open 'dir/filename.csv' w]  ; ### CHANGE THIS ###

    foreach elemo $elems_list volo $volume_list {

         puts $fo '$elemo $volo'

    }

    close $fo