-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIdentifyJointInModel.cls
119 lines (99 loc) · 3.57 KB
/
IdentifyJointInModel.cls
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
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "IdentifyJointInModel"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
'@Folder("Operation.ConnAnalysis")
Private mCompleteMessageAddition As String
Private mTerminateMessageMain As String, mTerminateMessageAddition As String
Private mModel As StrModel
Private mDsSys As DataSheetSystem
Public Function Main(Optional isShowMsgBox As Boolean = True) As Integer
Dim ret As Integer
ret = CheckDataBeforeStart
If Not ret = 0 Then
GoTo ExitFunction
End If
g_log.WriteLog "Model Connection Identification Started."
FormStrObj
IdentifyConn
WriteData
mDsSys.prop("isCreated", "isIdentifiedConn") = True
g_log.WriteLog "Model Connection Identification Completed."
ExitFunction:
Main = ret
End Function
Private Sub Class_Initialize()
Set mModel = New StrModel
Set mDsSys = New DataSheetSystem
End Sub
Private Function CheckDataBeforeStart() As Integer
Application.Calculate
If Not mDsSys.prop("WhatOperationCanProcess", "IdentifyRestraint") Then
mTerminateMessageMain = "Not Sufficient Data to carry out the process!!"
CheckDataBeforeStart = -1
End If
End Function
Private Sub FormStrObj()
Dim ret As Integer
ret = mModel.Constructor.FormJointObj
ret = mModel.Constructor.FormFrmObj
ret = mModel.Constructor.FormMemberObj
End Sub
Private Sub IdentifyConn()
'Criteria for connection
'1. a joint with restraint
'2. a joint with more than 2 frames connecting to it.
'3. 2 frames -> different sections
'4. 2 frames -> 2 different members
'Splice joint with the same section cannot be identified by this sub
Dim i As Long
Dim jt As Variant, jts As Collection
Dim frms As Collection
Set jts = mModel.joints
For Each jt In jts
Set frms = jt.connectedFrames
If frms Is Nothing Then
g_log.WriteLog "Joint ID: " & jt.Name & "; Nos. of Connected Frames = 0; isConnection = False"
GoTo NextIteration
End If
If jt.isRestraint Then
jt.isConn = True
ElseIf frms.count > 2 Then
jt.isConn = True
ElseIf frms.count = 2 Then
If Not (frms(1).section = frms(2).section) Or Not (frms(1).memberName = frms(2).memberName) Then
jt.isConn = True
End If
End If
'save restraint result to members properties
g_log.WriteLog "Joint ID: " & jt.Name & "; Nos. of Connected Frames = " & frms.count & "; isConnection = " & jt.isConn
NextIteration:
Next
End Sub
Private Sub WriteData()
Dim dsConn As oDataSheet
Dim dsManager As DataSheetManager
Set dsManager = New DataSheetManager
Set dsConn = dsManager.DSJointConnectivity
Dim df As clsDataFrame
Set df = mModel.GetDataframe(obj_jt, "name", "connectedMembersStr", "connectedFramesStr", "connectedFramesSectionStr", "isRestraint", "isConn")
dsConn.ClearData
g_log.WriteLog "Writing result to Worksheets...."
With dsConn.tagSelector
dsConn.WriteDataframe df, True, False, .jtID, .memID, .eleID, .sections, .isRestraint, .isConn
End With
End Sub
Public Property Get CompleteMessageAddition() As String
CompleteMessageAddition = mCompleteMessageAddition
End Property
Public Property Get TerminateMessageMain() As String
TerminateMessageMain = mTerminateMessageMain
End Property
Public Property Get TerminateMessageAddition() As String
TerminateMessageAddition = mTerminateMessageAddition
End Property