• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

insert body id into a postscript

  • Thread starter Thread starter folle76
  • Start date Start date

folle76

Guest
Hello, everyone! I have this script working to table in a .txt item number, stress and coordinates.
How do I insert a new column with body id since it is a simulation of a set?
Thank you very much.

Allsel,all
set,1
!creo an element table with the volume of the elements
avprin,0,
etable,volume,volu,
!creo an element table with equivalent stress for each element
avprin,0,
etable,streqv,s,eqv
!creo an element table with equivalent stress for each element
avprin,0,
etable,x,cent,x
!creo an element table with equivalent stress for each element
avprin,0,
etable,y,cent,y
!creo an element table with equivalent stress for each element
avprin,0,
etable,z,cent,z
Reverse in two arrays the value of the newly created two element tables
*vget,volume,elem,1,etab,volume, ,2
*vget,stress,elem,1,etab,streqv, ,2
*vget,x,elem,1,etab,x,2
*vget,y,elem,1,etab,y,2
*vget,z,elem,1,etab,z,2
!write on pippo.txt i 3 arrays, the first contains the element number
!the second volume, the third stress
*cfopen,'wll_021010,'txt,'
*vwwrite
(' element , volume2 , stress ', ' x ', ' y ', ' z ')
*vwrite,sequ,volume(1,1),stress(1,1),x(1,1),y(1,1),z(1,1)
(f10.0,',f30.18,';',f30.18,';',f30.18,';',f30.18,';',f30.18.
 
I assume you're working with classic ansys (mapdl).

I think of a somewhat complex and extremely inefficient way that allows you to do this
!cycle for a million times until, starting from an element, select all the knots and elements of a body
*do,i,1,1000000
Nodes attached to the elements
esln!select the elements attached to the knots
*end
Ksln!select keypoints attached to knots
lslk!select lines attached to keypoints
asll!select areas attached to lines
vsla!select volumes attached to areas
try to imagine these clicks for each element of your table. . It's suicide! !

as it suggests volaff take your model in hand, and for each volume do (involume is the volume number,component name is the unique name cheques to the elements associated with a single volume):
vsel,s,,nvolume
allsel,below,volu
cm,nomecomponente,elem
then in postprocessing phase change your code accordingly
 
hi stefano, unfortunately I do not have the appropriate knowledge to implement your solution. I use the workbench and the script that I copied-paste over is practically yours. You generated it for me about two years ago.
Could you tell me a little?

vsel,s, involume (What should I put in place of nvolume? )Allsel,below,volu
cm,component name (What do I have to put in place as a component name? )
set,1
!creo an element table with the volume of the elements
avprin,0,
etable,volume,volu,
!creo an element table with equivalent stress for each element
avprin,0,
etable,streqv,s,eqv
!creo an element table with equivalent stress for each element
avprin,0,
etable,x,cent,x
!creo an element table with equivalent stress for each element
avprin,0,
etable,y,cent,y
!creo an element table with equivalent stress for each element
avprin,0,
etable,z,cent,z
Reverse in two arrays the value of the newly created two element tables
*vget,volume,elem,1,etab,volume, ,2
*vget,stress,elem,1,etab,streqv, ,2
*vget,x,elem,1,etab,x,2
*vget,y,elem,1,etab,y,2
*vget,z,elem,1,etab,z,2
!write on pippo.txt i 3 arrays, the first contains the element number
!the second volume, the third stress
*cfopen,'wll_021010,'txt,'
*vwwrite
(' element , volume2 , stress ', ' x ', ' y ', ' z ')
*vwrite,sequ,volume(1,1),stress(1,1),x(1,1),y(1,1) ,z(1,1)
(f10.0,';',f30.18,';',f30.18,';',f30.18,';',f30.18,';',f30.18.
 
I'm sorry to bother you until I'm exhausted. . .
but by component name can I put sch-3906-rrr, but by nvolume?
thanks to allCattura.webp
 
the problem is that I do not understand the difference between component and volume. I'm the same in my mind...
 
Of course not. otherwise I would have already figured out what to put. the script runs without errors by inserting aleatori numbers for the volume but gives the result for all the elements of the axieme, does not return the result only for the elements of the component.
 
Hello crowd76

I see you are working in workbench, so the situation from a certain point of view simplifies.
you need to work on groups of elements subdivided body by body. . .
then, on the tree on the left, in geometry, for each body of your set click with the right mouse button and add a "command snippet".2016-06-06_17-42-43.webpin the snippet command go to write what is indicated in the figure.

Why this thing? workbench works with a "geometric ring" different from that of classic ansys, then goes to meshare the bodies with a meshatore different from classic ansys, but when it has to launch the simulations the underlying "motor" is always the same.
This "motor" however only sees groups of knots and elements, but not lines, areas and volumes.

the snippet command that you will insert on each body will go to create a "component", that is a set of elements for each body. is more or less equivalent to:

vsel,s, involume
Allsel,below,volu
cm,component name ,elem

in our case you will have a series of components called "component1", " component2" etc...

these components will then be visible to the other script you entered in the postprocessing phase.

I hope I've been clear enough, now you have to try!!!
 
Thanks stefano. Unfortunately I miss the final step. while I know the vba I have to say that I find this language ostico, even if I have not compulsed the guide to the bottom.
from what I understood in the postscript I can find a column with the name of the component I created in the prescript.
then select all the elements again and create an additional column with the component name, but how? Thanks again and good we!!

Allsel,all
set,1
!creo an element table with the volume of the elements
avprin,0,
etable,volume,volu,
!creo an element table with equivalent stress for each element
avprin,0,
etable,streqv,s,eqv
!creo an element table with x for each element
avprin,0,
etable,x,cent,x
!creo an element table with y for each element
avprin,0,
etable,y,cent,y
!creo an element table with z for each element
avprin,0,
etable,z,cent,z
Reverse in two arrays the value of the newly created two element tables
*vget,volume,elem,1,etab,volume, ,2
*vget,stress,elem,1,etab,streqv, ,2
*vget,x,elem,1,etab,x,2
*vget,y,elem,1,etab,y,2
*vget,z,elem,1,etab,z,2
!write on pippo.txt i 3 arrays, the first contains the element number
!the second volume, the third stress, the fourth x, the fifth y, the sixth la z
*cfopen,'wll,'txt,'
*vwwrite
(' element , volume2 , stress ', ' x ', ' y ', ' z ')
*vwrite,sequ,volume(1,1),stress(1,1),x(1,1),y(1,1) ,z(1,1)
(f10.0,';',f30.18,';',f30.18,';',f30.18,';',f30.18,';',f30.18.
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top