diff --git a/HLCt/pressure_welded.SLDPRT b/HLCt/pressure_welded.SLDPRT index 7132552..fe91469 100644 Binary files a/HLCt/pressure_welded.SLDPRT and b/HLCt/pressure_welded.SLDPRT differ diff --git a/Wardrobe/GUI.Designer.vb b/Wardrobe/GUI.Designer.vb index 81f4830..b683837 100644 --- a/Wardrobe/GUI.Designer.vb +++ b/Wardrobe/GUI.Designer.vb @@ -25,10 +25,9 @@ Partial Class GUI Me.components = New System.ComponentModel.Container() Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(GUI)) Me.DrawingPanel = New System.Windows.Forms.Panel() - Me.HeightBox = New System.Windows.Forms.TextBox() + Me.LengthBox = New System.Windows.Forms.TextBox() Me.WidthBox = New System.Windows.Forms.TextBox() Me.ContextMenuStrip1 = New System.Windows.Forms.ContextMenuStrip(Me.components) - Me.UpdateButton = New System.Windows.Forms.Button() Me.Label1 = New System.Windows.Forms.Label() Me.Label2 = New System.Windows.Forms.Label() Me.ExportSWButton = New System.Windows.Forms.Button() @@ -37,6 +36,7 @@ Partial Class GUI Me.AngleD2 = New System.Windows.Forms.TextBox() Me.LabelAngleX = New System.Windows.Forms.Label() Me.LabelAngleY = New System.Windows.Forms.Label() + Me.SettingsButton = New System.Windows.Forms.Button() Me.SuspendLayout() ' 'DrawingPanel @@ -48,15 +48,15 @@ Partial Class GUI Me.DrawingPanel.Size = New System.Drawing.Size(865, 484) Me.DrawingPanel.TabIndex = 0 ' - 'HeightBox + 'LengthBox ' - Me.HeightBox.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.HeightBox.Location = New System.Drawing.Point(671, 63) - Me.HeightBox.Margin = New System.Windows.Forms.Padding(3, 2, 3, 2) - Me.HeightBox.Name = "HeightBox" - Me.HeightBox.Size = New System.Drawing.Size(100, 26) - Me.HeightBox.TabIndex = 1 - Me.HeightBox.Text = "1000" + Me.LengthBox.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.LengthBox.Location = New System.Drawing.Point(671, 63) + Me.LengthBox.Margin = New System.Windows.Forms.Padding(3, 2, 3, 2) + Me.LengthBox.Name = "LengthBox" + Me.LengthBox.Size = New System.Drawing.Size(100, 26) + Me.LengthBox.TabIndex = 1 + Me.LengthBox.Text = "1200" ' 'WidthBox ' @@ -66,7 +66,7 @@ Partial Class GUI Me.WidthBox.Name = "WidthBox" Me.WidthBox.Size = New System.Drawing.Size(100, 26) Me.WidthBox.TabIndex = 2 - Me.WidthBox.Text = "1000" + Me.WidthBox.Text = "1200" ' 'ContextMenuStrip1 ' @@ -74,16 +74,6 @@ Partial Class GUI Me.ContextMenuStrip1.Name = "ContextMenuStrip1" Me.ContextMenuStrip1.Size = New System.Drawing.Size(61, 4) ' - 'UpdateButton - ' - Me.UpdateButton.Location = New System.Drawing.Point(806, 62) - Me.UpdateButton.Margin = New System.Windows.Forms.Padding(3, 2, 3, 2) - Me.UpdateButton.Name = "UpdateButton" - Me.UpdateButton.Size = New System.Drawing.Size(75, 30) - Me.UpdateButton.TabIndex = 3 - Me.UpdateButton.Text = "Update" - Me.UpdateButton.UseVisualStyleBackColor = True - ' 'Label1 ' Me.Label1.AutoSize = True @@ -99,12 +89,12 @@ 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(606, 66) + Me.Label2.Location = New System.Drawing.Point(604, 65) Me.Label2.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) Me.Label2.Name = "Label2" - Me.Label2.Size = New System.Drawing.Size(58, 20) + Me.Label2.Size = New System.Drawing.Size(60, 20) Me.Label2.TabIndex = 5 - Me.Label2.Text = "Height" + Me.Label2.Text = "Length" ' 'ExportSWButton ' @@ -163,11 +153,21 @@ Partial Class GUI Me.LabelAngleY.TabIndex = 11 Me.LabelAngleY.Text = "Y" ' + 'SettingsButton + ' + Me.SettingsButton.Location = New System.Drawing.Point(12, 11) + Me.SettingsButton.Name = "SettingsButton" + Me.SettingsButton.Size = New System.Drawing.Size(80, 50) + Me.SettingsButton.TabIndex = 12 + Me.SettingsButton.Text = "Settings" + Me.SettingsButton.UseVisualStyleBackColor = True + ' 'GUI ' Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 16.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(1199, 614) + Me.Controls.Add(Me.SettingsButton) Me.Controls.Add(Me.LabelAngleY) Me.Controls.Add(Me.LabelAngleX) Me.Controls.Add(Me.AngleD2) @@ -176,9 +176,8 @@ Partial Class GUI Me.Controls.Add(Me.ExportSWButton) Me.Controls.Add(Me.Label2) Me.Controls.Add(Me.Label1) - Me.Controls.Add(Me.UpdateButton) Me.Controls.Add(Me.WidthBox) - Me.Controls.Add(Me.HeightBox) + Me.Controls.Add(Me.LengthBox) Me.Controls.Add(Me.DrawingPanel) Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) Me.Margin = New System.Windows.Forms.Padding(4) @@ -190,10 +189,9 @@ Partial Class GUI End Sub Friend WithEvents DrawingPanel As Panel - Friend WithEvents HeightBox As TextBox + Friend WithEvents LengthBox As TextBox Friend WithEvents WidthBox As TextBox Friend WithEvents ContextMenuStrip1 As ContextMenuStrip - Friend WithEvents UpdateButton As Button Friend WithEvents Label1 As Label Friend WithEvents Label2 As Label Friend WithEvents ExportSWButton As Button @@ -202,4 +200,5 @@ Partial Class GUI Friend WithEvents AngleD2 As TextBox Friend WithEvents LabelAngleX As Label Friend WithEvents LabelAngleY As Label + Friend WithEvents SettingsButton As Button End Class diff --git a/Wardrobe/GUI.vb b/Wardrobe/GUI.vb index 8380df2..dfdc890 100644 --- a/Wardrobe/GUI.vb +++ b/Wardrobe/GUI.vb @@ -1,13 +1,15 @@ Imports XCCLibrary Public Class GUI - Public Shared filesFolder As String = "C:\Users\Anton\Documents\Exjobb" - Public Shared HLCtFolder As String = "C:\Users\Anton\Documents\Exjobb\X2021" + Dim filesFolder As String = "C:\Users\Anton\Documents\Exjobb" + Dim HLCtFolder As String = "C:\Users\Anton\Documents\Exjobb\X2021" Dim containerPanel As Panel Dim containerX, containerY, containerW, containerH, containerMidX, containerMidY As Integer - Dim gratingMaxW, gratingMaxH As Decimal - Dim drawW, drawH As Integer + Dim gratingMaxL As Decimal = 1200 + Dim gratingMaxW As Decimal = 1200 + Dim drawW As Integer = 1 + Dim drawH As Integer = 1 Dim drawAspect, gratingAspect As Decimal Dim scaleDiff As Decimal = 1 @@ -33,6 +35,8 @@ Public Class GUI Set_ContainerPointsX() Set_ContainerPointsY() + Update_GratingDimensions() + Create_StartPoints() Program.Load_XCC(filesFolder, HLCtFolder) @@ -71,6 +75,8 @@ Public Class GUI pCon4(1) = containerMidY + drawH / 2 End Sub + + ' --- Sets the start points for the grating --- Private Sub Create_StartPoints() For i = 1 To 4 @@ -79,6 +85,8 @@ Public Class GUI Next End Sub + + ' --- Draw all the lines for the container and grating --- Private Sub DrawingPanel_Paint(sender As Object, e As System.Windows.Forms.PaintEventArgs) Dim penCon As Pen = New Pen(Color.DarkRed, 1) @@ -126,24 +134,44 @@ Public Class GUI ' ---------------------------------- GUI interactions ---------------------------------- - ' --- When update button is pressed --- - Private Sub UpdateButton_Click(sender As Object, e As EventArgs) Handles UpdateButton.Click - gratingMaxH = HeightBox.Text - gratingMaxW = WidthBox.Text - gratingAspect = gratingMaxW / gratingMaxH + Private Sub SettingsButton_Click(sender As Object, e As EventArgs) Handles SettingsButton.Click + Program.Update_KB() + End Sub + + Private Sub WidthBox_TextChanged(sender As Object, e As EventArgs) Handles WidthBox.TextChanged + If WidthBox.Text <> "" Then + If CDec(WidthBox.Text) > 0 Then + gratingMaxW = CDec(WidthBox.Text) + Update_GratingDimensions() + End If + End If + End Sub + + Private Sub LengthBox_TextChanged(sender As Object, e As EventArgs) Handles LengthBox.TextChanged + If LengthBox.Text <> "" Then + If CDec(LengthBox.Text) > 0 Then + gratingMaxL = CDec(LengthBox.Text) + Update_GratingDimensions() + End If + End If + End Sub + + Private Sub Update_GratingDimensions() + gratingAspect = gratingMaxW / gratingMaxL + If gratingAspect > drawAspect Then 'Change draw height scaleDiff = gratingMaxW / drawW - pCon1(1) = containerMidY - gratingMaxH / (scaleDiff * 2) - pCon2(1) = containerMidY - gratingMaxH / (scaleDiff * 2) - pCon3(1) = containerMidY + gratingMaxH / (scaleDiff * 2) - pCon4(1) = containerMidY + gratingMaxH / (scaleDiff * 2) + pCon1(1) = containerMidY - gratingMaxL / (scaleDiff * 2) + pCon2(1) = containerMidY - gratingMaxL / (scaleDiff * 2) + pCon3(1) = containerMidY + gratingMaxL / (scaleDiff * 2) + pCon4(1) = containerMidY + gratingMaxL / (scaleDiff * 2) Set_ContainerPointsX() Else 'Change draw width - scaleDiff = gratingMaxH / drawH + scaleDiff = gratingMaxL / drawH pCon1(0) = containerMidX - gratingMaxW / (scaleDiff * 2) pCon2(0) = containerMidX + gratingMaxW / (scaleDiff * 2) @@ -163,12 +191,13 @@ Public Class GUI pCon4(2) = (-gratingMaxW / 2) / 1000 'SW Y-values - pCon1(3) = (gratingMaxH / 2) / 1000 - pCon2(3) = (gratingMaxH / 2) / 1000 - pCon3(3) = (-gratingMaxH / 2) / 1000 - pCon4(3) = (-gratingMaxH / 2) / 1000 + pCon1(3) = (gratingMaxL / 2) / 1000 + pCon2(3) = (gratingMaxL / 2) / 1000 + pCon3(3) = (-gratingMaxL / 2) / 1000 + pCon4(3) = (-gratingMaxL / 2) / 1000 End Sub + ' --- When angle button is pressed --- Private Sub AngleButton_Click(sender As Object, e As EventArgs) Handles AngleButton.Click ' Create Buttons for all clickable points @@ -258,8 +287,6 @@ Public Class GUI ' --- When export to SW button is pressed --- Private Sub ExportSWButton_Click(sender As Object, e As EventArgs) Handles ExportSWButton.Click - Program.Update_KB() - Program.Build_Grating() 'Test för att SW API diff --git a/Wardrobe/Program.vb b/Wardrobe/Program.vb index 075254a..312ef51 100644 --- a/Wardrobe/Program.vb +++ b/Wardrobe/Program.vb @@ -2,8 +2,8 @@ Imports SldWorks Public Class Program - Public Shared Sub Load_XCC(fFolder As String, hFolder As String) - adminClass.loadSettings(fFolder, hFolder, "SolidWorks") + Public Shared Sub Load_XCC(filesFolder As String, HLCtFolder As String) + adminClass.loadSettings(filesFolder, HLCtFolder, "SolidWorks") End Sub Public Shared Sub Update_KB()