You are on page 1of 2

ANSYS Truss - Variable Geometry

This is quite a general command file that prompts for the geometry, material properties
and loading of a truss shown below. It also contains a parameter Ndiv that permits a
variable number of truss divisions to be used along length b. For the figure below, Ndiv
= 2.

/title, Variable Truss
!
! Define constants and variables:
!
Nl = 0 ! Loop Counter
*ASK,a,Truss Height (Default = 40),40 ! Height of
trusses
*ASK,b,Length of Main Division (Default = 120),120 ! Length of truss
divisions
*ASK,c,Base Length of End Truss (Default = 24),24 ! Base of end
truss
*ASK,F,Force at End of Truss (Default = -20000),-20e3 ! Force at end of
truss
*ASK,E,Youngs Modulus (Default = 30000000),30e6 ! Youngs
Modulus
*ASK,Area,Cross-sectional Area (Default = 1),1 ! Area of
members
*ASK,Ndiv,Number of truss divisions (Default = 2),2 ! Number of Truss
Divisions
!
/PREP7 ! Pre-processing
!
*DO,Nl,0,Ndiv,1 ! Define elements in a DO-LOOP
K,2*Nl+1,Nl*b/Ndiv,0,0 ! Lower keypoint
K,2*Nl+2,Nl*b/Ndiv,A,0 ! Upper keypoint
*ENDDO
K,2*Ndiv+3,(b+c),0,0 ! End truss
!
L,1,2 ! Connect the first two keypoints
*DO,Nl,1,Ndiv,1 ! Draw Lines from keypoint to keypoint
L,2*Nl+1,2*Nl+2 ! Vertical member
L,2*Nl-1,2*Nl+1 ! Lower horizontal member
L,2*Nl,2*Nl+2 ! Upper horizontal member
L,2*Nl-1,2*Nl+2 ! Diagonal member
*ENDDO
L,2*Ndiv+1,2*Ndiv+3 ! Horizontal member of end truss
L,2*Ndiv+2,2*Ndiv+3 ! Diagonal member of end truss
!
! Define the element type and define properties
!
ET,1,LINK1 ! Simple spring element
R,1,Area,0 ! Real Constants (Material 1): AREA = Area
MP,EX,1,E ! Material Properties (Material 1): Young's
Moduls = E
LESIZE,ALL, , ,1,1,1 ! One element per line
LMESH,ALL ! Mesh all lines
!
FINISH ! Done pre-processing
!
/SOLU ! Open Solver Mode
!
! Apply Constraints: (to keypoints)
!
DK,1,UX,0,0 ! Keypoint 1 cannot move in the X direction
DK,2,UX,0,0 ! Keypoint 2 cannot move in either the X or Y
directions
DK,2,UY,0,0
!
! Apply force loads: (to keypoints)
!
FK,2*Ndiv+3,FY,F ! Load at the end of the truss assembly is F
!
SOLVE ! Finished, solve the load assembly

You might also like