243 lines
8.6 KiB
VB.net
243 lines
8.6 KiB
VB.net
Imports XCCLibrary
|
|
Public Class Individual
|
|
|
|
'Public Shared filepath As String = "C:\Users\Anton\Documents\Exjobb"
|
|
Public Shared filepath As String = "C:\Users\xperd\Documents"
|
|
|
|
' --- Start method (main) for GUI ---
|
|
Sub Individual_load() Handles MyBase.Load
|
|
' Initialize GUI
|
|
Init_Form()
|
|
|
|
' Initialize DataTables, Measurments and more
|
|
Data.Init_Data()
|
|
|
|
' Initialize DrawingPanel
|
|
Draw_Grating.Load_DrawingPanel()
|
|
|
|
|
|
|
|
' Load XCC settings
|
|
adminClass.loadSettings(Settings.filesFolder, Settings.HLCtFolder, "SolidWorks")
|
|
|
|
End Sub
|
|
|
|
' --- Initialize GUI (form) size and position ---
|
|
Private Sub Init_Form()
|
|
Me.Width = AppForm.Width
|
|
Me.Height = AppForm.Height
|
|
ComboBox_Type.Items.Add("Pressure Welded")
|
|
ComboBox_Type.Items.Add("Type A")
|
|
|
|
If AppForm.fillMode = True Then
|
|
Init_Multiple()
|
|
Else
|
|
Init_Individual()
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub Init_Individual()
|
|
Me.Panel_Data.BackColor = Color.AliceBlue
|
|
Me.Panel_Recesses.BackColor = Color.LightGray
|
|
|
|
Dim CheckTemp As New CheckBox With {
|
|
.Name = "CheckBox_Whole_Mesh",
|
|
.Text = "Whole Mesh Widths",
|
|
.Left = 110,
|
|
.Top = 387,
|
|
.Font = New Font("Microsoft Sans Serif", 7.8),
|
|
.Checked = True,
|
|
.Enabled = False,
|
|
.AutoSize = True,
|
|
.BackColor = Color.Transparent
|
|
}
|
|
AddHandler CheckTemp.CheckedChanged, AddressOf CheckBox_Whole_Mesh_CheckedChanged
|
|
Me.Panel_Data.Controls.Add(CheckTemp)
|
|
|
|
Dim WidthDropTemp As New ComboBox With {
|
|
.Name = "ComboBox_Width",
|
|
.Left = 110,
|
|
.Top = 418,
|
|
.Width = 155,
|
|
.Enabled = False,
|
|
.DropDownStyle = ComboBoxStyle.DropDownList
|
|
}
|
|
AddHandler WidthDropTemp.KeyPress, AddressOf ComboBox_Width_KeyPress
|
|
AddHandler WidthDropTemp.TextChanged, AddressOf ComboBox_Width_TextChanged
|
|
Me.Panel_Data.Controls.Add(WidthDropTemp)
|
|
End Sub
|
|
|
|
Private Sub Init_Multiple()
|
|
Me.Panel_Data.BackColor = Color.Salmon
|
|
Me.Panel_Recesses.BackColor = Color.LightPink
|
|
|
|
Dim LabelTemp As New Label With {
|
|
.Name = "Label_Max_Load",
|
|
.Text = "Max Load",
|
|
.Left = 35,
|
|
.Top = 525,
|
|
.AutoSize = True,
|
|
.Font = New Font("Microsoft Sans Serif", 10)
|
|
}
|
|
Me.Panel_Data.Controls.Add(LabelTemp)
|
|
|
|
|
|
Dim textBoxTemp As New TextBox With {
|
|
.Name = "TextBox_Max_Load",
|
|
.Text = "5",
|
|
.Left = 110,
|
|
.Top = 525,
|
|
.Width = 155,
|
|
.TextAlign = HorizontalAlignment.Right,
|
|
.Font = New Font("Microsoft Sans Serif", 7.8)
|
|
}
|
|
Me.Panel_Data.Controls.Add(textBoxTemp)
|
|
|
|
Dim LabelTemp2 As New Label With {
|
|
.Name = "Label_Max_Load_Unit",
|
|
.Text = "kN/m²",
|
|
.Left = 269,
|
|
.Top = 529,
|
|
.Font = New Font("Microsoft Sans Serif", 8)
|
|
}
|
|
Me.Panel_Data.Controls.Add(LabelTemp2)
|
|
|
|
Dim WidthTextTemp As New ComboBox With {
|
|
.Name = "TextBox_Width",
|
|
.Left = 110,
|
|
.Top = 418,
|
|
.Width = 155,
|
|
.Enabled = False
|
|
}
|
|
AddHandler WidthTextTemp.KeyPress, AddressOf ComboBox_Width_KeyPress
|
|
AddHandler WidthTextTemp.TextChanged, AddressOf ComboBox_Width_TextChanged
|
|
Me.Panel_Data.Controls.Add(WidthTextTemp)
|
|
End Sub
|
|
|
|
' ---------------------------------- Individual Templates ----------------------------------
|
|
' --- TextBox Template ---
|
|
Public Sub Create_TextBox_Recesses(TextBoxName As String, TextBoxText As String, TextBoxLeft As Integer, TextBoxTop As Integer,
|
|
TextBoxWidth As Integer)
|
|
Dim textBoxTemp As New TextBox With {
|
|
.Name = TextBoxName,
|
|
.Text = TextBoxText,
|
|
.Left = TextBoxLeft,
|
|
.Top = TextBoxTop,
|
|
.Width = TextBoxWidth,
|
|
.Font = New Font("Microsoft Sans Serif", 10)
|
|
}
|
|
Me.Panel_Recesses.Controls.Add(textBoxTemp)
|
|
End Sub
|
|
|
|
' --- Label Template for Individual ---
|
|
Public Sub Create_Label_Recesses(LabelName As String, LabelText As String, LabelLeft As Integer, LabelTop As Integer)
|
|
Dim LabelTemp As New Label With {
|
|
.Name = LabelName,
|
|
.Text = LabelText,
|
|
.Left = LabelLeft,
|
|
.Top = LabelTop,
|
|
.Font = New Font("Microsoft Sans Serif", 10)
|
|
}
|
|
Me.Panel_Recesses.Controls.Add(LabelTemp)
|
|
End Sub
|
|
|
|
|
|
' ---------------------------------- Gratings Data ----------------------------------
|
|
' --- When user changes grating type ---
|
|
Private Sub ComboBox_Type_TextChanged(sender As Object, e As EventArgs) Handles ComboBox_Type.TextChanged
|
|
User_Input.TypeChanged(sender, e)
|
|
End Sub
|
|
|
|
|
|
' --- When user changes grating material ---
|
|
Private Sub ComboBox_Material_TextChanged(sender As Object, e As EventArgs) Handles ComboBox_Material.TextChanged
|
|
User_Input.MaterialChanged(sender, e)
|
|
End Sub
|
|
|
|
' --- When user changes mesh size ---
|
|
Private Sub ComboBox_Mesh_TextChanged(sender As Object, e As EventArgs) Handles ComboBox_Mesh.TextChanged
|
|
User_Input.MeshChanged(sender, e)
|
|
End Sub
|
|
|
|
' --- When user changes grating height ---
|
|
Private Sub ComboBox_Height_TextChanged(sender As Object, e As EventArgs) Handles ComboBox_Height.TextChanged
|
|
User_Input.HeightChanged(sender, e)
|
|
End Sub
|
|
|
|
' --- When user changes grating thickness ---
|
|
Private Sub ComboBox_Thickness_TextChanged(sender As Object, e As EventArgs) Handles ComboBox_Thickness.TextChanged
|
|
User_Input.ThicknessChanged(sender, e)
|
|
End Sub
|
|
|
|
' --- When user checkes/uncheckes whole meshes ---
|
|
Private Sub CheckBox_Whole_Mesh_CheckedChanged(sender As Object, e As EventArgs)
|
|
User_Input.WholeMeshWidthsChanged(sender, e)
|
|
End Sub
|
|
|
|
' --- Grating width changed ---
|
|
Private Sub ComboBox_Width_TextChanged(sender As Object, e As EventArgs)
|
|
User_Input.WidthChanged(sender, e)
|
|
End Sub
|
|
|
|
' --- Check if width is a number ---
|
|
Private Sub ComboBox_Width_KeyPress(sender As Object, e As KeyPressEventArgs)
|
|
User_Input.Check_IfNumber(e)
|
|
End Sub
|
|
|
|
' --- Grating length changed ---
|
|
Private Sub LengthBox_TextChanged(sender As Object, e As EventArgs) Handles TextBox_Length.TextChanged
|
|
User_Input.LengthChanged(sender, e)
|
|
End Sub
|
|
|
|
' --- Check if length is a number ---
|
|
Private Sub ComboBox_Length_KeyPress(sender As Object, e As KeyPressEventArgs) Handles TextBox_Length.KeyPress
|
|
User_Input.Check_IfNumber(e)
|
|
End Sub
|
|
|
|
' ---------------------------------- Functions ----------------------------------
|
|
' --- When angle button is pressed ---
|
|
Private Sub Button_Angle_Corner_Click(sender As Object, e As EventArgs) Handles Button_Angle_Corner.Click
|
|
Corner_Angle.AngleButton(sender, e)
|
|
End Sub
|
|
|
|
' --- When angle side button is pressed ---
|
|
Private Sub Button_Angle_Side_Click(sender As Object, e As EventArgs) Handles Button_Angle_Side.Click
|
|
|
|
End Sub
|
|
|
|
' --- When square corner button is pressed ---
|
|
Private Sub Button_Square_Corner_Click(sender As Object, e As EventArgs) Handles Button_Square_Corner.Click
|
|
Corner_Rectangle.SquareButtton(sender, e)
|
|
End Sub
|
|
|
|
' --- When square side button is pressed ---
|
|
Private Sub Button_Square_Side_Click(sender As Object, e As EventArgs) Handles Button_Square_Side.Click
|
|
Side_Rectangle.SquareSideButtton(sender, e)
|
|
End Sub
|
|
|
|
' --- When middle square button is pressed ---
|
|
Private Sub Button_Square_Middle_Click(sender As Object, e As EventArgs) Handles Button_Square_Middle.Click
|
|
|
|
End Sub
|
|
|
|
' ---------------------------------- Settings ----------------------------------
|
|
' --- Settings button clicked ---
|
|
Private Sub Button_Settings_Click(sender As Object, e As EventArgs) Handles Button_Settings.Click
|
|
Settings.ButtonClicked(sender, e)
|
|
End Sub
|
|
|
|
' ---------------------------------- Export to SW ----------------------------------
|
|
' --- When export to SW button is pressed ---
|
|
Private Sub Button_Export_SW_Click(sender As Object, e As EventArgs) Handles Button_Export_SW.Click
|
|
'Model_3D.BuildGrating()
|
|
Drawing.CreateDrawing()
|
|
End Sub
|
|
|
|
' ---------------------------------- Export GUI ----------------------------------
|
|
' --- When export GUI button is pressed ---
|
|
Private Sub Button_Export_GUI_Click(sender As Object, e As EventArgs) Handles Button_Export_GUI.Click
|
|
|
|
End Sub
|
|
|
|
End Class |