You are on page 1of 3

Sub Main() 'DESCRIPTION:Macro to generate concrete box girder outline. Set objSTAADGUI = GetObject (,"StaadPro.

OpenSTAAD") Begin Dialog UserDialog 620,245,"Box Girder Variables" ' %GRID:5,5,1,1 Text 20,10,130,15,"Number of Divisions",.Divisions Text 20,45,140,15,"Maximum Pier Height",.Text2 Text 20,80,140,15,"Minimum Pier Height",.Text3 Text 20,115,140,15,"Span Length",.Text4 Text 20,150,140,15,"Span Width",.Text5 TextBox 210,5,130,20,.nDivisions TextBox 210,40,130,20,.MaxHeight TextBox 210,75,130,20,.MinHeight TextBox 210,110,130,20,.SpanLength TextBox 210,145,130,20,.SpanWidth OKButton 90,190,90,20 CancelButton 200,190,85,20 Picture 360,5,245,115,"C:\spro2006\openstaad\box_cross.bmp",0,.P icture1 Picture 360,130,245,115,"C:\spro2006\openstaad\\box_bridge.bmp", 0,.Picture2 End Dialog Dim dlg As UserDialog Dim dlgResult As Integer Dim nDivisions As Integer Dim NumOfNodes As Integer Dim NumOfMembers As Integer Dim Dim Dim Dim SpanLength As Double SpanWidth As Double MaxPierHeight As Double MinPierHeight As Double

Dim A As Double Dim Dim Dim Dim Dim Dim Dim Dim Dim NodeX() As Double NodeY() As Double NodeZ() As Double MembData() As Long STAADNodeNos() As Long NodeNoA As Long NodeNoB As Long NodeA As Long NodeB As Long

Dim N As Integer Dim J As Integer TryAgain: dlg.nDivisions = "20" dlg.MaxHeight = "20" dlg.MinHeight = "10" dlg.SpanLength = "300"

dlg.SpanWidth = "30" 'Popup the dialog dlgResult = Dialog(dlg) Debug.Clear If dlgResult = -1 Then 'OK button pressed 'Get the values nDivisions = Abs( CInt(dlg.nDivisions) ) SpanLength = Abs(CDbl(dlg.SpanLength)) SpanWidth = Abs(CDbl(dlg.SpanWidth)) MaxPierHeight = Abs(CDbl(dlg.MaxHeight)) MinPierHeight = Abs(CDbl(dlg.MinHeight)) NumOfNodes = nDivisions + 1 ReDim ReDim ReDim ReDim NodeX(NumOfNodes) As Double NodeY(NumOfNodes) As Double NodeZ(NumOfNodes) As Double STAADNodeNos(NumOfNodes*4) As Long

'Nodes that make the bottom of the parabola - y = a(x-h)^2 + k 'Find value of A A = -MinPierHeight / ((SpanLength / 2)*(SpanLength / 2)) J = 1 For N = 1 To NumOfNodes NodeX(N) = (N-1)*SpanLength/nDivisions NodeY(N) = ((NodeX(N)-SpanLength/2)*(NodeX(N)-SpanLength/2))*A + MinPierHeight + 100 'Create parabola at Z = 0 objSTAADGUI.Geometry.AddNode(NodeX(N), NodeY(N),0) STAADNodeNos(J) = J J = J + 1 'Create parabola at Z = SpanWidth objSTAADGUI.Geometry.AddNode(NodeX(N), NodeY(N),SpanWidth) STAADNodeNos(J) = J J = J + 1 'Create straight girder at Z = 0 objSTAADGUI.Geometry.AddNode(NodeX(N),MaxPierHeight+100,0) STAADNodeNos(J) = J J = J + 1 'Create straight girder at Z = SpanWidth objSTAADGUI.Geometry.AddNode(NodeX(N),MaxPierHeight+100,SpanWidt h) STAADNodeNos(J) = J J = J + 1 If (N > 1) Then 'Create side plates for each box section objSTAADGUI.Geometry.AddPlate(STAADNodeNos(2+4*(N-2)),ST AADNodeNos(6+4*(N-2)),STAADNodeNos(8+4*(N-2)),STAADNodeNos(4+4*(N-2))) objSTAADGUI.Geometry.AddPlate(STAADNodeNos(1+4*(N-2)),ST AADNodeNos(3+4*(N-2)),STAADNodeNos(7+4*(N-2)),STAADNodeNos(5+4*(N-2)))

'Create top objSTAADGUI.Geometry.AddPlate(STAADNodeNos(4+4*(N-2)),ST AADNodeNos(8+4*(N-2)),STAADNodeNos(7+4*(N-2)),STAADNodeNos(3+4*(N-2))) 'Create bottom objSTAADGUI.Geometry.AddPlate(STAADNodeNos(1+4*(N-2)),ST AADNodeNos(2+4*(N-2)),STAADNodeNos(6+4*(N-2)),STAADNodeNos(5+4*(N-2))) End If Next N objSTAADGUI.UpdateStructure ElseIf dlgResult = 0 Then 'Cancel button pressed Debug.Print "Cancel button Pressed" End If Set objSTAADGUI = Nothing End Sub

You might also like