Recess code started

This commit is contained in:
Anton 2021-02-17 11:07:34 +01:00
parent c589bdc981
commit ee7e3fba86
5 changed files with 72 additions and 3 deletions

Binary file not shown.

Binary file not shown.

View File

@ -2,8 +2,8 @@
Imports Excel = Microsoft.Office.Interop.Excel
Public Class GUI
'Public Shared filepath As String = "C:\Users\Anton\Documents\Exjobb"
Public Shared filepath As String = "C:\Users\xperd\Documents"
Public Shared filepath As String = "C:\Users\Anton\Documents\Exjobb"
'Public Shared filepath As String = "C:\Users\xperd\Documents"
Dim excelApp As Excel.Application = New Excel.Application
Dim excelWB As Excel.Workbook
@ -26,6 +26,13 @@ Public Class GUI
GUI_Functions.pointsMeasurements.Add("Lmes", {1, 2, 1})
GUI_Functions.pointsMeasurements.Add("Wmes", {2, 3, 2})
GUI_Functions.recessData.Columns.Add("RECESS TYPE", GetType(String))
GUI_Functions.recessData.Columns.Add("CORNER", GetType(Integer))
GUI_Functions.recessData.Columns.Add("SIDE", GetType(Integer))
GUI_Functions.recessData.Columns.Add("WIDTH", GetType(Integer))
GUI_Functions.recessData.Columns.Add("LENGTH", GetType(Integer))
GUI_Functions.recessData.Columns.Add("OFFSET", GetType(Integer))
End Sub
Private Sub Get_Database()

View File

@ -11,6 +11,8 @@
Private Shared sideSquareValues As Integer() = {0, 0, 0}
Public Shared recessData As New DataTable
Public Shared Sub AngleButton(sender As Object, e As EventArgs)
GUI.Controls("AngleButton").Enabled = False
GUI.Controls("Button_Square").Enabled = False
@ -653,6 +655,10 @@
Dim numOfNewPoints As Integer
recessData.Rows.Add()
For i = 2 To pointsMeasurements.Count - 1
Dim mesName As String = pointsMeasurements.Keys(i)
If mesName.Split("_")(0) <> "SS1" AndAlso mesName.Split("_")(0) <> "SS" Then
@ -836,6 +842,11 @@
GUI_Drawing_Panel.measureLabels.Add("S_" & mesNum + 1, {CInt(GUI.Controls("X_TextBox").Text), pXP + d1P / 2 - 8,
pYP - d2P - 12 - 3, 4})
'Recess Data
recessData.Rows(recessData.Rows.Count - 1)("RECESS TYPE") = "SQUARE"
recessData.Rows(recessData.Rows.Count - 1)("CORNER") = 4
recessData.Rows(recessData.Rows.Count - 1)("WIDTH") = CInt(GUI.Controls("Y_TextBox").Text)
recessData.Rows(recessData.Rows.Count - 1)("LENGTH") = CInt(GUI.Controls("X_TextBox").Text)
Else
'Kvadrant 1
GUI_Drawing_Panel.points.Add("pS" & pointCounter * 3 - 2, {pXP, pYP + d2P, pXSW, pYSW - d2SW})
@ -855,6 +866,13 @@
pYP + d2P + 3, 1})
GUI_Drawing_Panel.measureLabels.Add("S_" & mesNum + 1, {CInt(GUI.Controls("Y_TextBox").Text), pXP + d1P + 3,
pYP + d2P / 2 - 4, 1})
'Recess Data
recessData.Rows(recessData.Rows.Count - 1)("RECESS TYPE") = "SQUARE"
recessData.Rows(recessData.Rows.Count - 1)("CORNER") = 1
recessData.Rows(recessData.Rows.Count - 1)("WIDTH") = CInt(GUI.Controls("Y_TextBox").Text)
recessData.Rows(recessData.Rows.Count - 1)("LENGTH") = CInt(GUI.Controls("X_TextBox").Text)
End If
Else
If pYP > GUI_Drawing_Panel.containerMidY Then
@ -874,6 +892,12 @@
pYP - d2P - 12 - 3, 3})
GUI_Drawing_Panel.measureLabels.Add("S_" & mesNum + 1, {CInt(GUI.Controls("Y_TextBox").Text), pXP - d1P - 18 - 3,
pYP - d2P / 2 - 4, 3})
'Recess Data
recessData.Rows(recessData.Rows.Count - 1)("RECESS TYPE") = "SQUARE"
recessData.Rows(recessData.Rows.Count - 1)("CORNER") = 3
recessData.Rows(recessData.Rows.Count - 1)("WIDTH") = CInt(GUI.Controls("Y_TextBox").Text)
recessData.Rows(recessData.Rows.Count - 1)("LENGTH") = CInt(GUI.Controls("X_TextBox").Text)
Else
'Kvadrant 2
GUI_Drawing_Panel.points.Add("pS" & pointCounter * 3 - 2, {pXP - d1P, pYP, pXSW - d1SW, pYSW})
@ -893,6 +917,12 @@
GUI_Drawing_Panel.measureLabels.Add("S_" & mesNum + 1, {CInt(GUI.Controls("X_TextBox").Text), pXP - d1P / 2 - 8,
pYP + d2P + 3, 2})
'Recess Data
recessData.Rows(recessData.Rows.Count - 1)("RECESS TYPE") = "SQUARE"
recessData.Rows(recessData.Rows.Count - 1)("CORNER") = 2
recessData.Rows(recessData.Rows.Count - 1)("WIDTH") = CInt(GUI.Controls("Y_TextBox").Text)
recessData.Rows(recessData.Rows.Count - 1)("LENGTH") = CInt(GUI.Controls("X_TextBox").Text)
End If
End If
pointsFunc.Add("pS" & pointCounter * 3 - 2, True)

View File

@ -28,7 +28,11 @@ Public Class SW_HLCt_Gratings
'Instantiate recess rectangle
parentID = inst_
inst_ = ExternalClass.instantiate_parts(parentID, "recess_rectangle", "")
For Each recessDR As DataRow In GUI_Functions.recessData.Rows
Inst_Recesses(parentID, gratingParameters, recessDR)
Next
importClass.copyGroupsByDataSet(ExternalClass.groupds_new)
@ -43,4 +47,32 @@ Public Class SW_HLCt_Gratings
End Sub
Private Shared Sub Inst_Recesses(parentID As Integer, gratingParameters As DataRow, recessDR As DataRow)
Dim inst_ As Integer
If recessDR("RECESS TYPE") = "SQUARE" OrElse recessDR("RECESS TYPE") = "ANGLE" Then
If recessDR("RECESS TYPE") = "SQUARE" Then
inst_ = ExternalClass.instantiate_parts(parentID, "recess_rectangle", "")
Else
inst_ = ExternalClass.instantiate_parts(parentID, "recess_angle", "")
End If
ExternalClass.modify_parameter_value("DP_LENGTH", inst_, recessDR("LENGTH"))
ExternalClass.modify_parameter_value("DP_WIDTH", inst_, recessDR("WIDTH"))
If recessDR("CORNER") = 1 Then
ExternalClass.modify_parameter_value("DP_OFFSET_W", inst_, gratingParameters("WIDTH") - recessDR("WIDTH"))
ExternalClass.modify_parameter_value("DP_OFFSET_L", inst_, 0)
ElseIf recessDR("CORNER") = 2 Then
ExternalClass.modify_parameter_value("DP_OFFSET_W", inst_, gratingParameters("WIDTH") - recessDR("WIDTH"))
ExternalClass.modify_parameter_value("DP_OFFSET_L", inst_, gratingParameters("LENGTH") - recessDR("LENGTH"))
ElseIf recessDR("CORNER") = 3 Then
ExternalClass.modify_parameter_value("DP_OFFSET_W", inst_, 0)
ExternalClass.modify_parameter_value("DP_OFFSET_L", inst_, gratingParameters("LENGTH") - recessDR("LENGTH"))
Else
ExternalClass.modify_parameter_value("DP_OFFSET_W", inst_, 0)
ExternalClass.modify_parameter_value("DP_OFFSET_L", inst_, 0)
End If
ElseIf recessDR("RECESS TYPE") = "SIDE SQUARE" Then
'???
End If
End Sub
End Class