387 lines
15 KiB
VB.net
387 lines
15 KiB
VB.net
|
|
Public Class Grating_Configurator
|
|
|
|
Sub Load_GUI()
|
|
' Initialize GUI
|
|
Init_Form()
|
|
|
|
Draw_Grating.Update_GratingPoints()
|
|
End Sub
|
|
|
|
' --- Initialize GUI (form) size and position ---
|
|
Private Sub Init_Form()
|
|
PictureBox_CalculateGrid.BackgroundImage = Global.Wardrobe.My.Resources.Resources.Icon_UpdateGrid1_01
|
|
PictureBox_ExportMenu.BackgroundImage = Global.Wardrobe.My.Resources.Resources.Icon_ExportMenu1_01
|
|
|
|
Me.Width = AppForm.Width
|
|
Me.Height = AppForm.Height
|
|
|
|
If AppForm.fillMode = True Then
|
|
Init_Multiple()
|
|
Else
|
|
Init_Individual()
|
|
End If
|
|
|
|
Me.ComboBox_Material.Enabled = False
|
|
Me.ComboBox_Mesh.Enabled = False
|
|
Me.ComboBox_Height.Enabled = False
|
|
Me.ComboBox_Thickness.Enabled = False
|
|
Me.ComboBox_Width.Enabled = False
|
|
Me.TextBox_Width.Enabled = False
|
|
Me.TextBox_Length.Enabled = False
|
|
Me.PictureBox_ExportMenu.Enabled = False
|
|
|
|
Me.Button_Angle_Corner.Enabled = False
|
|
Me.Button_Angle_Side.Enabled = False
|
|
Me.Button_Square_Corner.Enabled = False
|
|
Me.Button_Square_Side.Enabled = False
|
|
Me.Button_Square_Middle.Enabled = False
|
|
|
|
PictureBox_ExportMenu.Top = 715
|
|
|
|
Label_Line_Grating.Location = New Point(260, Draw_Grating.guiPanelW - 27)
|
|
Label_Line_Grid.Location = New Point(444, Draw_Grating.guiPanelW - 27)
|
|
Label_Line_Beams.Location = New Point(620, Draw_Grating.guiPanelW - 27)
|
|
Label_Line_AngleRecess.Location = New Point(802, Draw_Grating.guiPanelW - 27)
|
|
|
|
End Sub
|
|
|
|
Private Sub Init_Individual()
|
|
Label_ConfigType.Text = "- Single Grating"
|
|
PictureBox_ConfigType.BackgroundImage = Global.Wardrobe.My.Resources.Resources.Individual_Icon
|
|
|
|
PictureBox_CalculateGrid.Visible = False
|
|
|
|
Label_Width.Top = 465
|
|
TextBox_Width.Top = 465
|
|
ComboBox_Width.Top = 465
|
|
Label_WidthUnit.Top = 469
|
|
|
|
CheckBox_Frames.Top = 537
|
|
Label_Frame.Top = 559
|
|
ComboBox_Frame.Top = 559
|
|
CheckBox_CutFrame.Top = 589
|
|
|
|
Dim CheckTemp As New CheckBox With {
|
|
.Name = "CheckBox_Whole_Mesh",
|
|
.Text = "Whole Mesh Widths",
|
|
.Left = 110,
|
|
.Top = 443,
|
|
.Font = New Font("Microsoft Sans Serif", 7.8),
|
|
.Checked = True,
|
|
.Enabled = False,
|
|
.AutoSize = True,
|
|
.BackColor = Color.Transparent,
|
|
.ForeColor = Color.White
|
|
}
|
|
AddHandler CheckTemp.CheckedChanged, AddressOf CheckBox_Whole_Mesh_CheckedChanged
|
|
Me.Panel_Data.Controls.Add(CheckTemp)
|
|
|
|
Me.ComboBox_Width.Visible = True
|
|
Me.TextBox_Width.Visible = False
|
|
End Sub
|
|
|
|
Private Sub Init_Multiple()
|
|
Label_ConfigType.Text = "- Fill Area"
|
|
PictureBox_ConfigType.BackgroundImage = Global.Wardrobe.My.Resources.Resources.Fill_Icon
|
|
|
|
PictureBox_CalculateGrid.Visible = True
|
|
|
|
Label_Width.Top = 440
|
|
TextBox_Width.Top = 440
|
|
ComboBox_Width.Top = 440
|
|
Label_WidthUnit.Top = 444
|
|
|
|
CheckBox_Frames.Top = 637
|
|
Label_Frame.Top = 659
|
|
ComboBox_Frame.Top = 659
|
|
CheckBox_CutFrame.Top = 689
|
|
|
|
' --- Max Load ---
|
|
Dim LabelTemp As New Label With {
|
|
.Name = "Label_Max_Load",
|
|
.Text = "Max Load",
|
|
.Left = 35,
|
|
.Top = 500,
|
|
.AutoSize = True,
|
|
.Font = New Font("Microsoft Sans Serif", 10),
|
|
.ForeColor = Color.White
|
|
}
|
|
Me.Panel_Data.Controls.Add(LabelTemp)
|
|
|
|
Dim textBoxTemp As New TextBox With {
|
|
.Name = "TextBox_Max_Load",
|
|
.Text = "5",
|
|
.Left = 110,
|
|
.Top = 500,
|
|
.Width = 155,
|
|
.Font = New Font("Microsoft Sans Serif", 8),
|
|
.Enabled = False,
|
|
.BackColor = Color.FromArgb(224, 224, 224)
|
|
}
|
|
AddHandler textBoxTemp.KeyPress, AddressOf TextBox_Max_Load_KeyPress
|
|
Me.Panel_Data.Controls.Add(textBoxTemp)
|
|
|
|
Dim LabelTemp2 As New Label With {
|
|
.Name = "Label_Max_Load_Unit",
|
|
.Text = "kN/m²",
|
|
.Left = 269,
|
|
.Top = 504,
|
|
.Font = New Font("Microsoft Sans Serif", 8),
|
|
.ForeColor = Color.White
|
|
}
|
|
Me.Panel_Data.Controls.Add(LabelTemp2)
|
|
|
|
' --- Max Grating weight ---
|
|
Dim LabelTemp3 As New Label With {
|
|
.Name = "Label_Max_Weight",
|
|
.Text = "Max Single",
|
|
.Left = 15,
|
|
.Top = 535,
|
|
.AutoSize = True,
|
|
.Font = New Font("Microsoft Sans Serif", 10),
|
|
.ForeColor = Color.White
|
|
}
|
|
Me.Panel_Data.Controls.Add(LabelTemp3)
|
|
' --- Max Grating weight ---
|
|
Dim LabelTemp3_2 As New Label With {
|
|
.Name = "Label_Max_Weight2",
|
|
.Text = "Grating Mass",
|
|
.Left = 15,
|
|
.Top = 552,
|
|
.AutoSize = True,
|
|
.Font = New Font("Microsoft Sans Serif", 10),
|
|
.ForeColor = Color.White
|
|
}
|
|
Me.Panel_Data.Controls.Add(LabelTemp3_2)
|
|
|
|
Dim textBoxTemp2 As New TextBox With {
|
|
.Name = "TextBox_Max_Weight",
|
|
.Text = "70",
|
|
.Left = 110,
|
|
.Top = 545,
|
|
.Width = 155,
|
|
.Font = New Font("Microsoft Sans Serif", 8),
|
|
.Enabled = False,
|
|
.BackColor = Color.FromArgb(224, 224, 224)
|
|
}
|
|
AddHandler textBoxTemp2.KeyPress, AddressOf TextBox_Max_Load_KeyPress
|
|
Me.Panel_Data.Controls.Add(textBoxTemp2)
|
|
|
|
Dim LabelTemp4 As New Label With {
|
|
.Name = "Label_Max_Weight_Unit",
|
|
.Text = "kg",
|
|
.Left = 269,
|
|
.Top = 549,
|
|
.Font = New Font("Microsoft Sans Serif", 8),
|
|
.ForeColor = Color.White
|
|
}
|
|
Me.Panel_Data.Controls.Add(LabelTemp4)
|
|
|
|
Me.ComboBox_Width.Visible = False
|
|
Me.TextBox_Width.Visible = True
|
|
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) Handles ComboBox_Width.TextChanged
|
|
User_Input.WidthChanged(sender, e)
|
|
End Sub
|
|
|
|
' --- Check if width is a number ---
|
|
Private Sub ComboBox_Width_KeyPress(sender As Object, e As KeyPressEventArgs) Handles ComboBox_Width.KeyPress
|
|
User_Input.Check_IfNumber(e)
|
|
End Sub
|
|
|
|
Private Sub ComboBox_Frame_TextChanged(sender As Object, e As EventArgs) Handles ComboBox_Frame.TextChanged
|
|
User_Input.FrameChanged(sender, e)
|
|
End Sub
|
|
|
|
' --- Grating width changed ---
|
|
Private Sub TextBox_Width_TextChanged(sender As Object, e As EventArgs) Handles TextBox_Width.TextChanged
|
|
User_Input.WidthChanged(sender, e)
|
|
End Sub
|
|
|
|
' --- Check if width is a number ---
|
|
Private Sub TextBox_Width_KeyPress(sender As Object, e As KeyPressEventArgs) Handles TextBox_Width.KeyPress
|
|
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
|
|
|
|
Private Sub TextBox_Length_Leave(sender As Object, e As EventArgs) Handles TextBox_Length.Leave
|
|
If TextBox_Length.Text <> "" Then
|
|
If AppForm.fillMode Then
|
|
If CInt(TextBox_Length.Text) < 300 Then
|
|
MessageBox.Show("Length must be at least 300 [mm]")
|
|
TextBox_Length.Focus()
|
|
End If
|
|
Else
|
|
If CInt(TextBox_Length.Text) < 300 OrElse CInt(TextBox_Length.Text) > 6000 Then
|
|
MessageBox.Show("Length must be at least 300 [mm] and max 6000 [mm]")
|
|
TextBox_Length.Focus()
|
|
End If
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub CheckBox_Frames_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox_Frames.CheckedChanged
|
|
If User_Input.addFrame = True Then
|
|
User_Input.addFrame = False
|
|
Export.CheckBox_FrameDrawing.Checked = False
|
|
Export.CheckBox_FrameDrawing.Enabled = False
|
|
User_Input.addFrameDrawing = False
|
|
CheckBox_CutFrame.Visible = False
|
|
ComboBox_Frame.Enabled = False
|
|
Else
|
|
User_Input.addFrame = True
|
|
Export.CheckBox_FrameDrawing.Enabled = True
|
|
CheckBox_CutFrame.Visible = True
|
|
ComboBox_Frame.Enabled = True
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub CheckBox_CutFrame_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox_CutFrame.CheckedChanged
|
|
If User_Input.preCutFrame = True Then
|
|
User_Input.preCutFrame = False
|
|
Else
|
|
User_Input.preCutFrame = True
|
|
End If
|
|
End Sub
|
|
|
|
' --- Check if max laod is a number ---
|
|
Public Sub TextBox_Max_Load_KeyPress(sender As Object, e As KeyPressEventArgs)
|
|
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
|
|
Middle_Rectangle.SquareMiddleButtton(sender, e)
|
|
End Sub
|
|
|
|
|
|
' ---------------------------------- Calculate Grid Button ----------------------------------
|
|
Public Sub Button_Calculate_Click(sender As Object, e As EventArgs) Handles PictureBox_CalculateGrid.Click
|
|
Calculate_Fill_Grid.Calculate_Grid()
|
|
End Sub
|
|
Private Sub PictureBox_CalculateGrid_MouseEnter(sender As Object, e As EventArgs) Handles PictureBox_CalculateGrid.MouseEnter
|
|
PictureBox_CalculateGrid.BackgroundImage = Global.Wardrobe.My.Resources.Resources.Icon_UpdateGrid2_01
|
|
PictureBox_CalculateGrid.Cursor = Cursors.Hand
|
|
End Sub
|
|
Private Sub PictureBox_CalculateGrid_MouseLeave(sender As Object, e As EventArgs) Handles PictureBox_CalculateGrid.MouseLeave
|
|
PictureBox_CalculateGrid.BackgroundImage = Global.Wardrobe.My.Resources.Resources.Icon_UpdateGrid1_01
|
|
PictureBox_CalculateGrid.Cursor = Cursors.Default
|
|
End Sub
|
|
|
|
' ---------------------------------- Export Menu Button ----------------------------------
|
|
Private Sub Button_Export_GUI_Click(sender As Object, e As EventArgs) Handles PictureBox_ExportMenu.Click
|
|
If User_Input.addFrame = True Then
|
|
Export.CheckBox_3DModel.Text = "Grating + Frame"
|
|
Else
|
|
Export.CheckBox_3DModel.Text = "Grating"
|
|
End If
|
|
|
|
Export.StartPosition = FormStartPosition.Manual
|
|
Export.Location = New Point(500, 250)
|
|
Export.PictureBox_Export.BackgroundImage = Global.Wardrobe.My.Resources.Resources.Icon_Export1_01
|
|
Export.ShowDialog()
|
|
End Sub
|
|
Private Sub PictureBox_ExportMenu_MouseEnter(sender As Object, e As EventArgs) Handles PictureBox_ExportMenu.MouseEnter
|
|
PictureBox_ExportMenu.BackgroundImage = Global.Wardrobe.My.Resources.Resources.Icon_ExportMenu2_01
|
|
PictureBox_ExportMenu.Cursor = Cursors.Hand
|
|
End Sub
|
|
Private Sub PictureBox_ExportMenu_MouseLeave(sender As Object, e As EventArgs) Handles PictureBox_ExportMenu.MouseLeave
|
|
PictureBox_ExportMenu.BackgroundImage = Global.Wardrobe.My.Resources.Resources.Icon_ExportMenu1_01
|
|
PictureBox_ExportMenu.Cursor = Cursors.Default
|
|
End Sub
|
|
|
|
|
|
End Class |