diff --git a/Wardrobe/GUI.Designer.vb b/Wardrobe/GUI.Designer.vb index de36355..54242f6 100644 --- a/Wardrobe/GUI.Designer.vb +++ b/Wardrobe/GUI.Designer.vb @@ -1,9 +1,9 @@ - _ + Partial Class GUI Inherits System.Windows.Forms.Form 'Form overrides dispose to clean up the component list. - _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) Try If disposing AndAlso components IsNot Nothing Then @@ -20,7 +20,7 @@ Partial Class GUI 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. - _ + Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container() Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(GUI)) @@ -45,15 +45,17 @@ Partial Class GUI Me.ComboBox_Length = New System.Windows.Forms.ComboBox() Me.Button_Square = New System.Windows.Forms.Button() Me.Label9 = New System.Windows.Forms.Label() + Me.ComboBox_Material = New System.Windows.Forms.ComboBox() + Me.Label_Material = New System.Windows.Forms.Label() Me.SuspendLayout() ' 'DrawingPanel ' Me.DrawingPanel.BackColor = System.Drawing.SystemColors.Window - Me.DrawingPanel.Location = New System.Drawing.Point(239, 145) - Me.DrawingPanel.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2) + Me.DrawingPanel.Location = New System.Drawing.Point(240, 145) + Me.DrawingPanel.Margin = New System.Windows.Forms.Padding(2) Me.DrawingPanel.Name = "DrawingPanel" - Me.DrawingPanel.Size = New System.Drawing.Size(1134, 559) + Me.DrawingPanel.Size = New System.Drawing.Size(1130, 560) Me.DrawingPanel.TabIndex = 0 ' 'ContextMenuStrip1 @@ -66,7 +68,7 @@ Partial Class GUI ' Me.Label1.AutoSize = True Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Label1.Location = New System.Drawing.Point(284, 49) + Me.Label1.Location = New System.Drawing.Point(864, 46) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(44, 17) Me.Label1.TabIndex = 4 @@ -76,7 +78,7 @@ Partial Class GUI ' Me.Label2.AutoSize = True Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Label2.Location = New System.Drawing.Point(273, 82) + Me.Label2.Location = New System.Drawing.Point(853, 79) Me.Label2.Name = "Label2" Me.Label2.Size = New System.Drawing.Size(52, 17) Me.Label2.TabIndex = 5 @@ -86,7 +88,7 @@ Partial Class GUI ' Me.ExportSWButton.BackColor = System.Drawing.SystemColors.ActiveCaption Me.ExportSWButton.Location = New System.Drawing.Point(1281, 717) - Me.ExportSWButton.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2) + Me.ExportSWButton.Margin = New System.Windows.Forms.Padding(2) Me.ExportSWButton.Name = "ExportSWButton" Me.ExportSWButton.Size = New System.Drawing.Size(92, 33) Me.ExportSWButton.TabIndex = 6 @@ -96,7 +98,7 @@ Partial Class GUI 'AngleButton ' Me.AngleButton.Location = New System.Drawing.Point(11, 201) - Me.AngleButton.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2) + Me.AngleButton.Margin = New System.Windows.Forms.Padding(2) Me.AngleButton.Name = "AngleButton" Me.AngleButton.Size = New System.Drawing.Size(92, 28) Me.AngleButton.TabIndex = 7 @@ -106,7 +108,7 @@ Partial Class GUI 'SettingsButton ' Me.SettingsButton.Location = New System.Drawing.Point(11, 709) - Me.SettingsButton.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2) + Me.SettingsButton.Margin = New System.Windows.Forms.Padding(2) Me.SettingsButton.Name = "SettingsButton" Me.SettingsButton.Size = New System.Drawing.Size(60, 41) Me.SettingsButton.TabIndex = 12 @@ -119,7 +121,7 @@ Partial Class GUI Me.ComboBox_TypeChooser.FormattingEnabled = True Me.ComboBox_TypeChooser.Items.AddRange(New Object() {"Pressure Welded", "Type A"}) Me.ComboBox_TypeChooser.Location = New System.Drawing.Point(91, 46) - Me.ComboBox_TypeChooser.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2) + Me.ComboBox_TypeChooser.Margin = New System.Windows.Forms.Padding(2) Me.ComboBox_TypeChooser.Name = "ComboBox_TypeChooser" Me.ComboBox_TypeChooser.Size = New System.Drawing.Size(141, 21) Me.ComboBox_TypeChooser.TabIndex = 13 @@ -131,8 +133,8 @@ Partial Class GUI Me.ComboBox_MeshSize.Enabled = False Me.ComboBox_MeshSize.FormattingEnabled = True Me.ComboBox_MeshSize.Items.AddRange(New Object() {"12x100 (B9)", "25x50 (F4)", "34x37 (H3)"}) - Me.ComboBox_MeshSize.Location = New System.Drawing.Point(91, 81) - Me.ComboBox_MeshSize.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2) + Me.ComboBox_MeshSize.Location = New System.Drawing.Point(380, 46) + Me.ComboBox_MeshSize.Margin = New System.Windows.Forms.Padding(2) Me.ComboBox_MeshSize.Name = "ComboBox_MeshSize" Me.ComboBox_MeshSize.Size = New System.Drawing.Size(141, 21) Me.ComboBox_MeshSize.TabIndex = 14 @@ -143,8 +145,8 @@ Partial Class GUI Me.ComboBox_Thickness.Enabled = False Me.ComboBox_Thickness.FormattingEnabled = True Me.ComboBox_Thickness.Items.AddRange(New Object() {"2", "3", "4"}) - Me.ComboBox_Thickness.Location = New System.Drawing.Point(577, 45) - Me.ComboBox_Thickness.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2) + Me.ComboBox_Thickness.Location = New System.Drawing.Point(640, 88) + Me.ComboBox_Thickness.Margin = New System.Windows.Forms.Padding(2) Me.ComboBox_Thickness.Name = "ComboBox_Thickness" Me.ComboBox_Thickness.Size = New System.Drawing.Size(141, 21) Me.ComboBox_Thickness.TabIndex = 15 @@ -155,8 +157,8 @@ Partial Class GUI Me.ComboBox_Height.Enabled = False Me.ComboBox_Height.FormattingEnabled = True Me.ComboBox_Height.Items.AddRange(New Object() {"20", "25", "30"}) - Me.ComboBox_Height.Location = New System.Drawing.Point(577, 79) - Me.ComboBox_Height.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2) + Me.ComboBox_Height.Location = New System.Drawing.Point(640, 47) + Me.ComboBox_Height.Margin = New System.Windows.Forms.Padding(2) Me.ComboBox_Height.Name = "ComboBox_Height" Me.ComboBox_Height.Size = New System.Drawing.Size(141, 21) Me.ComboBox_Height.TabIndex = 16 @@ -175,7 +177,7 @@ Partial Class GUI ' Me.Label4.AutoSize = True Me.Label4.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Label4.Location = New System.Drawing.Point(13, 82) + Me.Label4.Location = New System.Drawing.Point(302, 47) Me.Label4.Name = "Label4" Me.Label4.Size = New System.Drawing.Size(73, 17) Me.Label4.TabIndex = 18 @@ -185,7 +187,7 @@ Partial Class GUI ' Me.Label5.AutoSize = True Me.Label5.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Label5.Location = New System.Drawing.Point(500, 46) + Me.Label5.Location = New System.Drawing.Point(563, 89) Me.Label5.Name = "Label5" Me.Label5.Size = New System.Drawing.Size(72, 17) Me.Label5.TabIndex = 19 @@ -195,7 +197,7 @@ Partial Class GUI ' Me.Label6.AutoSize = True Me.Label6.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Label6.Location = New System.Drawing.Point(523, 79) + Me.Label6.Location = New System.Drawing.Point(586, 47) Me.Label6.Name = "Label6" Me.Label6.Size = New System.Drawing.Size(49, 17) Me.Label6.TabIndex = 20 @@ -227,24 +229,22 @@ Partial Class GUI Me.ComboBox_Width.Enabled = False Me.ComboBox_Width.FormattingEnabled = True Me.ComboBox_Width.Items.AddRange(New Object() {"500", "700", "722", "1000"}) - Me.ComboBox_Width.Location = New System.Drawing.Point(333, 49) - Me.ComboBox_Width.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2) + Me.ComboBox_Width.Location = New System.Drawing.Point(913, 46) + Me.ComboBox_Width.Margin = New System.Windows.Forms.Padding(2) Me.ComboBox_Width.Name = "ComboBox_Width" Me.ComboBox_Width.Size = New System.Drawing.Size(141, 21) Me.ComboBox_Width.TabIndex = 23 - Me.ComboBox_Width.Text = "1000" ' 'ComboBox_Length ' Me.ComboBox_Length.Enabled = False Me.ComboBox_Length.FormattingEnabled = True - Me.ComboBox_Length.Items.AddRange(New Object() {"300", "600", "900", "1000"}) - Me.ComboBox_Length.Location = New System.Drawing.Point(333, 82) - Me.ComboBox_Length.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2) + Me.ComboBox_Length.Items.AddRange(New Object() {"300", "600", "900", "1000", "3000"}) + Me.ComboBox_Length.Location = New System.Drawing.Point(913, 79) + Me.ComboBox_Length.Margin = New System.Windows.Forms.Padding(2) Me.ComboBox_Length.Name = "ComboBox_Length" Me.ComboBox_Length.Size = New System.Drawing.Size(141, 21) Me.ComboBox_Length.TabIndex = 24 - Me.ComboBox_Length.Text = "1000" ' 'Button_Square ' @@ -265,11 +265,35 @@ Partial Class GUI Me.Label9.TabIndex = 26 Me.Label9.Text = "Floor gratings data" ' + 'ComboBox_Material + ' + Me.ComboBox_Material.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList + Me.ComboBox_Material.Enabled = False + Me.ComboBox_Material.FormattingEnabled = True + Me.ComboBox_Material.Items.AddRange(New Object() {"12x100 (B9)", "25x50 (F4)", "34x37 (H3)"}) + Me.ComboBox_Material.Location = New System.Drawing.Point(91, 88) + Me.ComboBox_Material.Margin = New System.Windows.Forms.Padding(2) + Me.ComboBox_Material.Name = "ComboBox_Material" + Me.ComboBox_Material.Size = New System.Drawing.Size(141, 21) + Me.ComboBox_Material.TabIndex = 27 + ' + 'Label_Material + ' + Me.Label_Material.AutoSize = True + Me.Label_Material.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Label_Material.Location = New System.Drawing.Point(28, 88) + Me.Label_Material.Name = "Label_Material" + Me.Label_Material.Size = New System.Drawing.Size(58, 17) + Me.Label_Material.TabIndex = 28 + Me.Label_Material.Text = "Material" + ' 'GUI ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(1384, 761) + Me.Controls.Add(Me.ComboBox_Material) + Me.Controls.Add(Me.Label_Material) Me.Controls.Add(Me.Label9) Me.Controls.Add(Me.Button_Square) Me.Controls.Add(Me.ComboBox_Length) @@ -321,4 +345,6 @@ Partial Class GUI Friend WithEvents ComboBox_Length As ComboBox Friend WithEvents Button_Square As Button Friend WithEvents Label9 As Label + Friend WithEvents ComboBox_Material As ComboBox + Friend WithEvents Label_Material As Label End Class diff --git a/Wardrobe/GUI.resx b/Wardrobe/GUI.resx index 8845183..d2e1272 100644 --- a/Wardrobe/GUI.resx +++ b/Wardrobe/GUI.resx @@ -123,6 +123,9 @@ + + 83 + diff --git a/Wardrobe/GUI.vb b/Wardrobe/GUI.vb index e165419..b222f2c 100644 --- a/Wardrobe/GUI.vb +++ b/Wardrobe/GUI.vb @@ -1,18 +1,19 @@ Imports XCCLibrary Public Class GUI - 'Public Shared filepath As String = "C:\Users\Anton\Documents\Exjobb" - Public Shared filepath As String = "C:\Users\xperd\OneDrive\Dokument\Exjobb" + Public Shared filepath As String = "C:\Users\Anton\Documents\Exjobb" + 'Public Shared filepath As String = "C:\Users\xperd\OneDrive\Dokument\Exjobb" + Dim filesFolder As String = filepath ' Hämta från settings Dim HLCtFolder As String = filepath & "\X2021" ' Hämta från settings Dim containerPanel As Panel - Dim containerW, containerH, containerMidX, containerMidY As Integer - Dim gratingMaxL As Decimal = 1000 + Dim containerL, containerW, containerMidX, containerMidY As Integer Dim gratingMaxW As Decimal = 1000 + Dim gratingMaxL As Decimal = 1000 + Dim drawL As Integer = 1 Dim drawW As Integer = 1 - Dim drawH As Integer = 1 Dim drawAspect, gratingAspect As Decimal Dim scaleDiff As Decimal = 1 @@ -21,13 +22,16 @@ Public Class GUI Public pCon3(3) As Decimal Public pCon4(3) As Decimal - Dim symbolPoints As New Dictionary(Of String, Decimal()) + Dim DirSymbolPoints As New Dictionary(Of String, Decimal()) + Dim ArrowSymbolPoints As New Dictionary(Of String, Decimal()) Dim points As New Dictionary(Of String, Decimal()) Dim pointsFunc As New Dictionary(Of String, Boolean) Dim pointsOrder As New List(Of String) - 'Dim PointButtons As New List(Of Button) + Dim gratingType, gratingMaterial, gratingMesh As String + Dim gratingSerrated As Boolean + Dim loadBarSpacing, crossBarSpacing, gratingHeight, loadBarThickness As Integer Dim pointCounter As Integer Dim angleFunctionActive As Boolean = False @@ -36,6 +40,8 @@ Public Class GUI ' --- Start method (main) for GUI --- Sub GUI_load() Handles MyBase.Load containerPanel = DrawingPanel + Me.Width = 1400 + Me.Height = 800 AddHandler containerPanel.Paint, AddressOf DrawingPanel_Paint Get_DrawboxParameters() @@ -43,9 +49,10 @@ Public Class GUI Set_ContainerPointsX() Set_ContainerPointsY() - Create_SymbolPoints() + Create_DirSymbolPoints() + Create_ArrowSymbolPoints() - Update_GratingDimensions() + Update_GratingPoints() Create_StartPoints() @@ -54,69 +61,85 @@ Public Class GUI ' --- Retrive parameters for the drawing box --- Private Sub Get_DrawboxParameters() - containerW = containerPanel.Size.Width - containerH = containerPanel.Size.Height + containerL = containerPanel.Size.Width + containerW = containerPanel.Size.Height - containerMidX = containerW / 2 - containerMidY = containerH / 2 + containerMidX = containerL / 2 + containerMidY = containerW / 2 - drawW = containerW - 60 - drawH = containerH - 60 + drawL = containerL - 80 + drawW = containerW - 80 - drawAspect = drawW / drawH + drawAspect = drawL / drawW End Sub ' --- Set containers points X-values --- Private Sub Set_ContainerPointsX() - pCon1(0) = containerMidX - drawW / 2 - pCon2(0) = containerMidX + drawW / 2 - pCon3(0) = containerMidX + drawW / 2 - pCon4(0) = containerMidX - drawW / 2 + pCon1(0) = containerMidX - drawL / 2 + pCon2(0) = containerMidX + drawL / 2 + pCon3(0) = containerMidX + drawL / 2 + pCon4(0) = containerMidX - drawL / 2 End Sub ' --- Set containers points Y-values --- Private Sub Set_ContainerPointsY() - pCon1(1) = containerMidY - drawH / 2 - pCon2(1) = containerMidY - drawH / 2 - pCon3(1) = containerMidY + drawH / 2 - pCon4(1) = containerMidY + drawH / 2 + pCon1(1) = containerMidY - drawW / 2 + pCon2(1) = containerMidY - drawW / 2 + pCon3(1) = containerMidY + drawW / 2 + pCon4(1) = containerMidY + drawW / 2 End Sub ' --- Create points for grating direction symbol --- - Private Sub Create_SymbolPoints() - symbolPoints.Add("p1", {-30 + containerMidX, -2 + containerMidY}) - symbolPoints.Add("p2", {20 + containerMidX, -2 + containerMidY}) - symbolPoints.Add("p3", {12 + containerMidX, -10 + containerMidY}) - symbolPoints.Add("p4", {15 + containerMidX, -13 + containerMidY}) - symbolPoints.Add("p5", {30 + containerMidX, 2 + containerMidY}) - symbolPoints.Add("p6", {-20 + containerMidX, 2 + containerMidY}) - symbolPoints.Add("p7", {-12 + containerMidX, 10 + containerMidY}) - symbolPoints.Add("p8", {-15 + containerMidX, 13 + containerMidY}) - symbolPoints.Add("p9", {-30 + containerMidX, -2 + containerMidY}) + Private Sub Create_DirSymbolPoints() + DirSymbolPoints.Add("p1", {-30 + containerMidX, -2 + containerMidY}) + DirSymbolPoints.Add("p2", {20 + containerMidX, -2 + containerMidY}) + DirSymbolPoints.Add("p3", {12 + containerMidX, -10 + containerMidY}) + DirSymbolPoints.Add("p4", {15 + containerMidX, -13 + containerMidY}) + DirSymbolPoints.Add("p5", {30 + containerMidX, 2 + containerMidY}) + DirSymbolPoints.Add("p6", {-20 + containerMidX, 2 + containerMidY}) + DirSymbolPoints.Add("p7", {-12 + containerMidX, 10 + containerMidY}) + DirSymbolPoints.Add("p8", {-15 + containerMidX, 13 + containerMidY}) + DirSymbolPoints.Add("p9", {-30 + containerMidX, -2 + containerMidY}) End Sub - ' --- Updates the outer dimensions of the grating --- - Private Sub Update_GratingDimensions() - gratingAspect = gratingMaxW / gratingMaxL + ' --- Create points for arrow symbol --- + Private Sub Create_ArrowSymbolPoints() + Dim offset As Integer = 20 + ArrowSymbolPoints.Add("p1", {offset, containerW - offset}) + ArrowSymbolPoints.Add("p2", {offset, containerW - offset - 40}) + ArrowSymbolPoints.Add("p3", {offset - 5, containerW - offset - 35}) + ArrowSymbolPoints.Add("p4", {offset, containerW - offset - 40}) + ArrowSymbolPoints.Add("p5", {offset + 5, containerW - offset - 35}) + ArrowSymbolPoints.Add("p6", {offset, containerW - offset - 40}) + ArrowSymbolPoints.Add("p7", {offset, containerW - offset}) + ArrowSymbolPoints.Add("p8", {offset + 40, containerW - offset}) + ArrowSymbolPoints.Add("p9", {offset + 35, containerW - offset - 5}) + ArrowSymbolPoints.Add("p10", {offset + 40, containerW - offset}) + ArrowSymbolPoints.Add("p11", {offset + 35, containerW - offset + 5}) + End Sub + + ' --- Updates all the gratings points --- + Private Sub Update_GratingPoints() + gratingAspect = gratingMaxL / gratingMaxW If gratingAspect > drawAspect Then 'Change draw height - scaleDiff = gratingMaxW / drawW + scaleDiff = gratingMaxL / drawL - pCon1(1) = containerMidY - gratingMaxL / (scaleDiff * 2) - pCon2(1) = containerMidY - gratingMaxL / (scaleDiff * 2) - pCon3(1) = containerMidY + gratingMaxL / (scaleDiff * 2) - pCon4(1) = containerMidY + gratingMaxL / (scaleDiff * 2) + pCon1(1) = containerMidY - gratingMaxW / (scaleDiff * 2) + pCon2(1) = containerMidY - gratingMaxW / (scaleDiff * 2) + pCon3(1) = containerMidY + gratingMaxW / (scaleDiff * 2) + pCon4(1) = containerMidY + gratingMaxW / (scaleDiff * 2) Set_ContainerPointsX() Else 'Change draw width - scaleDiff = gratingMaxL / drawH + scaleDiff = gratingMaxW / drawW - pCon1(0) = containerMidX - gratingMaxW / (scaleDiff * 2) - pCon2(0) = containerMidX + gratingMaxW / (scaleDiff * 2) - pCon3(0) = containerMidX + gratingMaxW / (scaleDiff * 2) - pCon4(0) = containerMidX - gratingMaxW / (scaleDiff * 2) + pCon1(0) = containerMidX - gratingMaxL / (scaleDiff * 2) + pCon2(0) = containerMidX + gratingMaxL / (scaleDiff * 2) + pCon3(0) = containerMidX + gratingMaxL / (scaleDiff * 2) + pCon4(0) = containerMidX - gratingMaxL / (scaleDiff * 2) Set_ContainerPointsY() End If @@ -125,16 +148,16 @@ Public Class GUI Me.Refresh() 'SW X-values - pCon1(2) = (-gratingMaxW / 2) / 1000 - pCon2(2) = (gratingMaxW / 2) / 1000 - pCon3(2) = (gratingMaxW / 2) / 1000 - pCon4(2) = (-gratingMaxW / 2) / 1000 + pCon1(2) = (-gratingMaxL / 2) / 1000 + pCon2(2) = (gratingMaxL / 2) / 1000 + pCon3(2) = (gratingMaxL / 2) / 1000 + pCon4(2) = (-gratingMaxL / 2) / 1000 'SW Y-values - pCon1(3) = (gratingMaxL / 2) / 1000 - pCon2(3) = (gratingMaxL / 2) / 1000 - pCon3(3) = (-gratingMaxL / 2) / 1000 - pCon4(3) = (-gratingMaxL / 2) / 1000 + pCon1(3) = (gratingMaxW / 2) / 1000 + pCon2(3) = (gratingMaxW / 2) / 1000 + pCon3(3) = (-gratingMaxW / 2) / 1000 + pCon4(3) = (-gratingMaxW / 2) / 1000 End Sub ' --- Draw all the lines for the container and grating --- @@ -149,12 +172,23 @@ Public Class GUI ' Draw grating direction symbol Dim symPen As Pen = New Pen(Color.Black, 1) - For i = 1 To symbolPoints.Count - 1 - e.Graphics.DrawLine(symPen, symbolPoints("p" & i)(0), symbolPoints("p" & i)(1), symbolPoints("p" & i + 1)(0), symbolPoints("p" & i + 1)(1)) + For i = 1 To DirSymbolPoints.Count - 1 + e.Graphics.DrawLine(symPen, DirSymbolPoints("p" & i)(0), DirSymbolPoints("p" & i)(1), DirSymbolPoints("p" & i + 1)(0), DirSymbolPoints("p" & i + 1)(1)) Next + ' Draw arrow symbol + For i = 1 To ArrowSymbolPoints.Count - 1 + e.Graphics.DrawLine(symPen, ArrowSymbolPoints("p" & i)(0), ArrowSymbolPoints("p" & i)(1), ArrowSymbolPoints("p" & i + 1)(0), ArrowSymbolPoints("p" & i + 1)(1)) + Next + e.Graphics.TranslateTransform(20, containerW - 20) + e.Graphics.DrawString("Length", New Font("Microsoft Sans Serif", 8), Brushes.Black, New Point(45, -7)) + e.Graphics.RotateTransform(-90) + e.Graphics.DrawString("Width", New Font("Microsoft Sans Serif", 8), Brushes.Black, New Point(45, -4)) + e.Graphics.RotateTransform(90) + e.Graphics.TranslateTransform(-20, -containerW + 20) + ' Draw actual grating (black) - Dim pen As Pen = New Pen(Color.Black, 1) + Dim pen As Pen = New Pen(Color.Black, 2) For i = 0 To pointsOrder.Count - 1 Dim pTemp1() As Decimal Dim pTemp2() As Decimal @@ -276,9 +310,52 @@ Public Class GUI ' --- When user changes grating type --- Private Sub ComboBox_TypeChooser_TextChanged(sender As Object, e As EventArgs) Handles ComboBox_TypeChooser.TextChanged + gratingType = ComboBox_TypeChooser.Text + ComboBox_Material.Enabled = True + ComboBox_Material.Items.Clear() + If gratingType = "Pressure Welded" Then + ComboBox_Material.Items.Add("Standard") + ComboBox_Material.Items.Add("Acid-proof") + ComboBox_Material.Items.Add("Stainless Steel (Pickled)") + ComboBox_Material.Items.Add("Stainless Steel (Untreated)") + ComboBox_Material.Items.Add("Untreated") + Else + ComboBox_Material.Items.Add("Standard") + ComboBox_Material.Items.Add("Stainless Steel (Pickled)") + ComboBox_Material.Items.Add("Stainless Steel (Untreated)") + ComboBox_Material.Items.Add("Aluminum") + ComboBox_Material.Items.Add("Untreated") + End If + ComboBox_Material.Text = ComboBox_Material.Items(0) + End Sub + + ' --- When user changes grating material --- + Private Sub ComboBox_Material_TextChanged(sender As Object, e As EventArgs) Handles ComboBox_Material.TextChanged ComboBox_MeshSize.Enabled = True ComboBox_MeshSize.Items.Clear() - Dim gratingType As String = ComboBox_TypeChooser.Text + gratingMaterial = ComboBox_Material.Text + gratingSerrated = False 'FIXA + + ' Add toothing option + If gratingType = "Pressure Welded" Then + If gratingMaterial = "Standard" Or gratingMaterial = "Stainless Steel (Pickled)" Then + Dim serratedCheckBox As New CheckBox + serratedCheckBox.Name = "CheckBox_Serrated" + serratedCheckBox.Text = "Serrated" + serratedCheckBox.Left = 115 + serratedCheckBox.Top = 115 + Me.Controls.Add(serratedCheckBox) + End If + ElseIf gratingMaterial = "Standard" Or gratingMaterial = "Aluminum" Then + Dim serratedCheckBox As New CheckBox + serratedCheckBox.Name = "CheckBox_Serrated" + serratedCheckBox.Text = "Serrated" + serratedCheckBox.Left = 115 + serratedCheckBox.Top = 115 + Me.Controls.Add(serratedCheckBox) + End If + + ' Add Meshes If gratingType = "Pressure Welded" Then ComboBox_MeshSize.Items.Add("12x100 (B9)") 'Tillfällig ComboBox_MeshSize.Items.Add("25x50 (F4)") 'Tillfällig @@ -288,6 +365,9 @@ Public Class GUI ' ComboBox_MeshSize.Items.Add("hej " & i) 'Hämta från databas 'Next Else + ComboBox_MeshSize.Items.Add("22x22") 'Tillfällig + ComboBox_MeshSize.Items.Add("33x11") 'Tillfällig + 'For i = 1 To 5 ' ComboBox_MeshSize.Items.Add("Test " & i) 'Hämta från databas 'Next @@ -296,19 +376,61 @@ Public Class GUI ' --- When user changes mesh size --- Private Sub ComboBox_MeshSize_TextChanged(sender As Object, e As EventArgs) Handles ComboBox_MeshSize.TextChanged - ComboBox_Width.Enabled = True - ComboBox_Length.Enabled = True - ComboBox_Thickness.Enabled = True ComboBox_Height.Enabled = True - ' Uppdatera fälten med avseende på mesh size + ComboBox_Height.Items.Clear() + gratingMesh = ComboBox_MeshSize.Text + loadBarSpacing = CInt(gratingMesh.Split("x")(0)) + crossBarSpacing = CInt(gratingMesh.Split("x")(1).Split(" ")(0)) + + ' Add heights + If loadBarSpacing = 12 And crossBarSpacing = 100 Then + ComboBox_Height.Items.Add("20") + ComboBox_Height.Items.Add("25") + End If End Sub + ' --- When user changes grating height --- + Private Sub ComboBox_Height_TextChanged(sender As Object, e As EventArgs) Handles ComboBox_Height.TextChanged + ComboBox_Thickness.Enabled = True + ComboBox_Thickness.Items.Clear() + gratingHeight = CInt(ComboBox_Height.Text) + + ' Add thicknesses + If gratingHeight = 20 Then + ComboBox_Thickness.Items.Add("2") + ComboBox_Thickness.Items.Add("3") + End If + End Sub + + ' --- When user changes grating thickness --- + Private Sub ComboBox_Thickness_TextChanged(sender As Object, e As EventArgs) Handles ComboBox_Thickness.TextChanged + ComboBox_Width.Enabled = True + ComboBox_Width.Items.Clear() + ComboBox_Length.Enabled = True + ComboBox_Length.Items.Clear() + loadBarThickness = CInt(ComboBox_Thickness.Text) + + ' Add Widths + ComboBox_Width.Items.Add("300") + ComboBox_Width.Items.Add("500") + ComboBox_Width.Items.Add("1000") + ComboBox_Width.Text = ComboBox_Width.Items(0) + + ' Add Length + ComboBox_Length.Items.Add("500") + ComboBox_Length.Items.Add("1000") + ComboBox_Length.Text = ComboBox_Length.Items(0) + End Sub + + + + ' --- Grating width changed --- Private Sub WidthB_TextChanged(sender As Object, e As EventArgs) Handles ComboBox_Width.TextChanged If ComboBox_Width.Text <> "" Then If CDec(ComboBox_Width.Text) > 0 Then gratingMaxW = CDec(ComboBox_Width.Text) - Update_GratingDimensions() + Update_GratingPoints() End If End If End Sub @@ -323,7 +445,7 @@ Public Class GUI If ComboBox_Length.Text <> "" Then If CDec(ComboBox_Length.Text) > 0 Then gratingMaxL = CDec(ComboBox_Length.Text) - Update_GratingDimensions() + Update_GratingPoints() End If End If End Sub @@ -333,6 +455,8 @@ Public Class GUI Check_IfNumber(e) End Sub + + ' --- When angle button is pressed --- Private Sub AngleButton_Click(sender As Object, e As EventArgs) Handles AngleButton.Click Me.Controls("AngleButton").Enabled = False @@ -373,6 +497,7 @@ Public Class GUI squareFunctionActive = True End Sub + Private Sub FunctionText_Changed(sender As TextBox, e As EventArgs) If Not Me.Controls("X_TextBox").Text = "" And Not Me.Controls("Y_TextBox").Text = "" Then If containerPanel.Controls.Count = 0 Then @@ -537,7 +662,7 @@ Public Class GUI exportTable = Create_ExportTable() - 'Program.Build_Grating(exportTable) + Program.Build_Grating(exportTable) 'Test för att SW API Dim pointTable As New DataTable