forked from bguest/ansys-macros
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LKMPC.mac
98 lines (89 loc) · 2.48 KB
/
LKMPC.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
!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
!LKMPC.mac
!DESCRIPTION: This macro creates a "Spider Web" of
! MPCs from a Keypoint to a line or lines
!PRECONDITIONS:
! AKMPC,Keypoint,Line,Beam,Lagrange
! Arguments:
! ARG1 = Keypoint for Spiderweb Center
! ELSE: User is requested to enter Keypoint
! ARG2 = First Line OR <0 for ALL Selected Areas
! ELSE: User is requested to select lines
! ARG3 = Constraint Type
! 0 --> Rigid Link (3DOF Constrained per Node)
! 1 --> Rigid Beam (6DOF Constrained per Node)
! ARG4 = Constraint Type
! 0 --> Direct Elimination Method
! 1 --> Lagrange Multiplier Method
!POSTCONDITIONS:
! Elements Created / Modified:
! Element type 997 = MPC184
! Element type 998 = "Zero" MASS21
! See Description...
!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
CM,temp_node,NODE
CM,temp_elem,elem
CM,temp_line,AREA
CM,temp_KP,KP
/prep7
!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
!MATERIALS
!======================================================
MatNum = 997 !MPC184: Rigid Link
!------------------------------------------------------
ET,MatNum,MPC184
KEYOPT,MatNum,1,ARG3 !LINK / BEAM
KEYOPT,MatNum,2,ARG4 !Constraitn TYpe
R,MatNum !No Real Constants
MP,ALPX,MatNum,0.0 !CTE
!======================================================
MatNum = 998 !MASS21: TEMP MASS
!======================================================
ET,MatNum,MASS21
R,MatNum,0.0,0.0,0.0
!------------------Dumbie Material-----------------
MP,DENS,MatNum,0.0
!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
!GET MASTER KEYPOINT
*IF,ARG1,EQ,0,THEN
*MSG,UI
Select Master Keypoint
KSEL,R,P
*GET,masterKP,KP,O,NUM,MAX !Get Highest Selected KP
*ELSE
MasterKP = ARG1
*ENDIF
!GET Lines
*IF,ARG2,EQ,0,THEN
*MSG,UI
Select Lines
LSEL,R,P
*ELSEIF,ARG2,GT,0,THEN
LSEL,S,,,ARG2
*ENDIF !ELSE ASSUME AREAS ARE SELECTED
!Create Element at Keypoint
ESEL,none
ATT,998
KMESH,masterKP !Mesh Node
NSLE
*GET, masterNode, NODE, 0, NUM, MAX, ,
!Get List of Nodes on Surface
NSLL,S,1 !Select Nodes
NSEL,U,,,masterNode
*GET,countNodes,NODE,,Count
nodeNum= $ *VGET,nodeNum,NODE,,NLIST
!Create Spider Web
NSEL,A,,,masterNode !Reselect MasterNode
ATT,997
*do,i,1,countNodes
NDIST,masterNode,nodeNum(i) !MAKE SURE ELEMENT HAS
*IF,_return,GT,0,THEN !^Length
E,masterNode,nodeNum(i)
*ENDIF
*ENDDO
CMSEL,A,temp_line
CMSEL,A,temp_KP
CMSEL,A,temp_Node
cmsel,a,temp_elem
!======THE--END========THE--END========THE--END========
!ITS THE END OF THE MACRO AS WE KNOW IT AND I FEEL FINE