Sunday, December 3, 2023

Roadmap to Becoming a Computational Engineer in Structural Engineering

Sub ClearRange()
    ' Clears the contents of the range B6:Z100 in sheet "RVR"
    Sheets("RVR").Range("B6:F40").ClearContents
End Sub




Sub RVR_runanaysisRCC()
    Dim ETABSObject As Object
    Dim SapModel As Object
    Dim ret As Long
    Dim frameCount As Long
    Dim filePath As String
    Dim fd As FileDialog


'Sub ClearRange()
    ' Clears the contents of the range B6:Z100 in sheet "RVR"
    Sheets("RVR").Range("B6:D20").ClearContents
End Sub

    
    
    ' Open file dialog to select ETABS file
    Set fd = Application.FileDialog(msoFileDialogFilePicker)
    With fd
        .Title = "Select ETABS Model File"
        .Filters.Clear
        .Filters.Add "ETABS Model Files", "*.EDB; *.EBF"
        .AllowMultiSelect = False
        If .Show = -1 Then
            filePath = .SelectedItems(1) ' Store selected file path
        Else
            MsgBox "No file selected. Exiting.", vbExclamation
            Exit Sub ' Exit if no file is selected
        End If
    End With

    ' Create ETABS object
    Set ETABSObject = CreateObject("CSI.ETABS.API.ETABSObject")

    ' Start ETABS application
    ret = ETABSObject.ApplicationStart()
    If ret <> 0 Then
        MsgBox "Error starting ETABS application. Error Code: " & ret, vbExclamation
        Exit Sub
    End If

    ' Create SapModel object
    Set SapModel = ETABSObject.SapModel

    ' Open the ETABS file
    ret = SapModel.File.OpenFile(filePath)
    If ret <> 0 Then
        MsgBox "Error opening file: " & filePath & vbCrLf & "Error Code: " & ret, vbExclamation
        ETABSObject.ApplicationExit (True)
        Exit Sub
    End If



     ' Run analysis
    ret = SapModel.Analyze.RunAnalysis()
    If ret <> 0 Then
        ETABSObject.ApplicationExit (True)
        Exit Sub
    End If
             
    
       ' Start concrete design
    ret = SapModel.DesignConcrete.StartDesign()
    If ret <> 0 Then
        ETABSObject.ApplicationExit (True)
        Exit Sub
    End If
    
        
       ' Start Shearwall design
    ret = SapModel.DesignShearWall.StartDesign()
    If ret <> 0 Then
        ETABSObject.ApplicationExit (True)
        Exit Sub
    End If
    
    
    

    ' Close ETABS
    'ETABSObject.ApplicationExit (True)

    ' Release object references
    Set SapModel = Nothing
    Set ETABSObject = Nothing
    Set fd = Nothing
End Sub