forked from bguest/ansys-macros
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ARIG2.mac
144 lines (129 loc) · 3.03 KB
/
ARIG2.mac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/PMACRO
!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
!ARIG2.MAC
!DESCRIPTION: THIS MACRO CREATES A RIGID ELEMENT WITH
! A NODE AT THE CENTER OF THE KEYPOINTS OF THE AREA
!PRECONDITIONS:
! ARG1 = Number of the first area
! ELSE = user propted to select areas
! ARG2 = Number of the last area
! ARG3=Number of rigid regions to be created
!POSTCONDITIONS:
! Master = Node number of base node
! See Description.
!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
SAVE,saved,db,,ALL
CM,temp_AREA,AREA
CM,temp_LINE,LINE
CM,temp_KP,KP
CM,temp_NODE,NODE
CM,temp_ELEM,ELEM
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
!MATERIALS
/PREP7
!======================================================
!998.MASS21: TEMP MASS
!======================================================
MatNum = 998
!-------------------Mass Properties---------------
MASS = 0.0
!-------------------------------------------------
ET,MatNum,MASS21
R,MatNum,MASS,MASS,MASS
!------------------Dumbie Material-----------------
MP,DENS,MatNum,0.0
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
!--------------Set NUMBER OF ARIGs
*IF,ARG3,EQ,0,THEN
loop=1
*ELSE
loop=ARG3
*ENDIF
*DOWHILE,loop
*GET,KP_max,KP,0,NUM,MAXD !GET MAX KP NUMBER
!------------------SELECT AREAS 1
*IF,ARG1,EQ,0,THEN
*MSG,UI
SELECT 1st AREA
ASEL,S,P
*ELSE
Area1=ARG1
Area2=ARG2
ASEL,S,,,Area1,,Area2
*ENDIF
CM,A1_Area,AREA
!================FOR SET OF AREAS=====================
CMSEL,S,A1_Area !SELECT AREAS
LSLA
KSLL !GET KP associated with AREAS
*GET,KP_high,KP,,NUM,MAX !GET HIGHEST KP NUMBER IN SEL
!-------GET KP CENTROID LOCATION
KSUM !GET KP INFO
*GET,centX1,KP,0,CENT,X
*GET,centY1,KP,0,CENT,Y
*GET,centZ1,KP,0,CENT,Z
!-------Create New KP at KP Centroid Location
KP1=KP_max+1
KSEL,NONE
K,KP1,centX1,centY1,centZ1
KATT,998,998,998
KMESH,ALL
CM,A1_KP,KP
CM,A1_Line,LINE
CM,A1_ELEM,ELEM
CM,A1_NODE,NODE
!-------CREATE "ARIG"
*GET,Master,NODE,,NUM,MAX
NSEL,S,,,Master
NSLA,A,1
*ASK,ans,ENTER 0 to stop or 1 to try again,2
*IF,ans,EQ,0,THEN
loop=0
*ELSEIF,ans,EQ,2,THEN
CERIG,Master,ALL,ALL,
loop=loop-1
*ENDIF
!=======================CLEAN UP=======================
!--RESUME TEMPORARY COMPONENTS
CMSEL,S,temp_AREA
CMSEL,S,temp_LINE
cMSEL,S,temp_KP
CMSEL,S,temp_NODE
CMSEL,S,temp_ELEM
CMSEL,A,A1_LINE
CMSEL,A,A1_KP
CMSEL,A,A1_ELEM
CMSEL,A,A1_NODE
*ENDDO
!--DELETE TEMPORARY COMPONENTS
CMDELE,temp_VOLU
CMDELE,temp_AREA
CMDELE,temp_LINE
CMDELE,temp_KP
CMDELE,temp_ELEM
CMDELE,temp_NODE
CMDELE,A1_LINE
CMDELE,A1_KP
CMDELE,A1_ELEM
CMDELE,A1_NODE
*SET,AA
*SET,centX1
*SET,centY1
*SET,centZ1
*SET,KP_MAX
*SET,KP_HIGH
*SET,KP1
!*SET,Master !SO CAN BE USED
*SET,TKZ
*SET,TKY
*SET,IXX
*SET,IYY
*SET,IZZ
*SET,TH
*SET,ISTRN
*SET,SHEARZ
*SET,SHEARY
*SET,SPIN
*SET,ADDMAS
!======THE--END========THE--END========THE--END========
!ITS THE END OF THE MACRO AS WE KNOW IT AND I FEEL FINE