Added simple algorithm to calculate the grid of gratings

This commit is contained in:
Anton 2021-02-24 15:46:53 +01:00
parent f3a3f0facc
commit 9fd065fc8e
5 changed files with 149 additions and 24 deletions

Binary file not shown.

View File

@ -1,21 +1,21 @@
NAME [str],LOADBAR [str],300 [dbl],400 [dbl],500 [dbl],600 [dbl],700 [dbl],800 [dbl],900 [dbl],1000 [dbl],1100 [dbl],1200 [dbl],1300 [dbl],1400 [dbl],1500 [dbl],1600 [dbl],1800 [dbl],2000 [dbl],2200 [dbl],2400 [dbl]
H,20x2,62,37,22,15,9.5,6.4,4.5,3.3,2.4,1.9,1.5,1.2,1.0,0.8,0.6,0.4,0.3,0.2
H,20x3,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,25x2,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,25x3,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,30x2,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,30x2,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,35x2,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,35x3,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,40x2,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
H,40x3,371,209,134,93,68,52,41,23,28,23,18,14,12,9.5,6.7,4.9,3.7,2.8
H,45x3,469,264,169,117,86,66,52,42,35,29,25,20,16,14,9.5,7.0,5.2,4.0
H,50x3,580,326,209,145,106,81,64,52,43,36,31,27,23,19,13,9.5,7.2,5.5
H,50x4,1168,657,420,292,214,164,130,102,76,59,46,37,30,25,17,13,9.6,7.4
H,50x5,1459,821,525,396,268,205,162,127,96,74,58,46,38,31,22,16,12,9.2
H,60x4,1681,945,605,420,309,236,187,151,125,102,80,64,52,43,30,22,16,13
H,60x5,2102,1182,757,525,386,295,233,189,156,127,100,80,65,54,38,27,21,16
H,70x4,2288,1287,824,572,420,322,254,206,170,143,122,102,83,68,48,35,26,20
H,70x5,2860,1609,1030,715,525,402,318,257,213,179,152,127,103,85,60,44,33,25
H,80x4,2989,1681,1076,747,549,420,332,269,222,187,159,137,120,102,71,52,39,30
H,80x5,3736,2102,1345,934,686,525,415,336,278,233,199,172,149,127,89,65,49,38
NAME [str],LB-HEIGHT [int],LB-THICKNESS [int],300 [dbl],400 [dbl],500 [dbl],600 [dbl],700 [dbl],800 [dbl],900 [dbl],1000 [dbl],1100 [dbl],1200 [dbl],1300 [dbl],1400 [dbl],1500 [dbl],1600 [dbl],1800 [dbl],2000 [dbl],2200 [dbl],2400 [dbl]
H,20,2,62,37,22,15,9.5,6.4,4.5,3.3,2.4,1.9,1.5,1.2,1.0,0.8,0.6,0.4,0.3,0.2
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,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
H,40,3,371,209,134,93,68,52,41,23,28,23,18,14,12,9.5,6.7,4.9,3.7,2.8
H,45,3,469,264,169,117,86,66,52,42,35,29,25,20,16,14,9.5,7.0,5.2,4.0
H,50,3,580,326,209,145,106,81,64,52,43,36,31,27,23,19,13,9.5,7.2,5.5
H,50,4,1168,657,420,292,214,164,130,102,76,59,46,37,30,25,17,13,9.6,7.4
H,50,5,1459,821,525,396,268,205,162,127,96,74,58,46,38,31,22,16,12,9.2
H,60,4,1681,945,605,420,309,236,187,151,125,102,80,64,52,43,30,22,16,13
H,60,5,2102,1182,757,525,386,295,233,189,156,127,100,80,65,54,38,27,21,16
H,70,4,2288,1287,824,572,420,322,254,206,170,143,122,102,83,68,48,35,26,20
H,70,5,2860,1609,1030,715,525,402,318,257,213,179,152,127,103,85,60,44,33,25
H,80,4,2989,1681,1076,747,549,420,332,269,222,187,159,137,120,102,71,52,39,30
H,80,5,3736,2102,1345,934,686,525,415,336,278,233,199,172,149,127,89,65,49,38

1 NAME [str] LOADBAR [str] LB-HEIGHT [int] LB-THICKNESS [int] 300 [dbl] 400 [dbl] 500 [dbl] 600 [dbl] 700 [dbl] 800 [dbl] 900 [dbl] 1000 [dbl] 1100 [dbl] 1200 [dbl] 1300 [dbl] 1400 [dbl] 1500 [dbl] 1600 [dbl] 1800 [dbl] 2000 [dbl] 2200 [dbl] 2400 [dbl]
2 H 20x2 20 2 62 37 22 15 9.5 6.4 4.5 3.3 2.4 1.9 1.5 1.2 1.0 0.8 0.6 0.4 0.3 0.2
3 H 20x3 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
4 H 25x2 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
5 H 25x3 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
6 H 30x2 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
7 H 30x2 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
8 H 35x2 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
9 H 35x3 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
10 H 40x2 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
11 H 40x3 40 3 371 209 134 93 68 52 41 23 28 23 18 14 12 9.5 6.7 4.9 3.7 2.8
12 H 45x3 45 3 469 264 169 117 86 66 52 42 35 29 25 20 16 14 9.5 7.0 5.2 4.0
13 H 50x3 50 3 580 326 209 145 106 81 64 52 43 36 31 27 23 19 13 9.5 7.2 5.5
14 H 50x4 50 4 1168 657 420 292 214 164 130 102 76 59 46 37 30 25 17 13 9.6 7.4
15 H 50x5 50 5 1459 821 525 396 268 205 162 127 96 74 58 46 38 31 22 16 12 9.2
16 H 60x4 60 4 1681 945 605 420 309 236 187 151 125 102 80 64 52 43 30 22 16 13
17 H 60x5 60 5 2102 1182 757 525 386 295 233 189 156 127 100 80 65 54 38 27 21 16
18 H 70x4 70 4 2288 1287 824 572 420 322 254 206 170 143 122 102 83 68 48 35 26 20
19 H 70x5 70 5 2860 1609 1030 715 525 402 318 257 213 179 152 127 103 85 60 44 33 25
20 H 80x4 80 4 2989 1681 1076 747 549 420 332 269 222 187 159 137 120 102 71 52 39 30
21 H 80x5 80 5 3736 2102 1345 934 686 525 415 336 278 233 199 172 149 127 89 65 49 38

View File

@ -240,6 +240,40 @@
e.Graphics.DrawLine(pen, pTemp1(0), pTemp1(1), pTemp2(0), pTemp2(1))
Next
' Draw grating grid for fill area
If AppForm.fillMode Then
Dim dashPen As Pen = New Pen(Color.DarkGray, 1)
dashPen.DashPattern = {2, 4}
Dim singleLength As Integer = Grating_Fill.maxSingleLength / 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
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)
Next
Dim singleWidth As Integer = Grating_Fill.maxSingleWidth / Data.scaleDiff
For i = 0 To Grating_Fill.numOfVertical - 2
Dim y As Integer
If Grating_Fill.widthRevNeeded AndAlso i = Grating_Fill.numOfVertical - 2 Then
y = Data.grossAreaPoints.Rows(0)("GUI Y") + singleWidth * i + Grating_Fill.revWidth / Data.scaleDiff
Else
y = Data.grossAreaPoints.Rows(0)("GUI Y") + singleWidth * (i + 1)
End If
Dim x1 As Integer = Data.grossAreaPoints.Rows(0)("GUI X")
Dim x2 As Integer = Data.grossAreaPoints.Rows(1)("GUI X")
e.Graphics.DrawLine(dashPen, x1, y, x2, y)
Next
End If
End Sub
End Class

View File

@ -81,7 +81,7 @@ Public Class Individual
.Left = 110,
.Top = 525,
.Width = 155,
.Font = New Font("Microsoft Sans Serif", 7.8),
.Font = New Font("Microsoft Sans Serif", 8),
.Enabled = False
}
AddHandler textBoxTemp.KeyPress, AddressOf TextBox_Max_Load_KeyPress

View File

@ -1,9 +1,100 @@

Public Class Grating_Fill
Public Shared maxSingleWidth, maxSingleLength As Integer
Public Shared numOfHorizontal, numOfVertical As Integer
Public Shared widthRevNeeded, lengthRevNeeded As Boolean
Public Shared revLength, revWidth As Integer
Private Shared gratingDimensions As New DataTable
Public Shared Sub Calculate_Grid()
Dim singleWidth As Integer = Database.database.Tables("Whole Meshes").Rows(0)(User_Input.wholeMeshesColumn)
Get_SingleGratingMaxDimensions()
Dim singleLength As Integer = 1
gratingDimensions.Clear()
gratingDimensions.Columns.Clear()
gratingDimensions.Columns.Add("INDEX")
gratingDimensions.Columns.Add("WIDTH")
gratingDimensions.Columns.Add("LENGTH")
numOfHorizontal = Math.Floor(Data.gratingL / maxSingleLength) + 1
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
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
endWidth = Data.gratingW - (numOfVertical - 1) * maxSingleWidth + neededLoadbars * User_Input.loadBarSpacing
revWidth = maxSingleWidth - (endWidth - (Data.gratingW - (numOfVertical - 1) * maxSingleWidth))
widthRevNeeded = True
Else
endWidth = Data.gratingW - (numOfVertical - 1) * maxSingleWidth
widthRevNeeded = False
End If
Dim row As Integer = 1
For i = 0 To numOfHorizontal * numOfVertical - 1
Dim tempDR As DataRow = gratingDimensions.NewRow
tempDR("INDEX") = i
If CDbl((i + 1) / numOfHorizontal) = row Then
tempDR("LENGTH") = endLength
row += 1
ElseIf CDbl((i + 2) / numOfHorizontal) = row AndAlso lengthRevNeeded Then
tempDR("LENGTH") = revLength
Else
tempDR("LENGTH") = maxSingleLength
End If
If i > numOfHorizontal * numOfVertical - 1 - numOfHorizontal Then
tempDR("WIDTH") = endWidth
ElseIf i > numOfHorizontal * numOfVertical - 1 - 2 * numOfHorizontal AndAlso widthRevNeeded Then
tempDR("WIDTH") = revWidth
Else
tempDR("WIDTH") = maxSingleWidth
End If
gratingDimensions.Rows.Add(tempDR)
Next
Individual.Panel_Grating.Refresh()
End Sub
Private Shared Sub Get_SingleGratingMaxDimensions()
maxSingleWidth = Database.database.Tables("Whole Meshes").Rows(0)(User_Input.wholeMeshesColumn)
Dim loadDT As DataTable = Database.database.Tables("LOAD")
Dim nameInDT As String = loadDT.Rows(0)("NAME")
Dim LBHeightInDT As Integer = loadDT.Rows(0)("LB-HEIGHT")
Dim LBThicknessInDT As Integer = loadDT.Rows(0)("LB-THICKNESS")
For i = 0 To loadDT.Rows.Count - 1
If User_Input.gratingName.Substring(0, 1) = nameInDT AndAlso User_Input.gratingHeight = LBHeightInDT _
AndAlso User_Input.loadBarThickness = LBThicknessInDT Then
For j = loadDT.Columns.Count - 1 To 0 Step -1
If loadDT.Rows(i)(j) > CInt(Individual.Panel_Data.Controls("TextBox_Max_Load").Text) Then
maxSingleLength = CInt(loadDT.Columns(j).ColumnName)
Exit For
End If
Next
Exit For
End If
Try
nameInDT = loadDT.Rows(i + 1)("NAME")
LBHeightInDT = loadDT.Rows(i + 1)("LB-HEIGHT")
LBThicknessInDT = loadDT.Rows(i + 1)("LB-THICKNESS")
Catch ex As Exception
End Try
Next
End Sub
End Class