forked from bguest/ansys-macros
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_AGEN_KTK.mac
83 lines (71 loc) · 1.88 KB
/
_AGEN_KTK.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
!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
!_AGEN_KTK.mac
!B.GUEST: [email protected]
!DESCRIPTION: Creates an area using the offset from one
! keypoint to another
!PRECONDITIONS:
! ARG1 = Area to be offset
! ELSE: User is asked to select areas
! ARG2 = First Keypoint
! ELSE: User is asked to select keypoint 1
! ARG3 = Second Line
! ELSE: User is asked to select keypoint 2
!POSTCONDITIONS'S
! Line created with offset from keypoint 1 to
! keypoint 2
!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
/PREP7
CM,temp_KP,KP
CM,temp_AREA,AREA
!GET INPUT=============================================
!Get Areas --------------------------
*IF,ARG1,EQ,0,THEN
*MSG, UI
Select Areas
ASEL,R,P
KTKAreas= $ *vget,KTKAreas,AREA,,alist
KTKNumAreas= $ *GET,KTKNumAreas,AREA,0,count !Number of areas
CMSEL,A,temp_AREA
*ELSE
KTKAreas= $ *dim,KTKAreas,array,1
KTKNumAreas= $ KTKNumAreas = 1
*ENDIF
!GET First KeyPoint------------------
*IF,ARG2,EQ,0,THEN
*MSG,UI
Select First Keypoint
KSEL,R,P
kp1= $ *GET,kp1,KP,0,NUM,MAX !Get first keypoint number
CMSEL,A,temp_KP
*ELSE
kp1= $ kp1=ARG2
*ENDIF
!GET Second KeyPoint------------------
*IF,ARG2,EQ,0,THEN
*MSG,UI
Select Second Keypoint
KSEL,R,P
kp2= $ *GET,kp2,KP,0,NUM,MAX !Get second keypoint number
CMSEL,A,temp_KP
*ELSE
kp2= $ kp2=ARG2
*ENDIF
!CREATE LINE======================================
P1= $ *DIM,P1,ARRAY,3
*GET,P1(1),KP,KP1,LOC,X !GET LOCATION OF KP1
*GET,P1(2),KP,KP1,LOC,Y
*GET,P1(3),KP,KP1,LOC,Z
P2= $ *DIM,P2,ARRAY,3
*GET,P2(1),KP,KP2,LOC,X !GET LOCATION OF KP2
*GET,P2(2),KP,KP2,LOC,Y
*GET,P2(3),KP,KP2,LOC,Z
KTKOff = $ *DIM,KTKOff,ARRAY,3 !GET OFFSET
*DO,i,1,3
KTKOff(i)= P2(i)-P1(i)
*ENDDO
!USE LGEN TO CREATE LINE.
*do,i,1,KTKNumAreas
AGEN,2,KTKAreas(i),,,KTKOff(1),KTKOff(2),KTKOff(3)
*enddo
!======THE--END========THE--END========THE--END=========
!ITS THE END OF THE MACRO AS WE KNOW IT, AND I FEEL FINE