/BATCH,list
/FILNAME,adamsout ! Define jobname
/TITLE,Export flexible component to ADAMS
!
/PREP7 ! Enter preprocessor
!
! Define Parameters of rectangular rod
radh=6 ! Radius of the holes in the rod
thick=10 ! Rod thickness
width=25 ! Rod width
length=300+4*radh ! Rod length
! Build geometry
RECTNG,0,length,0,width
CYL4,2*radh,width/2,radh
CYL4,length-2*radh,width/2,radh
ASBA,1,2
ASBA,4,3
VEXT,1, , ,0,0,thick
!
ET,1,solid45 ! Define SOLID45 as element type 1
ET,2,beam4 ! Define BEAM4 as element type 2
!
MP,EX,1,7.22e4 ! Material of the rectangular rod
MP,PRXY,1,0.34
MP,DENS,1,2.4e-9
!
MP,EX,2,2.1e5 ! Material of the beams used for the spider web
MP,PRXY,2,0.3
MP,DENS,2,0.1e-9
!
R,1,78.528,490.67,490.67,10,10 ! Real constant for BEAM4
RMORE,,,0.85716,0.85716,
!
TYPE,1 ! Set element type attribute pointer to 1
MAT1,1 ! Set material attribute pointer to 1
ESIZE,thick/3,0, ! Define global element size
VSWEEP,1 ! Mesh rod
!
! Define interface points: numbers must be higher than highest
! node number already defined
N,100000,2*radh,width/2,thick/2 ! Define interface point 1
N,100001,length-2*radh,width/2,thick/2 ! Define interface point 2
!
NWPAVE,100000 ! Set working plane to interface point 1
WPSTYL,,,,,,1 ! Set working plane type to cylindrical
CSYS,4 ! Activate working plane
NSEL,S,LOC,X,radh ! Select nodes on cylindrical hole
NSEL,A,,,100000 ! Also select interface node
!
! Generate spider web of beams
*GET,nmin,node,,num,min
*GET,nnum,node,,count
*SET,jj,0
TYPE,2
MAT,2
REAL,1
*DO,jj,1,nnum-2
E,100000,nmin
NSEL,u,,,nmin
*GET,nmin,node,,num,min
*ENDDO
!
ALLS
!
NWPAVE,100001 ! Set working plane to interface point 2
WPSTYL,,,,,,1 ! Set working plane type to cylindrical
CSYS,4 ! Activate working plane
NSEL,S,LOC,X,radh ! Select nodes on cylindrical hole
NSEL,A,,,100001 ! Also select interface node
!
! Generate spider web of beams
*GET,nmin,node,,num,min
*GET,nnum,node,,count
*SET,jj,0
TYPE,2
MAT,2
REAL,1
*DO,jj,1,nnum-2
E,100001,nmin
NSEL,u,,,nmin
*GET,nmin,node,,num,min
*ENDDO
!
ALLS
!
/UNITS,MPA ! Define units used: millimeter
! megagram, second, newton
SAVE ! Save database
NSEL,s,,,100000,100001 ! Select interface points
ADAMS,20,1 ! Start ADAMS macro,
! adamsout.mnf is written
FINISH
/EXIT,nosave
代码,不是原创,就是help中的一个例子,很容易找到,在help里搜adams,就可以看到12.8. Sample Rigid Body Dynamic Analysis了,以前用mass21建立约束方程来做,基本上都失败,现在用Beam连接来做,对单个零件都全能成功 |