forked from bguest/ansys-macros
-
Notifications
You must be signed in to change notification settings - Fork 0
/
KLMPC.mac
129 lines (122 loc) · 3.37 KB
/
KLMPC.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
!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
!KLMPC.mac
!B.GUEST benguest@gmail.com
!DESCRIPTION: This macro creates a "spider web" of
! MPC184 rigid element between a meshed line and a KP
!PRECONDITIONS:
! KLMPC,Keypoint,Line,Link?,Lagrange?
! Keypoint to be used has not been KMESHed
! NEEDS:
! ATT.mac
! Arguments:
! ARG1 = Keypoint for Spiderweb Center
! ELSE: User is requested to enter Keypoint
! ARG2=Line for ends of spider web
! ELSE user is prompted to select line
! ARG3 = Constraint Type
! 0 --> Rigid Beam (6DOF Constrained per Node)
! 1 --> Rigid Link (3DOF Constrained per Node)
! ARG4 = Constraint Type
! 0 --> Direct Elimination Method
! 1 --> Lagrange Multiplier Method
!POSTCONDITIONS:
! Elements Created / Modified:
! Element type 997-994 = MPC184
! Element type 998 = "Zero" MASS21
!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
Save,saved,db,,ALL
CM,temp_KP,KP
CM,temp_LINE,LINE
CM,temp_NODE,NODE
CM,temp_ELEM,ELEM
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
!MATERIALS
/PREP7
!======================================================
!998.MASS21: TEMP MASS
!======================================================
MatNum = 998
!-------------------Mass Properties---------------
MASS = 0.0
!-------------------------------------------------
ET,MatNum,MASS21
KEYOPT,MatNum,3,2 !3-D mass w/o rotary inertia
R,MatNum,MASS,MASS,MASS
!------------------Dumbie Material-----------------
MP,DENS,MatNum,0.0
!======================================================
MatNum = 997-1*ARG3-2*ARG4 !MPC184: Rigid Link
!------------------------------------------------------
ET,MatNum,MPC184
KEYOPT,MatNum,1,1-ARG3 !LINK / BEAM
KEYOPT,MatNum,2,ARG4 !Constraitn TYpe
R,MatNum !No Real Constants
MP,ALPX,MatNum,0.0 !CTE
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
!Get Things
!--------------------------GET KP
*IF,ARG1,EQ,0,THEN
*MSG,UI
Select Keypoints
KSEL,R,P
*ELSE
KSEL,S,,,ARG1
*ENDIF
CM,KP_Sel,KP
CMSEL,S,temp_KP
!---------------------------GET LINES
*IF,ARG2,EQ,0,THEN
*MSG,UI
Select Lines
LSEL,R,P
*ELSE
LSEL,S,,,ARG2
*ENDIF
CM,Line_Sel,Line
CMSEL,S,temp_Line
!================FOR SET OF KPs========================
CMSEL,S,KP_Sel !Select Keypoints
*GET,KP_high,KP,0,NUM,MAX !GET HIGHEST KP NUMBER IN SEL
!-------GET KP1 LOCATION
KSUM !GET KP INFO
*GET,centX1,KP,0,CENT,X
*GET,centY1,KP,0,CENT,Y
*GET,centZ1,KP,0,CENT,Z
!-----------CHECK TO SEE IF ONLY ONE KP SELECTED
*GET,KP_count,KP,0,COUNT !GET NUMBER OF NODES
*IF,KP_Count,EQ,1,THEN
KP1=KP_High
*ELSE !-------Create New KP at KP Centroid Location
KP1=KP_max+1
KSEL,NONE
K,KP1,centX1,centY1,centZ1
*ENDIF !-------------------------------------------
!--------------MESH KP1
KSEL,S,,,KP1
KCLEAR,ALL
KATT,998,998,998
ESEL,NONE
KMESH,ALL
NSLE
*GET,Master,NODE,,NUM,MAX !Get Master Node
CMSEL,S,Line_Sel !Select Lines to be "spider-webed"
NSLL,S,1 !Select nodes on line
ATT,997-1*ARG3-2*ARG4
*GET,NumND,NODE,0,COUNT
*VGET,L1ND,NODE,,NLIST !V11.0
*DO,ink,1,NumND !CREATE SPIDER
E,Master,L1ND(ink)
*ENDDO
!=======================CLEAN UP=========================
!--RESUME TEMPORARY COMPONENTS
CMSEL,A,temp_NODE
CMSEL,A,temp_LINE
CMSEL,A,temp_KP
CMSEL,A,temp_ELEM
!--Clear Parameters
!*SET,loop
*SET,A1ND
*SET,NumND
*SET,KP1
!======THE--END========THE--END========THE--END========
!ITS THE END OF THE MACRO AS WE KNOW IT AND I FEEL FINE