×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

export stress data of selected nodes, write macro

export stress data of selected nodes, write macro

export stress data of selected nodes, write macro

(OP)
hi,

im very new to ansys apdl. i want to export the forces and x-location of my previously selected nodes.

im very new to apdl-coding and therefore have no idea how to export it into a pdf via macro. i would even like it way more to directly write it into a .xml for excel.
i want to get the x-location and stresses Sxx, Szz, Sxy, Sxz. actually i need a path with the x-value starting from the first node but i think i can change the x-location data in excel to get that easily.
this is what i found so far:

FLST,5,3,4,ORDE,3
FITEM,5,29
FITEM,5,41
FITEM,5,-42
LSEL,S, , ,P51X
nsll,s,1
! selects my nodes on selected lines

*get,NCOUNT,node,,count
*dim,NARRAY,array,NCOUNT,5
/post1
set,last
*cfopen,temp,txt
*vwrite
('x-loc',8x,'Sxx',10x,'Szz',10x,'Sxz',10x,'Sxy')
*vget,NARRAY(1,1),node,1,loc,x
*vget,NARRAY(1,2),node,1,s,x
*vget,NARRAY(1,3),node,1,s,z
*vget,NARRAY(1,4),node,1,s,xz
*vget,NARRAY(1,5),node,1,s,xy
*vwrite,NARRAY(1,1),NARRAY(1,2),NARRAY(1,3),NARRAY(1,4),NARRAY(1,5)
finish

it doesnt work yet. i think i need *do and *endo commands but i have no idea how to implement them.

in another thread of this forum someone exported it directly into excel format:
*CFOPEN,C:\Temp\RESULTS_Face,xls,,
*VWRITE,
('X Y Z UX UY UZ USUM ROTX ROTY ROTZ ROTSUM')
*VWRITE,RESULTS_Face(1,1), RESULTS_Face(1,2), RESULTS_Face(1,3), RESULTS_Face(1,4), RESULTS_Face(1,5), RESULTS_Face(1,6), RESULTS_Face(1,7), RESULTS_Face(1,8), RESULTS_Face(1,9), RESULTS_Face(1,10), RESULTS_Face(1,11)
(F17.9,' ',F17.9,' ',F17.9,' ',F17.9,' ',F17.9,' ',F17.9,' ',F17.9,' ',F17.9,' ',F17.9,' ',F17.9,' ',F17.9)
*CFCLOS



can anyone help me with this? i need to do this for my master thesis and i have no clue about apdl coding :(

RE: export stress data of selected nodes, write macro

Hi,

I'm with the same problem, and I am astonished I cound't find answer on the internet yet.

Did you solve? Could you share the code?

Actually, I would like to export the coordinates and displacements of each node in order to make same analysis using Matlab

I started with the code below, but there're some mistakes


/OUTPUT MyOutput, txt
*GET, NoNodes, NODE, 0, COUNT !Get number of nodes
*DIM, MyTable, TABLE, NoNodes, 6, 1,,,,0 !Declare matrix to get coordinates and displacements

*DO, i, 1, NoNodes, 1

*vget,MyTable(i,1,1), NODE, i, LOC, X !Save Coord. X of node number i
*vget,MyTable(i,2,1), NODE, i, LOC, Y
*vget,MyTable(i,3,1), NODE, i, LOC, Z
*vget,MyTable(i,4,1), NODE, i, U, X !Save displacement X of node number i
*vget,MyTable(i,5,1), NODE, i, U, Y
*vget,MyTable(i,6,1), NODE, i, U, Z

*ENDDO

/OUTPUT

RE: export stress data of selected nodes, write macro

I also tried another code, this seems to be more simpple, but didn't work either.

*GET, NoNodes, NODE, 0, COUNT !Get number of nodes
*DO, I, 1, NoNodes,1
Set, I
*CFOPEN, OutputFile,txt
*VWRITE, NX(I), NY(I), NZ(I) !Save in a file
(G30.15, ' ',G30.15, ' ',G30.15, ' ',G30.15)
*VWRITE, UX(I), UY(I), UZ(I) !Save in a file
(G30.15, ' ',G30.15, ' ',G30.15, ' ',G30.15)
*CFCLOS
*ENDDO



RE: export stress data of selected nodes, write macro

And, finally, this one solved the problem:

*GET, NoNodes, NODE, 0, COUNT !Get number of nodes
*DIM, ANODES, TABLE, NoNodes, 6 !Declare table to save coordinates and displacements

*VGET, NODELIST, NODE, ALL, NLIST

*DO, J, 1, NoNodes,1
*GET, ANODES(J,1), NODE, NODELIST(J), LOC, X
*GET, ANODES(J,2), NODE, NODELIST(J), LOC, Y
*GET, ANODES(J,3), NODE, NODELIST(J), LOC, Z
*GET, ANODES(J,4), NODE, NODELIST(J), U, X
*GET, ANODES(J,5), NODE, NODELIST(J), U, Y
*GET, ANODES(J,6), NODE, NODELIST(J), U, Z
*ENDDO

/OUTPUT, OutputFile,TXT,,APPEND

*VWRITE, ANODES(1,1),ANODES(1,2),ANODES(1,3),ANODES(1,4),ANODES(1,5),ANODES(1,6)
(G30.15, ' ',G30.15, ' ',G30.15, ' ',G30.15, ' ',G30.15, ' ',G30.15)

/OUTPUT


But, pay attention to the following comment: this code works because I'm using APDL inside Workbench. When using just APDL, the seccond part (the VWRITE format) may not run, than, it can be necessary write this part inside another file and then import:


*GET, NoNodes, NODE, 0, COUNT !Get number of nodes
*DIM, ANODES, TABLE, NoNodes, 6 !Declare table to save coordinates and displacements

*VGET, NODELIST, NODE, ALL, NLIST

*DO, J, 1, NoNodes,1
*GET, ANODES(J,1), NODE, NODELIST(J), LOC, X
*GET, ANODES(J,2), NODE, NODELIST(J), LOC, Y
*GET, ANODES(J,3), NODE, NODELIST(J), LOC, Z
*GET, ANODES(J,4), NODE, NODELIST(J), U, X
*GET, ANODES(J,5), NODE, NODELIST(J), U, Y
*GET, ANODES(J,6), NODE, NODELIST(J), U, Z
*ENDDO

/OUTPUT, OutputFile,TXT,,APPEND

/INPUT, OtherCode, txt

/OUTPUT


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources