SAP2000API代码-挡土墙

更新时间:2023-10-13 01:14:01 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

'FormWall1D Code

Imports System.Math

Public Class FromWall1D

Dim TimeSum As Integer = 0 Dim i, j, k As Integer Dim ret As Long

Dim ModelName As String

Dim AboutBoxFlag As Boolean = False

'点击一次即弹出ComboBox下拉菜单

Private Sub DataGridView_CellEnter(ByVal sender As Object, ByVal e As

System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView.CellEnter Dim dgv As DataGridView = CType(sender, DataGridView)

If dgv.Columns(e.ColumnIndex).Name = \ Or dgv.Columns(e.ColumnIndex).Name = \ Then SendKeys.Send(\) End If End Sub

'初始化程序

Public Sub New()

'此调用是Windows 窗体设计器所必需的。 InitializeComponent()

'在InitializeComponent() 调用之后添加任何初始化。

'初始化Datagridview

Me.DataGridView.AllowUserToAddRows = False

Me.DataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill Me.DataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing Me.DataGridView.ColumnHeadersHeight = 20

'初始化地下室楼层总数为

Me.ComboBoxStoryNum.SelectedIndex = 0

'初始化标准高度为

Me.ComboBoxStoryHeight.Text = \

'初始化标准墙厚为

Me.ComboBoxWallThickness.Text = \

'初始化标准保护层厚度为

Me.ComboBoxConcreteCover.Text = \

'初始化标准混凝土等级为C30

Me.ComboBoxConcreteGrade.SelectedIndex = 1

'初始化标准钢筋等级为HRB400

Me.ComboBoxRebarClass.SelectedIndex = 2

'初始化地下水距墙顶高差为

Me.ComboBoxWaterLevel.Text = \

'初始化场地距墙顶高差为

Me.ComboBoxSiteLevel.Text = \

'初始化土容重为

Me.ComboBoxSoilUintWeight.Text = \

'初始化土浮容重为

Me.ComboBoxSoilMergedUnitWeight.Text = \

'初始化地面堆载为

Me.ComboBoxGroundLoad.Text = \

'初始化土内摩擦角为

Me.ComboBoxInternalFrictionalAngle.Text = \

'初始化土压力类型为静止土压力

Me.ComboBoxCalMethod.SelectedIndex = 0

'初始化静止土压力折减系数为.0

Me.ComboBoxPressureReduce.Text = \

'初始化墙顶约束为铰接

Me.ComboBoxRestraintTop.SelectedIndex = 1

'初始化墙低约束为刚接

Me.ComboBoxRestraintBottom.SelectedIndex = 1

'初始化标题列宽度不能改变

Me.DataGridView.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing Me.DataGridView.RowHeadersWidth = 25

'初始化标题行高度不能改变

Me.DataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing Me.DataGridView.ColumnHeadersHeight = 25

End Sub

'楼层数赋值并调整DataGridView行数

Private Sub ComboBoxStoryNum_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBoxStoryNum.SelectedIndexChanged Me.DataGridView.RowCount = ComboBoxStoryNum.Text

For i = 0 To Me.DataGridView.RowCount - 1

Me.DataGridView(0, i).Value = -1 * i - 1 & \

If Me.DataGridView(1, i).Value = \ Then

Me.DataGridView(1, i).Value = Me.ComboBoxStoryHeight.Text End If

If Me.DataGridView(2, i).Value = \ Then

Me.DataGridView(2, i).Value = Me.ComboBoxWallThickness.Text End If

If Me.DataGridView(3, i).Value = \ Then

Me.DataGridView(3, i).Value = Me.ComboBoxConcreteCover.Text End If

If Me.DataGridView(4, i).Value = \ Then

Me.DataGridView(4, i).Value = Me.ComboBoxConcreteGrade.Text End If

If Me.DataGridView(5, i).Value = \ Then

Me.DataGridView(5, i).Value = Me.ComboBoxRebarClass.Text End If Next End Sub

'层高赋值 Private Sub ComboBoxStoryHeight_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBoxStoryHeight.TextChanged

For i = 0 To Me.DataGridView.RowCount - 1

Me.DataGridView(1, i).Value = Me.ComboBoxStoryHeight.Text Next End Sub

'墙厚赋值

Private Sub ComboBoxWallThickness_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBoxWallThickness.TextChanged For i = 0 To Me.DataGridView.RowCount - 1

Me.DataGridView(2, i).Value = Me.ComboBoxWallThickness.Text Next End Sub

'保护层厚度赋值

Private Sub ComboBoxConcreteCover_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBoxConcreteCover.TextChanged For i = 0 To Me.DataGridView.RowCount - 1

Me.DataGridView(3, i).Value = Me.ComboBoxConcreteCover.Text Next End Sub

'混凝土等级赋值

Private Sub ComboBoxConcreteGrade_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBoxConcreteGrade.SelectedIndexChanged For i = 0 To Me.DataGridView.RowCount - 1

Me.DataGridView(4, i).Value = Me.ComboBoxConcreteGrade.Text Next End Sub

'钢筋等级赋值

Private Sub ComboBoxRebarClass_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBoxRebarClass.SelectedIndexChanged For i = 0 To Me.DataGridView.RowCount - 1

Me.DataGridView(5, i).Value = Me.ComboBoxRebarClass.Text Next

End Sub

'根据土压力计算类型不同调整土压力折减系数对话框有效性

Private Sub ComboBoxCalMethod_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBoxCalMethod.SelectedIndexChanged If Me.ComboBoxCalMethod.SelectedIndex = 0 Then Me.LabelPressureReduce.Enabled = True Me.ComboBoxPressureReduce.Enabled = True Else

Me.LabelPressureReduce.Enabled = False

Me.ComboBoxPressureReduce.SelectedIndex = 1 Me.ComboBoxPressureReduce.Enabled = False End If End Sub

Private Sub ButtonOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonOK.Click

'当数据文件路径为空时

If Me.TextBoxFilePath.Text = \ Then If Not FileSave(Me) Then Exit Sub Else

If GetFileString(Me) <> GetFileString(Me.TextBoxFilePath.Text) Then Dim MsgVal

MsgVal = MsgBox(\当前数据与\ & Me.TextBoxFilePath.Text & \数据不同,是否覆盖源文件?\, MsgBoxStyle.YesNoCancel, \提示\) Select Case MsgVal

Case 6 '选择Yes,覆盖源文件

If Not FileSave(Me, Me.TextBoxFilePath.Text) Then Exit Sub Case 7 '选择No,另存新文件

If Not FileSave(Me) Then Exit Sub Case 2 '选择Cancel,返回编辑 Exit Sub End Select End If End If

'当模型路径为空时

If Me.TextBoxModelPath.Text = \ Then

SaveFileDialog.Filter = (\)

SaveFileDialog.Title = \保存SAP2000模型文件(*.sdb)\

If SaveFileDialog.ShowDialog = Windows.Forms.DialogResult.OK And Len(SaveFileDialog.FileName) > 0 Then

ModelName = SaveFileDialog.FileName()

Me.TextBoxModelPath.Text = SaveFileDialog.FileName() Else

Exit Sub End If Else

ModelName = Me.TextBoxModelPath.Text End If

'定义SAP2000变量

Dim SAPObject As SAP2000v15.SapObject Dim SAPModel As SAP2000v15.cSapModel

'定义层数并赋值

Dim StoryNum As Integer

StoryNum = Val(Me.ComboBoxStoryNum.Text)

'定义墙单元信息列表,包含-层号、-墙厚、-保护层厚、-混凝土等级、-钢筋等级、-Sap构件名称 Dim WallElementsList As ArrayList = New ArrayList For i = 0 To Me.DataGridView.RowCount - 1

WallElementsList.Add(New Object() {Me.DataGridView(0, i).Value, Me.DataGridView(1, i).Value, Me.DataGridView(2, i).Value, Me.DataGridView(3, i).Value, Me.DataGridView(4, i).Value, Me.DataGridView(5, i).Value, Me.DataGridView(0, i).Value + \ + Me.DataGridView(2, i).Value + \ + Me.DataGridView(3, i).Value + \ + Me.DataGridView(4, i).Value + \ + Me.DataGridView(5, i).Value}) Next

'定义层高列表并赋值

Dim StoryHeightList As ArrayList = New ArrayList For i = 0 To StoryNum - 1

StoryHeightList.Add(WallElementsList(i)(1)) Next

'定义墙厚列表并赋值

Dim WallThicknessList As ArrayList = New ArrayList For i = 0 To StoryNum - 1

WallThicknessList.Add(WallElementsList(i)(2)) Next

'定义混凝土保护层厚度列表并赋值

Dim ConcreteCoverList As ArrayList = New ArrayList For i = 0 To StoryNum - 1

ConcreteCoverList.Add(WallElementsList(i)(3)) Next

'定义混凝土等级列表并赋值

Dim ConcreteGradeList As ArrayList = New ArrayList For i = 0 To StoryNum - 1

ConcreteGradeList.Add(WallElementsList(i)(4)) Next

'定义钢筋等级列表并赋值

Dim RebarClassList As ArrayList = New ArrayList For i = 0 To StoryNum - 1

RebarClassList.Add(WallElementsList(i)(5)) Next

'定义Sap截面名称列表并赋值

Dim SapMemberSectionList As ArrayList = New ArrayList For i = 0 To StoryNum - 1

SapMemberSectionList.Add(WallElementsList(i)(6)) Next

'定义Sap构件名称列表并赋值

Dim SapMemberNameList As ArrayList = New ArrayList For i = 0 To StoryNum - 1

SapMemberNameList.Add(WallElementsList(i)(0))

本文来源:https://www.bwwdw.com/article/dhef.html

Top