diff --git a/Database/Databas.xlsx b/Database/Databas.xlsx index 5aa78b8..c8b9db1 100644 Binary files a/Database/Databas.xlsx and b/Database/Databas.xlsx differ diff --git a/Database/Load.csv b/Database/Load.csv index 3d99104..621a008 100644 --- a/Database/Load.csv +++ b/Database/Load.csv @@ -4,7 +4,7 @@ H,20,3,93,52,39,23,14,9.5,6.7,4.9,3.7,2.8,2.2,1.8,1.4,1.2,1.0,0.6,0.5,0.4 H,25,2,97,54,35,24,18,12,9,6.4,4.8,3.7,2.9,2.3,1.9,1.6,1.1,0.8,0.6,0.5 H,25,3,145,81,52,36,26,19,13,9.5,7.2,5.5,4.3,3.5,2.8,2.3,1.6,1.2,0.9,0.7 H,30,2,139,78,50,35,26,20,15,11,8.3,6.4,5.0,4.0,3.3,2.7,1.9,1.4,1.0,0.8 -H,30,2,209,117,75,52,38,29,23,16,12,9.5,7.5,6.0,4.9,4.0,2.8,2.1,1.5,1.2 +H,30,3,209,117,75,52,38,29,23,16,12,9.5,7.5,6.0,4.9,4.0,2.8,2.1,1.5,1.2 H,35,2,189,106,68,47,35,27,21,17,13,10,7.9,6.4,5.7,4.3,3.0,2.2,1.6,1.3 H,35,3,284,160,102,71,52,40,32,26,20,15,12,9.5,7.8,6.4,4.5,3.3,2.5,1.9 H,40,2,247,139,89,62,45,35,27,22,18,15,12,9.5,7.7,6.4,4.5,3.3,2.4,1.9 diff --git a/HLCt/Parts/~$START.SLDPRT b/HLCt/Parts/~$START.SLDPRT deleted file mode 100644 index b07f2ee..0000000 Binary files a/HLCt/Parts/~$START.SLDPRT and /dev/null differ diff --git a/Wardrobe/GUI/Draw_Grating.vb b/Wardrobe/GUI/Draw_Grating.vb index cb563a9..68d2f76 100644 --- a/Wardrobe/GUI/Draw_Grating.vb +++ b/Wardrobe/GUI/Draw_Grating.vb @@ -206,7 +206,7 @@ Dim angleQuadrant As String = Data.angleRecessPoints.Rows(i)("QUADRANT") Dim p1XGUI, p1YGUI, p2XGUI, p2YGUI As Integer For Each DR As DataRow In Data.gratingPoints.Rows - If DR("NAME").Split("_")(0) = "CA" & angleQuadrant Then + If DR("NAME").Split("_")(0) = "CA" & i + 1 Then Dim index As Integer = Data.gratingPoints.Rows.IndexOf(DR) p1XGUI = Data.gratingPoints.Rows(index)("GUI X") p1YGUI = Data.gratingPoints.Rows(index)("GUI Y") @@ -247,14 +247,15 @@ Dim dashPen As Pen = New Pen(Color.DarkGray, 1) dashPen.DashPattern = {2, 4} - Dim singleLength As Integer = Grating_Fill.maxSingleLength / Data.scaleDiff + Dim singleLength As Integer = Grating_Fill.minLength / Data.scaleDiff For i = 0 To Grating_Fill.numOfHorizontal - 2 Dim x As Integer - If Grating_Fill.lengthRevNeeded AndAlso i = Grating_Fill.numOfHorizontal - 2 Then - x = Data.grossAreaPoints.Rows(0)("GUI X") + singleLength * i + Grating_Fill.revLength / Data.scaleDiff - Else - x = Data.grossAreaPoints.Rows(0)("GUI X") + singleLength * (i + 1) - End If + x = Data.grossAreaPoints.Rows(0)("GUI X") + singleLength * (i + 1) + 'If Grating_Fill.lengthRevNeeded AndAlso i = Grating_Fill.numOfHorizontal - 2 Then + ' x = Data.grossAreaPoints.Rows(0)("GUI X") + singleLength * i + Grating_Fill.revLength / Data.scaleDiff + 'Else + 'x = Data.grossAreaPoints.Rows(0)("GUI X") + singleLength * (i + 1) + 'End If Dim y1 As Integer = Data.grossAreaPoints.Rows(0)("GUI Y") Dim y2 As Integer = Data.grossAreaPoints.Rows(3)("GUI Y") e.Graphics.DrawLine(dashPen, x, y1, x, y2) diff --git a/Wardrobe/GUI/Individual.Designer.vb b/Wardrobe/GUI/Individual.Designer.vb index 36185a5..b4000be 100644 --- a/Wardrobe/GUI/Individual.Designer.vb +++ b/Wardrobe/GUI/Individual.Designer.vb @@ -98,7 +98,7 @@ Partial Class Individual 'Button_Back ' Me.Button_Back.Location = New System.Drawing.Point(9, 10) - Me.Button_Back.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2) + Me.Button_Back.Margin = New System.Windows.Forms.Padding(2) Me.Button_Back.Name = "Button_Back" Me.Button_Back.Size = New System.Drawing.Size(42, 33) Me.Button_Back.TabIndex = 27 @@ -107,7 +107,7 @@ Partial Class Individual ' 'TextBox_Width ' - Me.TextBox_Width.Location = New System.Drawing.Point(110, 392) + Me.TextBox_Width.Location = New System.Drawing.Point(110, 418) Me.TextBox_Width.Name = "TextBox_Width" Me.TextBox_Width.Size = New System.Drawing.Size(155, 20) Me.TextBox_Width.TabIndex = 26 diff --git a/Wardrobe/GUI/Individual.vb b/Wardrobe/GUI/Individual.vb index 60dbd01..0f5c4d3 100644 --- a/Wardrobe/GUI/Individual.vb +++ b/Wardrobe/GUI/Individual.vb @@ -239,6 +239,7 @@ Public Class Individual ' --- When calculate button is pressed --- Private Sub Button_Calculate_Click(sender As Object, e As EventArgs) Grating_Fill.Calculate_Grid() + Grating_Fill.Calculate_Recesses() End Sub ' ---------------------------------- Export to SW ---------------------------------- @@ -247,7 +248,7 @@ Public Class Individual If AppForm.fillMode Then Model_3D_Fill.BuildGrid() Else - 'Model_3D.BuildGrating() + Model_3D.BuildGrating() Drawing.CreateDrawing() End If End Sub diff --git a/Wardrobe/Gratings Data/Data.vb b/Wardrobe/Gratings Data/Data.vb index bc9691b..4e83321 100644 --- a/Wardrobe/Gratings Data/Data.vb +++ b/Wardrobe/Gratings Data/Data.vb @@ -52,6 +52,7 @@ recessData.Columns.Add("WIDTH", GetType(Integer)) recessData.Columns.Add("LENGTH", GetType(Integer)) recessData.Columns.Add("OFFSET", GetType(Integer)) + recessData.Columns.Add("GRATINGS", GetType(Integer())) End Sub Public Shared Sub Init_GrossAreaPoints() diff --git a/Wardrobe/Gratings Data/Grating_Fill.vb b/Wardrobe/Gratings Data/Grating_Fill.vb index 13a1335..aa6ad23 100644 --- a/Wardrobe/Gratings Data/Grating_Fill.vb +++ b/Wardrobe/Gratings Data/Grating_Fill.vb @@ -4,11 +4,13 @@ Public Class Grating_Fill Public Shared numOfHorizontal, numOfVertical As Integer Public Shared widthRevNeeded, lengthRevNeeded As Boolean Public Shared revLength, revWidth As Integer + Public Shared minLength As Integer Public Shared gratingDimensions As New DataTable Public Shared Sub Calculate_Grid() Get_SingleGratingMaxDimensions() + gratingDimensions.Clear() gratingDimensions.Columns.Clear() gratingDimensions.Columns.Add("INDEX", GetType(Integer)) @@ -18,19 +20,36 @@ Public Class Grating_Fill gratingDimensions.Columns.Add("LENGTH", GetType(Integer)) - numOfHorizontal = Math.Floor(Data.gratingL / maxSingleLength) + 1 + + If (Data.gratingL / maxSingleLength) Mod 1 = 0 Then + numOfHorizontal = Data.gratingL / maxSingleLength + Else + numOfHorizontal = Math.Floor(Data.gratingL / maxSingleLength) + 1 + End If + numOfVertical = Math.Floor(Data.gratingW / maxSingleWidth) + 1 - Dim endLength As Integer - If Data.gratingL - (numOfHorizontal - 1) * maxSingleLength < 200 Then - endLength = 200 - revLength = maxSingleLength - (endLength - (Data.gratingL - (numOfHorizontal - 1) * maxSingleLength)) - lengthRevNeeded = True - Else - endLength = Data.gratingL - (numOfHorizontal - 1) * maxSingleLength - lengthRevNeeded = False + minLength = (Math.Floor((Data.gratingL / 100) / numOfHorizontal) + 1) * 100 'Hantera längder med mer än 100mm mellan typ 1600-1800 + + If minLength > 1600 AndAlso (minLength / 100) Mod 2 = 1 Then + minLength += 100 End If + If minLength > maxSingleLength Then + minLength = maxSingleLength + End If + + Dim endLength As Integer = Data.gratingL - (numOfHorizontal - 1) * minLength + + 'If Data.gratingL - (numOfHorizontal - 1) * maxSingleLength < 200 Then + ' endLength = 200 + ' revLength = maxSingleLength - (endLength - (Data.gratingL - (numOfHorizontal - 1) * maxSingleLength)) + ' lengthRevNeeded = True + 'Else + ' endLength = Data.gratingL - (numOfHorizontal - 1) * maxSingleLength + ' lengthRevNeeded = False + 'End If + Dim endWidth As Integer If Data.gratingW - (numOfVertical - 1) * maxSingleWidth < 200 Then Dim neededLoadbars As Integer = Math.Floor((200 - (Data.gratingW - (numOfVertical - 1) * maxSingleWidth)) / User_Input.loadBarSpacing) + 1 @@ -51,10 +70,10 @@ Public Class Grating_Fill If CDbl((i + 1) / numOfHorizontal) = row Then tempDR("LENGTH") = endLength row += 1 - ElseIf CDbl((i + 2) / numOfHorizontal) = row AndAlso lengthRevNeeded Then - tempDR("LENGTH") = revLength + 'ElseIf CDbl((i + 2) / numOfHorizontal) = row AndAlso lengthRevNeeded Then + ' tempDR("LENGTH") = revLength Else - tempDR("LENGTH") = maxSingleLength + tempDR("LENGTH") = minLength End If If i > numOfHorizontal * numOfVertical - 1 - numOfHorizontal Then @@ -101,4 +120,27 @@ Public Class Grating_Fill End Try Next End Sub + + Public Shared Sub Calculate_Recesses() + Dim cornerAngleCounter As Integer = 0 + For Each DR As DataRow In Data.recessData.Rows + If DR("RECESS TYPE") = "ANGLE" Then + cornerAngleCounter += 1 + For i = 1 To 2 + Dim p1X, p1Y As Integer + For Each gDR As DataRow In Data.gratingPoints.Rows + If gDR("NAME") = "CA" & cornerAngleCounter & "_" & i Then + p1X = gDR("X") + p1Y = gDR("Y") + End If + Next + + Next + 'Kolla var de ligger jämfört med gratings + 'Lägg till grating index i "GRATINGS" + + + End If + Next + End Sub End Class diff --git a/Wardrobe/Recess Functions/Corner_Angle.vb b/Wardrobe/Recess Functions/Corner_Angle.vb index 3a756dd..bd711b0 100644 --- a/Wardrobe/Recess Functions/Corner_Angle.vb +++ b/Wardrobe/Recess Functions/Corner_Angle.vb @@ -1,5 +1,6 @@ Public Class Corner_Angle Private Shared buttonOffset As Integer + Private Shared cornerAngleCounter As Integer = 0 ' --- Create textboxes when user clicks the angle corner recess button --- Public Shared Sub AngleButton(sender As Object, e As EventArgs) Individual.Panel_Recesses.Controls("Button_Angle_Corner").Enabled = False @@ -90,7 +91,7 @@ ' --- When a corner function button is pressed --- Private Shared Sub PointButton_Click(sender As Button, e As EventArgs) 'Determine which point is being pressed - Dim pointPressed As String = sender.Name.Split("_")(0) + Dim pointPressed As String = sender.Name.Replace("_Button", "").Trim() Dim index As Integer For Each DR As DataRow In Data.gratingPoints.Rows If DR("NAME") = pointPressed Then @@ -108,6 +109,8 @@ End If Next + cornerAngleCounter += 1 + 'Retrive that points coords Dim pXGUI As Integer = Data.gratingPoints.Rows(index)("GUI X") Dim pYGUI As Integer = Data.gratingPoints.Rows(index)("GUI Y") @@ -180,11 +183,11 @@ Dim pointRow1 As DataRow = Data.gratingPoints.NewRow Dim pointRow2 As DataRow = Data.gratingPoints.NewRow - pointRow1("NAME") = "CA" & pointQuadrant & "_" & 1 + pointRow1("NAME") = "CA" & cornerAngleCounter & "_" & 1 pointRow1("QUADRANT") = pointQuadrant pointRow1("RECESS OK") = False - pointRow2("NAME") = "CA" & pointQuadrant & "_" & 2 + pointRow2("NAME") = "CA" & cornerAngleCounter & "_" & 2 pointRow2("QUADRANT") = pointQuadrant pointRow2("RECESS OK") = False If pointQuadrant = 1 Then @@ -210,7 +213,7 @@ ' Add angle recess help point (GUI) Dim pointRow = Data.angleRecessPoints.NewRow - pointRow("NAME") = "CA" & pointQuadrant + pointRow("NAME") = "CA" & cornerAngleCounter pointRow("QUADRANT") = pointQuadrant pointRow("GUI X") = pXGUI + dXGUI pointRow("GUI Y") = pYGUI + dYGUI @@ -250,7 +253,7 @@ ' Add angle recess help point (GUI) Dim pointRow = Data.angleRecessPoints.NewRow - pointRow("NAME") = "CA" & pointQuadrant + pointRow("NAME") = "CA" & cornerAngleCounter pointRow("QUADRANT") = pointQuadrant pointRow("GUI X") = pXGUI - dXGUI pointRow("GUI Y") = pYGUI + dYGUI @@ -289,7 +292,7 @@ ' Add angle recess help point (GUI) Dim pointRow = Data.angleRecessPoints.NewRow - pointRow("NAME") = "CA" & pointQuadrant + pointRow("NAME") = "CA" & cornerAngleCounter pointRow("QUADRANT") = pointQuadrant pointRow("GUI X") = pXGUI - dXGUI pointRow("GUI Y") = pYGUI - dYGUI @@ -325,7 +328,7 @@ ' Add angle recess help point (GUI) Dim pointRow = Data.angleRecessPoints.NewRow - pointRow("NAME") = "CA" & pointQuadrant + pointRow("NAME") = "CA" & cornerAngleCounter pointRow("QUADRANT") = pointQuadrant pointRow("GUI X") = pXGUI + dXGUI pointRow("GUI Y") = pYGUI - dYGUI diff --git a/Wardrobe/Recess Functions/Corner_Rectangle.vb b/Wardrobe/Recess Functions/Corner_Rectangle.vb index 55f3a38..aec7911 100644 --- a/Wardrobe/Recess Functions/Corner_Rectangle.vb +++ b/Wardrobe/Recess Functions/Corner_Rectangle.vb @@ -1,5 +1,6 @@ Public Class Corner_Rectangle Private Shared buttonOffset As Integer + Private Shared cornerRectangleCounter As Integer = 0 ' --- Create textboxes when user clicks the rectangle corner recess button --- Public Shared Sub SquareButtton(sender As Object, e As EventArgs) Individual.Panel_Recesses.Controls("Button_Angle_Corner").Enabled = False @@ -89,7 +90,7 @@ ' --- When a corner function button is pressed --- Private Shared Sub PointButton_Click(sender As Button, e As EventArgs) 'Determine which point is being pressed - Dim pointPressed As String = sender.Name.Split("_")(0) + Dim pointPressed As String = sender.Name.Replace("_Button", "").Trim() Dim index As Integer For Each DR As DataRow In Data.gratingPoints.Rows If DR("NAME") = pointPressed Then @@ -107,6 +108,8 @@ End If Next + cornerRectangleCounter += 1 + 'Retrive the points coords Dim pXGUI As Integer = Data.gratingPoints.Rows(index)("GUI X") Dim pYGUI As Integer = Data.gratingPoints.Rows(index)("GUI Y") @@ -180,15 +183,15 @@ Dim pointRow2 As DataRow = Data.gratingPoints.NewRow Dim pointRow3 As DataRow = Data.gratingPoints.NewRow - pointRow1("NAME") = "CR" & pointQuadrant & "_" & 1 + pointRow1("NAME") = "CR" & cornerRectangleCounter & "_" & 1 pointRow1("QUADRANT") = pointQuadrant pointRow1("RECESS OK") = True - pointRow2("NAME") = "CR" & pointQuadrant & "_" & 2 + pointRow2("NAME") = "CR" & cornerRectangleCounter & "_" & 2 pointRow2("QUADRANT") = pointQuadrant pointRow2("RECESS OK") = False - pointRow3("NAME") = "CR" & pointQuadrant & "_" & 3 + pointRow3("NAME") = "CR" & cornerRectangleCounter & "_" & 3 pointRow3("QUADRANT") = pointQuadrant pointRow3("RECESS OK") = True