🎉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

How to Export Node set ID/Name in HyperView While Exporting Query Stress/Displacement Results

User: "srinivas rallabandi_21059"
Altair Community Member
Updated by srinivas rallabandi_21059

I am trying to Export stress results using the Query Option in Hyperview as a *.CSV/*.txt file.

I am using Node By set option to export my results. How to include Setname/Set ID in the CSV File.

Any script is available to include the Set ID/name

Here is the attached Image which I am looking for as a reference

 

Find more posts tagged with

Sort by:
1 - 10 of 101
    User: "Nagahashi Kouta"
    Altair Community Member
    Updated by Nagahashi Kouta

    Hi, srinivas rallabandi

    May I know the result file type in your question ?

    If you are using optistruct, You can achieve this by writing scripts.

    User: "srinivas rallabandi_21059"
    Altair Community Member
    OP
    Updated by srinivas rallabandi_21059

    Hi Nagahashi 

    I am using Nastran as the solver and my final result file is in OP2 format

     

    User: "Nagahashi Kouta"
    Altair Community Member
    Updated by Nagahashi Kouta

    Hi, srinivas rallabandi

    Sorry for replying late. When you create a set of nodes in HyperView, you can export the set info using a text file in TXT format.

    image

    After you export the results obtained by Query, you can use a TCL script or Python script to match the information of the two files, and write the set name corresponding to the node id into the text file obtained by query.

    User: "srinivas rallabandi_21059"
    Altair Community Member
    OP
    Updated by srinivas rallabandi_21059

    I tried to Export my Node Sets using the Export Option and Tried both Formats

    1)- Hyperview Format

    2) Nastran-Format

     

    Do you Recommend any basic command ( Python or SED, AWK)  to start or Compare both of them

     

    Thank you 

    User: "Nagahashi Kouta"
    Altair Community Member
    Updated by Nagahashi Kouta

    Hi, srinivas rallabandi

    Are you familiar with Python?

    Use Python to read the set information file and exported query result file respectively, and match them according to the node ID.

    image

    This seems feasible.

    User: "srinivas rallabandi_21059"
    Altair Community Member
    OP
    Updated by srinivas rallabandi_21059

    Thank you So much Nagahashi, Let me give a try 

    User: "srinivas rallabandi_21059"
    Altair Community Member
    OP
    Updated by srinivas rallabandi_21059

    I tried with awk and sed bash script unfortunately it was taking either column or CSV format as my file format in the file-1.txt  is different than file-2.txt. As you see here it has to find a match on file-2.txt based on file-1.txt and assign value (SET N) to the file-2.txt.

     

    Unfortunately, there is no common field/column between these two files  :(

     

    File-<span class="hljs-number">1.</span>txt ---------- SET <span class="hljs-number">6</span> = <span class="hljs-number">11032</span>,<span class="hljs-number">13639</span>,<span class="hljs-number">13984</span>,<span class="hljs-number">13992</span> SET <span class="hljs-number">7</span> = <span class="hljs-number">14000</span>,<span class="hljs-number">14008</span>,<span class="hljs-number">14016</span>  File-<span class="hljs-number">2.</span>txt ---------- <span class="hljs-number">11032</span>, <span class="hljs-number">2.820E+02</span> <span class="hljs-number">13639</span>, <span class="hljs-number">2.490E+02</span> <span class="hljs-number">13984</span>, <span class="hljs-number">3.056E+02</span> <span class="hljs-number">13992</span>, <span class="hljs-number">3.172E+02</span> <span class="hljs-number">14000</span>, <span class="hljs-number">3.106E+02</span> <span class="hljs-number">14008</span>, <span class="hljs-number">2.819E+02</span> <span class="hljs-number">14016</span>, <span class="hljs-number">2.380E+02</span>  Desired Output -------------- SET <span class="hljs-number">6</span>,<span class="hljs-number">11032</span>, <span class="hljs-number">2.820E+02</span> SET <span class="hljs-number">6</span>,<span class="hljs-number">13639</span>, <span class="hljs-number">2.490E+02</span> SET <span class="hljs-number">6</span>,<span class="hljs-number">13984</span>, <span class="hljs-number">3.056E+02</span> SET <span class="hljs-number">6</span>,<span class="hljs-number">13992</span>, <span class="hljs-number">3.172E+02</span> SET <span class="hljs-number">7</span>,<span class="hljs-number">14000</span>, <span class="hljs-number">3.106E+02</span> SET <span class="hljs-number">7</span>,<span class="hljs-number">14008</span>, <span class="hljs-number">2.819E+02</span> SET <span class="hljs-number">7</span>,<span class="hljs-number">14016</span>, <span class="hljs-number">2.380E+02</span>
    User: "Nagahashi Kouta"
    Altair Community Member
    Updated by Nagahashi Kouta

    Sorry, I'm not familiar with awk and sed bash scripts. 

    It's easy to do this with python or tcl/tk scripts. 

    User: "srinivas rallabandi_21059"
    Altair Community Member
    OP
    Updated by srinivas rallabandi_21059

    Sorry, I'm not familiar with awk and sed bash scripts. 

    It's easy to do this with python or tcl/tk scripts. 

    what is the function you are using in Python for this 

     

    User: "srinivas rallabandi_21059"
    Altair Community Member
    OP
    Updated by srinivas rallabandi_21059

    I tried  half by reading my second file (File-2.txt)  as a dictionary 

    from openpyxl import load_workbook

    wb = load_workbook("file-2.xlsx")
    sheet1 = wb.worksheets[0]
    list_dict=[]
    dict={}
    for row_value in range(1,sheet1.max_row+1):
    dict.update({sheet1.cell(row=7,column=1).value:sheet1.cell(row=row_value, column=2).value})
    list_dict.append(dict)

    print(list_dict)

     

    Now I need  read file-1.txt , and create the output file by looking up the values in the dictionary