Professional Documents
Culture Documents
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
RamDataAcc1 As RAMDATAACCESSLib.RamDataAccess1
RamDataAccIDBIO As RAMDATAACCESSLib.IDBIO1
IModel As RAMDATAACCESSLib.IModel
ISteelCriteria As RAMDATAACCESSLib.ISteelCriteria
IModelData1 As RAMDATAACCESSLib.IModelData1
IStories As RAMDATAACCESSLib.IStories
IStory As RAMDATAACCESSLib.IStory
IBeams As RAMDATAACCESSLib.IBeams
IBeam As RAMDATAACCESSLib.IBeam
pStartPoint As RAMDATAACCESSLib.SCoordinate
pEndPoint As RAMDATAACCESSLib.SCoordinate
dVersion As Double
dVMin As Double
'Long
Dim R As Long
Dim lNumMems As Long
Dim lNumStories As Long
Dim lStory As Long
Dim lMem As Long
Dim lNumCants As Long
Dim lMemberID As Double
Dim plNumStudSegments As Long
Dim lSizeOfArrayOfStuds As Long
Dim lTotalStuds As Long
Dim lStudSeg As Long
Dim i As Long
Dim lNumPoints As Long
Dim lPoint As Long
Dim lStoryUID As Long
Dim NumFinalPolygons As Long
Dim lFinalPolygon As Long
Dim NumFinalDiaphragms As Long
Dim lHole As Long
Dim lFirstSpace As Long
Dim j As Long
Dim lNumWebOpenings As Long
Dim lBasePlate As Long
Dim lFixity As Long
Dim lAboveUID As Long
Dim lSplice As Long
Dim lLoadDB As Long
Dim palNumStuds() As Long
'Double
Dim dMemLength As Double
Dim pdArea As Double
Dim pdBfTop As Double
Dim pdBfBot As Double
Module1 - 2
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
pdTfTop As Double
pdTfBot As Double
pdDepth As Double
pdWebT As Double
dSectionPerimeter As Double
dX1 As Double
dY1 As Double
dZ1 As Double
dX2 As Double
dY2 As Double
dZ2 As Double
dPerimeterLength As Double
dConcThick As Double
dPolygonArea As Double
dHoleArea As Double
dP1X As Double
dP2X As Double
dP3X As Double
dP1Y As Double
dP2Y As Double
dP3Y As Double
dP1Z As Double
dP2Z As Double
dP3Z As Double
dP1P2 As Double
dP2P3 As Double
dP1P3 As Double
dTemp As Double
dWeight As Double
dUnitsFactor As Double
dDesignCamber As Double
Dim
Dim
Dim
Dim
Dim
Dim
A As Double
B As Double
c As Double
dAngle As Double
dM1 As Double
dM2 As Double
'Enumerators
Dim eBeamCoordLoc As eBeamCoordLoc
Dim peBeamStatus As model_status
Dim peColumnStatus As model_status
Dim peFrameStatus As model_status
Dim peShape As ESTEEL_SEC
'Strings
Dim frameType As String
Type Props
strDesig As String
strRollFlg As String
dDepth As Double
dTw As Double
dBfTop As Double
dTfTop As Double
dBfBot As Double
dTfBot As Double
dKTop As Double
dKBot As Double
dArea As Double
dPerimeter As Double
strShape As String
End Type
Private Function GetSectionProps() As Props
Dim SectionProps As Props
Set IMemberData1 = RamDataAcc1.GetDispInterfacePointerByEnum(IMemberData_INT)
IMemberData1.GetSteelMemberSectionDimProps lMemberID, peShape, 1, pdBfTop, pdBfBot, pdTfTop, pdTfB
ot, 1, 1, pdDepth, pdWebT, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, pdArea
Module1 - 3
If peShape = EStlWF Then
SectionProps.dArea = pdArea
SectionProps.dPerimeter = 2 * pdBfTop + 2 * pdDepth + 2 * pdBfBot - 2 * pdWebT
SectionProps.dBfTop = pdBfTop
SectionProps.strShape = "ISection"
End If
If peShape = EStlChannel Then
SectionProps.dArea = pdArea
SectionProps.dPerimeter = 2 * pdBfTop + 2 * pdDepth + 2 * pdBfBot - 2 * pdWebT
SectionProps.dBfTop = pdBfTop
SectionProps.strShape = "Channel"
End If
If peShape = EStlTube Then
SectionProps.dArea = pdArea
SectionProps.dPerimeter = 2 * pdBfTop + 2 * pdDepth
SectionProps.dBfTop = pdBfTop
SectionProps.strShape = "Tube"
End If
If peShape = EStlDoubleL Then
SectionProps.dArea = 2 * pdArea
SectionProps.dPerimeter = 4 * pdDepth + 4 * pdWebT
SectionProps.dBfTop = 0
SectionProps.strShape = "DoubleAngle"
End If
If peShape = EStlFlatBar Then
SectionProps.dArea = pdArea
SectionProps.dPerimeter = pdBfTop * 2 + pdTfTop * 2
SectionProps.dBfTop = 0
SectionProps.strShape = "Bar"
End If
If peShape = EStlLSection Then
SectionProps.dArea = pdArea
SectionProps.dPerimeter = 2 * pdDepth + 2 * pdWebT
SectionProps.dBfTop = 0
SectionProps.strShape = "Angle"
End If
If peShape = EStlNone Then
SectionProps.dArea = 0
SectionProps.dPerimeter = 0
SectionProps.dBfTop = 0
SectionProps.strShape = "NA"
End If
If peShape = EStlPipe Then
SectionProps.dArea = pdArea
SectionProps.dPerimeter = pdDepth * 3.14159
SectionProps.dBfTop = 0
SectionProps.strShape = "Pipe"
End If
If peShape = EstlRoundBar Then
SectionProps.dArea = pdArea
SectionProps.dPerimeter = pdDepth * 3.14159
SectionProps.dBfTop = 0
SectionProps.strShape = "Rod"
End If
If peShape = EStlTSection Then
SectionProps.dArea = pdArea
SectionProps.dPerimeter = 2 * pdBfTop + 2 * pdDepth
SectionProps.dBfTop = 0
SectionProps.strShape = "Tee"
End If
GetSectionProps = SectionProps
End Function
Sub runThis()
' Define Variables
'Set version developed
dVMin = 14.5
Module1 - 4
'Get Model path
OpenFile = Application.GetOpenFilename("RAM SS Database (*.ram; *.rss), *.ram; *.rss")
If OpenFile = "" Or OpenFile = False Then
Exit Sub
End If
'Initialize DataAccess
Set RamDataAcc1 = New RAMDATAACCESSLib.RamDataAccess1
'Set RamDataAcc1 = CreateObject("RAMDATAACCESSLib.RamDataAccess1")
'Initialize IO interface
Set RamDataAccIDBIO = RamDataAcc1.GetDispInterfacePointerByEnum(IDBIO1_INT)
'Check to see if compatible version
RamDataAccIDBIO.GetDatabaseVersion OpenFile, dVersion
dVersion = Round(dVersion, 1)
If dVersion < dVMin Then
strVMin = dVMin
MsgBox "This tool was written for Ram Structural System version " + strVMin + " or later.
ase update."
Exit Sub
End If
Ple
Module1 - 5
INodes.Filter eNFilter_AtFoundation, True
InodeCount = INodes.GetCount
Dim IMemberForces As IMemberForces
Dim IMemberForce As IMemberForce
For t = 0 To (InodeCount - 1)
Set INode = INodes.GetAt(t)
Set IMemberForces = INode.GetReactions
Set IMemberForce = IMemberForces.Get(ILoadCase.lUID)
Dim reactDict As New dictionary
'reactDict.Add "Floor", strStoryID
'reactDict.Add "c", ILoadCase.eLoadType
'reactDict.Add "d", ILoadCase.GetPrimaryLoadCases.GetCount
'reactDict.Add "e", ILoadCase.lUID
'reactDict.Add "lc", ILoadCase.lSubLoadType
reactDict.Add "LoadCaseSymbol", strSymbol
reactDict.Add "LoadCase", ILoadCase.strTypeLabel
reactDict.Add "FZ", IMemberForce.dAxial
reactDict.Add "FX", IMemberForce.dShearMajor
reactDict.Add "FY", IMemberForce.dShearMinor
reactDict.Add "MXX", IMemberForce.dMomentMajor
reactDict.Add "MYY", IMemberForce.dMomentMinor
reactDict.Add "MZZ", IMemberForce.dTorsion
reactDict.Add "X", INode.sLocation.dXLoc
reactDict.Add "Y", INode.sLocation.dYLoc
reactDict.Add "Z", INode.sLocation.dZLoc
reactDict.Add "uniqueNodeID", INode.lUniqueID
AddToTable reactDict, "framereactionnodesTbl"
Set reactDict = Nothing
Next
'Set IStory = IStories.GetAt(1)
'Dim IRnds As IReactionNodes
'Dim IRnd As IreactionNode
'Dim someNodes As INodes
'Set someNodes = IStories.GetAt(3).GetIsolatedFnds.GetAt(1)
'IReactionNodes.Filter eRNFilterAtFoundation, True
'ICount = someNodes.GetCount
'Set some = abc.GetAt(0)
'For
'
'
'
'
j =
Set
Set
Set
0 To (irNodeCount - 1)
IRnd = IRnds.GetAt(0)
IMemberForces = IRnd.GetReactions(eFMFSGravityAnalysis)
IMemberForce = IMemberForces.Get(ILoadCase.lUID)
'
'
'
'
'
'
'
'
'
''
'
'
''
'
'Next
Module1 - 6
'End If
'ReactionNodeCount = IReactionNodes.GetCount
' For lReact = 0 To (ReactionNodeCount - 1)
'
Set IReactionNode = IReactionNodes.GetAt(lReact)
'
Set IPointLoad = IReactionNode.GetReaction(eFMFSFrameAnalysis, ILoadCase.lAnalyzeNo)
'
Dim reactDict As dictionary
'
reactDict.Add "Floor", strStoryID
'
reactDict.Add "LoadCaseSymbol", strSymbol
'
reactDict.Add "dFx", IPointLoad.dFx
'
reactDict.Add "dFy", IPointLoad.dFy
''
reactDict.Add "dFz", IPointLoad.dFz
'
reactDict.Add "mFx", IPointLoad.mFx
'
reactDict.Add "mFy", IPointLoad.mFy
'
reactDict.Add "mFz", IPointLoad.mFz
'
AddToTable reactDict, "reactionnodesTbl"
'
Set reactDict = Nothing
'Next
Next
"Floor", strStoryID
"ColumnNo", member_num
"FrameType", frameType
"SectionLbl", sect_lbl
"SectionShp", prop.strShape
"SectArea", prop.dArea
"SectTop", prop.dBfTop
"SectPerimeter", prop.dPerimeter
"ColumnLength", dMemLength
"StartX", pStartPoint.dXLoc
Module1 - 7
colDict.Add "StartY", pStartPoint.dYLoc
colDict.Add "StartZ", pStartPoint.dZLoc
colDict.Add "EndX", pEndPoint.dXLoc
colDict.Add "EndY", pEndPoint.dYLoc
colDict.Add "EndZ", pEndPoint.dZLoc
AddToTable colDict, "columnsTbl"
Set colDict = Nothing
Next
'hbrace code starts
Set IHBraces = IStory.GetHorizBraces
IHBraces.Filter eColFilter_Material, ESteelMat
lNumHbraces = IHBraces.GetCount
Dim lHbrace As Long
For lHbrace = 0 To lNumHbraces - 1
Set IHBrace = IHBraces.GetAt(lHbrace)
lMemberID = IHBrace.lUID
member_num = IHBrace.lLabel
' If member_num = 1 Then
sect_lbl = IHBrace.strSectionLabel
prop = GetSectionProps
IHBrace.GetEndCoordinates pStartPoint, pEndPoint
dMemLength = Sqr((pStartPoint.dXLoc - pEndPoint.dXLoc) ^ 2 + (pStartPoint.dYLoc - pEndPoint.dY
Loc) ^ 2 + (pStartPoint.dZLoc - pEndPoint.dZLoc) ^ 2)
'IBeam.GetCoordinates eBeamEnds, pStartPoint, pEndPoint
'If IColumn.eFramingType = MemberIsGravity Then
'
frameType = "Gravity"
' ElseIf IColumn.eFramingType = MemberIsLateral Then
'
frameType = "Lateral"
' End If
Dim hbraceDict As New dictionary
hbraceDict.Add
hbraceDict.Add
hbraceDict.Add
hbraceDict.Add
hbraceDict.Add
hbraceDict.Add
hbraceDict.Add
hbraceDict.Add
hbraceDict.Add
hbraceDict.Add
hbraceDict.Add
"Floor", strStoryID
"ColumnNo", member_num
"SectionLbl", sect_lbl
"SectionShp", prop.strShape
"SectArea", prop.dArea
"SectTop", prop.dBfTop
"SectPerimeter", prop.dPerimeter
"ColumnLength", dMemLength
"StartX", pStartPoint.dXLoc
"StartY", pStartPoint.dYLoc
"StartZ", pStartPoint.dZLoc
Module1 - 8
sect_lbl = IVBrace.strSectionLabel
prop = GetSectionProps
IVBrace.GetEndCoordinates pStartPoint, pEndPoint
dMemLength = Sqr((pStartPoint.dXLoc - pEndPoint.dXLoc) ^ 2 + (pStartPoint.dYLoc - pEndPoint.dY
Loc) ^ 2 + (pStartPoint.dZLoc - pEndPoint.dZLoc) ^ 2)
'IBeam.GetCoordinates eBeamEnds, pStartPoint, pEndPoint
'If IColumn.eFramingType = MemberIsGravity Then
'
frameType = "Gravity"
' ElseIf IColumn.eFramingType = MemberIsLateral Then
'
frameType = "Lateral"
' End If
Dim vbraceDict As New dictionary
vbraceDict.Add
vbraceDict.Add
vbraceDict.Add
vbraceDict.Add
vbraceDict.Add
vbraceDict.Add
vbraceDict.Add
vbraceDict.Add
vbraceDict.Add
vbraceDict.Add
vbraceDict.Add
"Floor", strStoryID
"ColumnNo", member_num
"SectionLbl", sect_lbl
"SectionShp", prop.strShape
"SectArea", prop.dArea
"SectTop", prop.dBfTop
"SectPerimeter", prop.dPerimeter
"ColumnLength", dMemLength
"StartX", pStartPoint.dXLoc
"StartY", pStartPoint.dYLoc
"StartZ", pStartPoint.dZLoc
Module1 - 9
If IBeam.eFramingType = MemberIsGravity Then
frameType = "Gravity"
If IBeam.bComposite = 1 Then
ReDim palNumStuds(0 To 4) As Long
IBeam.GetSteelDesignResult.GetNumStudsInSegments.GetSize pSize
For lStudSeg = 0 To pSize - 1
IBeam.GetSteelDesignResult.GetNumStudsInSegments.GetAt lStudSeg, k
lTotalStuds = lTotalStuds + k
palNumStuds(lStudSeg) = k
Next
For onWards = pSize To UBound(palNumStuds)
palNumStuds(onWards) = 0
Next
Else
lTotalStuds = 0
End If
ElseIf IBeam.eFramingType = MemberIsLateral Then
frameType = "Lateral"
If IBeam.bComposite = 1 Then
ReDim palNumStuds(0 To 4) As Long
lTotalStuds = 0
IBeam.GetSteelDesignResult.GetNumStudsInSegments.GetSize pSize
For lStudSeg = 0 To pSize - 1
IBeam.GetSteelDesignResult.GetNumStudsInSegments.GetAt lStudSeg, k
lTotalStuds = lTotalStuds + k
palNumStuds(lStudSeg) = k
Next
For onWards = pSize To UBound(palNumStuds)
palNumStuds(onWards) = 0
Next
Else
lTotalStuds = 0
End If
End If
"Floor", strStoryID
"BeamNo", member_num
"FrameType", frameType
"SectionLbl", sect_lbl
"SectionShp", prop.strShape
"SectArea", prop.dArea
"SectTop", prop.dBfTop
"SectPerimeter", prop.dPerimeter
"BeamLength", dMemLength
Module1 - 10
dict.Add "StartX", pStartPoint.dXLoc
dict.Add "StartY", pStartPoint.dYLoc
dict.Add "StartZ", pStartPoint.dZLoc
dict.Add "EndX", pEndPoint.dXLoc
dict.Add "EndY", pEndPoint.dYLoc
dict.Add "EndZ", pEndPoint.dZLoc
dict.Add "Camber", IBeam.dCamber
dict.Add "StudDiameter", IBeam.dStudDiameter
dict.Add "StudLength", IBeam.dStudLength
dict.Add
dict.Add
dict.Add
dict.Add
dict.Add
dict.Add
dict.Add
dict.Add
dict.Add
dict.Add
"StudSegmentLength1", IBeam.dStudSegment1Length
"StudSegmentLength2", IBeam.dStudSegment2Length
"StudSegmentLength3", IBeam.dStudSegment3Length
"StudSegmentLength4", IBeam.dStudSegment4Length
"StudSegmentLength5", IBeam.dStudSegment5Length
"NumOfStud1", palNumStuds(0)
"NumOfStud2", palNumStuds(1)
"NumOfStud3", palNumStuds(2)
"NumOfStud4", palNumStuds(3)
"NumOfStud5", palNumStuds(4)
Next
Next
'For Each ws In ThisWorkbook.Worksheets
'
For Each lstobj In ws.ListObjects
'
If lstobj.Name = "outputTbl" Then
'
lstobj.ListColumns(1).Delete
'
End If
'
Next
'Next
RamDataAccIDBIO.CloseDatabase
End Sub
Sub ClearTable(tblName)
Dim lo As ListObject
For Each ws In ThisWorkbook.Worksheets
For Each lstobj In ws.ListObjects
If lstobj.Name = tblName Then
lstobj.Delete
Set lo = ws.ListObjects.Add(xlSrcRange, ws.Range("$A$4"), , xlYes)
lo.Name = tblName
lo.ListRows.Add AlwaysInsert:=True
End If
Next
Next
'Dim wsh As Worksheet
'Set wsh = ThisWorkbook.Worksheets(1)
'Set lo = wsh.ListObjects.Add(xlSrcRange, Range("$A$4"), , xlYes)
'lo.Name = "outputTbl"
'lo.ListRows.Add AlwaysInsert:=True
End Sub
Module1 - 11
Sub AddToTable(dict As scripting.dictionary, tblName)
Dim
Dim
Dim
Dim
wkBk As Workbook
wksht As Worksheet
lo As ListObject
lstobj As ListObject
End Sub
Public Function DoesTableExist(ByVal wb As Workbook, _
ByVal tblName As String) As Boolean
On Error GoTo catch
DoesTableExist = False
Dim lstobj As ListObject, ws As Worksheet
For Each ws In wb.Worksheets
For Each lstobj In ws.ListObjects
If lstobj.Name = tblName Then
DoesTableExist = True
Exit Function
End If
Next
Next
Exit Function
catch:
DoesTableExist = False
End Function
Public Function AddDictToTbl(lo As ListObject, dict As scripting.dictionary)
Dim hr As Range
Set hr = lo.HeaderRowRange
For Each k In dict.Keys
If Application.WorksheetFunction.CountIf(hr, k) > 0 Then
Else
lo.ListColumns.Add
lo.HeaderRowRange.End(xlToRight) = k
End If
Next
'lo.ListColumns("Column1").Delete
Dim rowRng As ListRow
'lo.ListRows.Add AlwaysInsert:=True
Set rowRng = lo.ListRows(lo.ListRows.Count)
Dim colRng As Range
Dim tarRng As Range
For Each Key In dict.Keys
' find column no from key
Set colRng = lo.ListColumns(Key).Range
Module1 - 12
Set tarRng = colRng(lo.ListRows.Count + 1)
tarRng = dict(Key)
Next
lo.ListRows.Add AlwaysInsert:=True
If HeaderExists(lo, "Column1") Then
lo.ListColumns("Column1").Delete
End If
End Function
Public Function HeaderExists(tbl As ListObject, HeaderName As String) As Boolean
'PURPOSE: Output a true value if column name exists in specified table
'SOURCE: www.TheSpreadsheetGuru.com
Dim hdr As ListColumn
On Error GoTo DoesNotExist
Set hdr = tbl.ListColumns(HeaderName)
On Error GoTo 0
HeaderExists = True
Exit Function
'Error Handler
DoesNotExist:
Err.Clear
HeaderExists = False
End Function