






Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.


connections_folder = ExtAPI.DataModel.Project.Model.Connections
joints = connections_folder.GetChildren(DataModelObjectCategory.Joint,True)
nb_joints = 0
for j in joints:
if j.Suppressed is False:
nb_joints += 1
with Transaction():
new_snippet = j.AddCommandSnippet()
string1 = 'joint_'+str(nb_joints) + ' = _jid \n'
string2 = '*DIM,joint_name_'+str(nb_joints)+',string,248 \n'
string3 = 'joint_name_'+str(nb_joints) + '(1) = \'' + j.Name + '\'\n'
new_snippet.AppendText(string1)
new_snippet.AppendText(string2)
new_snippet.AppendText(string3)
new_snippet.AppendText("nb_joints = " + str(nb_joints))
ExtAPI.DataModel.Tree.Refresh()

joint_1 = _jid ! Retrieve element type number that is used by MAPDL solver
*DIM,joint_name_1,string,248 ! Create an MAPDL array to store joint name
joint_name_1(1) = 'Spherical - SYS-11\Surface To SYS-11\Surface' ! Retrieve joint name from Mechanical and store it in the MAPDL array


/POST1 ! Enter general post-processor
/out,outputfile,txt ! Redirect output to outputfile.txt
/out
SET,LAST ! Consider last time step
ALLS ! Select all model
RSYS,solu ! Use solution coordinate system
*do,i,1,nb_joints !Loop over all joints in model
ESEL,S,TYPE,,joint_%i% ! Select element accounting for joint n°i
NSLE ! Select nodes attached to element
*GET,Nnumero1,NODE,,num,min ! Get “I” node of element (first node)
*GET,loc_X%i%,NODE,Nnumero1,LOC,X ! Get X location of node
*GET,loc_Y%i%,NODE,Nnumero1,LOC,Y ! Get Y location of node
*GET,loc_Z%i%,NODE,Nnumero1,LOC,Z ! Get Z location of node
*GET,staticFX%i%,elem,elnext(0),SMISC,1 ! Get FX on node
*GET,staticFY%i%,elem,elnext(0),SMISC,2 ! Get FY on node
*GET,staticFZ%i%,elem,elnext(0),SMISC,3 ! Get FZ on node
*GET,staticMX%i%,elem,elnext(0),SMISC,4 ! Get MX on node
*GET,staticMY%i%,elem,elnext(0),SMISC,5 ! Get MY on node
*GET,staticMZ%i%,elem,elnext(0),SMISC,6 ! Get MZ on node
/out,outputfile,txt,,append ! Append outputfile.txt and write a table with Joint Name in Mechanical and FX, FY, FZ, MX, MY, MZ reaction forces.
*vwrite,joint_name_%i%(1),joint_name_%i%(9),joint_name_%i%(17),joint_name_%i%(25),joint_name_%i%(33),joint_name_%i%(41),Nnumero1,loc_X%i%,loc_Y%i%,loc_Z%i%,staticFX%i%,staticFY%i%,staticFZ%i%,staticMX%i%,staticMY%i%,staticMZ%i%
(6(A8),F12.0,10(F12.1))
/out
*enddo


Was this page helpful?