Fixed so frames instantiate correctly for single grating (not for side square). Also some minor fixes for delete_obsolete.

This commit is contained in:
Anton 2021-03-19 13:22:24 +01:00
parent 8529d985ed
commit 5391cd3210
9 changed files with 44 additions and 69 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

View File

@ -249,7 +249,7 @@ Public Class Individual
Model_3D_Fill.BuildGrid()
Else
Model_3D.BuildGrating()
'Model_3D.BuildGrating()
Drawing.Create_Model_For_Drawing()
End If
End Sub

View File

@ -22,17 +22,12 @@ Public Class Individual_Frame_3D
ExternalClass.modify_parameter_value("DP_OFFSET_W", inst_, frameDT.Rows(i)("OFFSET_W"))
ExternalClass.modify_parameter_value("DP_OFFSET_L", inst_, frameDT.Rows(i)("OFFSET_L"))
If frameDT.Rows(i)("TYPE") = "SIDE" Then
ExternalClass.modify_parameter_value("DP_CUTOFFSET1", inst_, 0)
ExternalClass.modify_parameter_value("DP_CUTOFFSET2", inst_, 2000 - frameDT.Rows(i)("LENGTH"))
End If
Next
End Sub
Private Shared Function Generate_Frame_Data(gratingParameters As DataRow)
@ -50,7 +45,7 @@ Public Class Individual_Frame_3D
DTRow = DT.NewRow
DTRow("TYPE") = "CORNER"
DTRow("CORNER") = Data.gratingPoints.Rows(i)("QUADRANT")
DTRow("ROTATION") = 360 - Data.gratingPoints.Rows(i)("QUADRANT") * 90
DTRow("ROTATION") = (Data.gratingPoints.Rows(i)("QUADRANT") - 1) * 90
If DTRow("CORNER") = 1 Then
DTRow("OFFSET_W") = gratingParameters("WIDTH")
@ -64,21 +59,15 @@ Public Class Individual_Frame_3D
Else
DTRow("OFFSET_W") = 0
DTRow("OFFSET_L") = 0
End If
DT.Rows.Add(DTRow)
End If
Dim i2 As Integer
If i = Data.gratingPoints.Rows.Count - 1 Then
i2 = 0
Else
i2 = i + 1
End If
Dim sideFrame As Boolean = False
@ -96,43 +85,60 @@ Public Class Individual_Frame_3D
DTRow = DT.NewRow
DTRow("TYPE") = "SIDE"
If Data.gratingPoints.Rows(i)("X") = Data.gratingPoints.Rows(i2)("X") Then
Dim numOfP As Integer = 0
If Data.gratingPoints.Rows(i)("NAME").substring(0, 1) = "P" AndAlso Data.gratingPoints.Rows(i2)("NAME").substring(0, 1) = "P" Then
numOfP = 2
ElseIf Data.gratingPoints.Rows(i)("NAME").substring(0, 1) = "P" Or Data.gratingPoints.Rows(i2)("NAME").substring(0, 1) = "P" Then
numOfP = 1
End If
If Data.gratingPoints.Rows(i)("X") = Data.gratingPoints.Rows(i2)("X") Then
If Data.gratingPoints.Rows(i)("Y") > Data.gratingPoints.Rows(i2)("Y") Then
DTRow("SIDE") = 3
DTRow("LENGTH") = (Data.gratingPoints.Rows(i)("Y") - Data.gratingPoints.Rows(i2)("Y")) * 1000 - 420 'Fixa 420 baserat hörnens längd
DTRow("OFFSET_W") = 210 'FIXA
DTRow("LENGTH") = (Data.gratingPoints.Rows(i)("Y") - Data.gratingPoints.Rows(i2)("Y")) * 1000 - 20 - numOfP * 200
If Data.gratingPoints.Rows(i2)("NAME").substring(0, 1) = "P" Then
DTRow("OFFSET_W") = 210
Else
DTRow("OFFSET_W") = Data.gratingW / 2 - Math.Abs(Data.gratingPoints.Rows(i2)("Y")) * 1000 + 10
End If
DTRow("OFFSET_L") = gratingParameters("LENGTH")
Else
DTRow("SIDE") = 1
DTRow("LENGTH") = (Data.gratingPoints.Rows(i2)("Y") - Data.gratingPoints.Rows(i)("Y")) * 1000 - 420 'Fixa 420 baserat hörnens längd
DTRow("OFFSET_W") = 210 'FIXA
DTRow("LENGTH") = (Data.gratingPoints.Rows(i2)("Y") - Data.gratingPoints.Rows(i)("Y")) * 1000 - 20 - numOfP * 200
If Data.gratingPoints.Rows(i)("NAME").substring(0, 1) = "P" Then
DTRow("OFFSET_W") = DTRow("LENGTH") + 210
Else
DTRow("OFFSET_W") = DTRow("LENGTH") + Data.gratingW / 2 - Math.Abs(Data.gratingPoints.Rows(i)("Y")) * 1000 + 10
End If
DTRow("OFFSET_L") = 0
End If
Else
If Data.gratingPoints.Rows(i)("X") > Data.gratingPoints.Rows(i2)("X") Then
DTRow("SIDE") = 4
DTRow("LENGTH") = (Data.gratingPoints.Rows(i)("X") - Data.gratingPoints.Rows(i2)("X")) * 1000 - 420 'Fixa 420 baserat hörnens längd
DTRow("LENGTH") = (Data.gratingPoints.Rows(i)("X") - Data.gratingPoints.Rows(i2)("X")) * 1000 - 20 - numOfP * 200
DTRow("OFFSET_W") = 0
DTRow("OFFSET_L") = 210 'FIXA
If Data.gratingPoints.Rows(i2)("NAME").substring(0, 1) = "P" Then
DTRow("OFFSET_L") = 210
Else
DTRow("OFFSET_L") = Data.gratingL / 2 - Math.Abs(Data.gratingPoints.Rows(i2)("X")) * 1000 + 10
End If
Else
DTRow("SIDE") = 2
DTRow("LENGTH") = (Data.gratingPoints.Rows(i2)("X") - Data.gratingPoints.Rows(i)("X")) * 1000 - 420 'Fixa 420 baserat hörnens längd
DTRow("LENGTH") = (Data.gratingPoints.Rows(i2)("X") - Data.gratingPoints.Rows(i)("X")) * 1000 - 20 - numOfP * 200
DTRow("OFFSET_W") = gratingParameters("WIDTH")
DTRow("OFFSET_L") = 210 'FIXA
If Data.gratingPoints.Rows(i)("NAME").substring(0, 1) = "P" Then
DTRow("OFFSET_L") = DTRow("LENGTH") + 210
Else
DTRow("OFFSET_L") = DTRow("LENGTH") + Data.gratingL / 2 - Math.Abs(Data.gratingPoints.Rows(i)("X")) * 1000 + 10
End If
End If
End If
DTRow("ROTATION") = 360 - DTRow("SIDE") * 90
DT.Rows.Add(DTRow)
End If
Next
Return DT
End Function
End Class

View File

@ -27,19 +27,16 @@ Public Class Model_3D_Fill
ExternalClass.modify_parameter_value("DP_CROSSBAR_HEIGHT", inst_, gratingParameters("CROSSBAR_HEIGHT"))
End If
ExternalClass.modify_parameter_value("DP_GRATING_WIDTH", inst_, Grating_Fill.gratingDimensions.Rows(i)("WIDTH"))
ExternalClass.modify_parameter_value("DP_GRATING_LENGTH", inst_, Grating_Fill.gratingDimensions.Rows(i)("LENGTH"))
Dim offsetX As Integer = 0
For j = 1 To Grating_Fill.gratingDimensions.Rows(i)("COLUMN")
offsetX += Grating_Fill.gratingDimensions.Rows(i - j)("LENGTH")
Next
Dim offsetY As Integer = 0
For j = 1 To Grating_Fill.gratingDimensions.Rows(i)("ROW")
offsetY += Grating_Fill.gratingDimensions.Rows(i - Grating_Fill.numOfHorizontal * j)("WIDTH")
Next
ExternalClass.modify_parameter_value("DP_OFFSET_X", inst_, (Grating_Fill.gratingDimensions.Rows(i)("LENGTH") / 2) + offsetX)
@ -85,7 +82,6 @@ Public Class Model_3D_Fill
ExternalClass.modify_parameter_value("DP_V_EDGEBAR_POS", inst_, squareL)
ExternalClass.modify_parameter_value("DP_V_EDGEBAR_BOTTOM", inst_, gratingParameters("LOADBAR_THICKNESS"))
ExternalClass.modify_parameter_value("DP_H_EDGEBAR_POS", inst_, 0)
ElseIf recessDR("CORNER") = 2 Then
ExternalClass.modify_parameter_value("DP_OFFSET_W", inst_, Data.gratingW - squareW)
ExternalClass.modify_parameter_value("DP_OFFSET_L", inst_, Data.gratingL - squareL - gratingParameters("LOADBAR_THICKNESS"))
@ -94,7 +90,6 @@ Public Class Model_3D_Fill
ExternalClass.modify_parameter_value("DP_V_EDGEBAR_POS", inst_, 0)
ExternalClass.modify_parameter_value("DP_V_EDGEBAR_BOTTOM", inst_, gratingParameters("LOADBAR_THICKNESS"))
ExternalClass.modify_parameter_value("DP_H_EDGEBAR_POS", inst_, 0)
ElseIf recessDR("CORNER") = 3 Then
ExternalClass.modify_parameter_value("DP_OFFSET_W", inst_, 0)
ExternalClass.modify_parameter_value("DP_OFFSET_L", inst_, Data.gratingL - squareL - gratingParameters("LOADBAR_THICKNESS"))
@ -198,7 +193,6 @@ Public Class Model_3D_Fill
End Sub
Private Shared Sub Recess_Indent()
'Combine all bodies
Dim swApp As SldWorks.SldWorks
swApp = CType(System.Runtime.InteropServices.Marshal.GetActiveObject("SldWorks.Application"), SldWorks.SldWorks)
@ -254,7 +248,6 @@ Public Class Model_3D_Fill
Dim recessParentName As String = partDT.Rows(Grating_Fill.numOfHorizontal * (Grating_Fill.numOfVertical - 1))("partName")
Dim recessParts = partDT.Select("parentName = '" & recessParentName & "'")
For i = 0 To recessParts.Count - 1
Dim recessPartName As String = recessParts(i)("partName")
Dim indexRecess As Integer
@ -306,21 +299,16 @@ Public Class Model_3D_Fill
Assembly.ClearSelection2(True)
sldata.Mark = 1
Dim bodyName As String = gratingBodies(gratingBodyIndex).Name & "@" & gratingPartName & "-1@" & designName
boolstatus = AssemblyExtension.SelectByID2(bodyName, "SOLIDBODY", 0, 0, 0, True, 1, Nothing, 0)
sldata.Mark = 4
recessFace.Select4(True, sldata)
Assembly.FeatureManager.InsertIndent(0.01, 0, False, True, True, False)
Assembly.ClearSelection2(True)
Assembly.EditAssembly
Next
Assembly.ClearSelection2(True)
@ -449,7 +437,7 @@ Public Class Model_3D_Fill
Dim cornerAngleCounter As Integer = 1
Dim cornerRectangleCounter As Integer = 1
Dim numOfSideRectangles As Integer = 0
Dim numOfMiddleRectangles As Integer = 1
Dim numOfMiddleRectangles As Integer = 0
For j = 0 To Data.recessData.Rows.Count - 1
If Data.recessData.Rows(j)("RECESS TYPE") = "ANGLE" Then
Dim RP As New List(Of Integer())
@ -458,20 +446,6 @@ Public Class Model_3D_Fill
rec1(0) = Data.grossAreaPoints.Rows(Data.recessData.Rows(j)("CORNER") - 1)("X") * 1000
rec1(1) = Data.grossAreaPoints.Rows(Data.recessData.Rows(j)("CORNER") - 1)("Y") * 1000
'If Data.recessData.Rows(j)("CORNER") = 1 Then
' rec1(0) = -origo(0)
' rec1(1) = origo(1)
'ElseIf Data.recessData.Rows(j)("CORNER") = 2 Then
' rec1(0) = origo(0)
' rec1(1) = origo(1)
'ElseIf Data.recessData.Rows(j)("CORNER") = 3 Then
' rec1(0) = origo(0)
' rec1(1) = -origo(1)
'Else
' rec1(0) = -origo(0)
' rec1(1) = -origo(1)
'End If
Dim rowIndex As Integer
For k = 0 To Data.gratingPoints.Rows.Count - 1
If Data.gratingPoints.Rows(k)("NAME") = "CA" & cornerAngleCounter & "_" & 1 Then
@ -523,13 +497,6 @@ Public Class Model_3D_Fill
End If
Next
numOfSideRectangles += 1
ElseIf Data.recessData.Rows(j)("RECESS TYPE") = "MIDDLE SQUARE" Then
For k = 0 To Data.gratingMiddlePoints.Rows.Count - 1
If Data.gratingMiddlePoints.Rows(k)("NAME") = "MS" & numOfMiddleRectangles & "_" & 1 Then
rowIndex = k
End If
Next
numOfMiddleRectangles += 1
End If
If Data.recessData.Rows(j)("RECESS TYPE") = "SQUARE" OrElse Data.recessData.Rows(j)("RECESS TYPE") = "SIDE SQUARE" Then
@ -552,17 +519,19 @@ Public Class Model_3D_Fill
End If
ElseIf Data.recessData.Rows(j)("RECESS TYPE") = "MIDDLE SQUARE" Then
rec1(0) = Data.gratingMiddlePoints.Rows(rowIndex)("X") * 1000 'Använd inte rowindex här, ska vara 0,1,2,3
rec1(1) = Data.gratingMiddlePoints.Rows(rowIndex)("Y") * 1000
numOfMiddleRectangles += 1
rec2(0) = Data.gratingMiddlePoints.Rows(rowIndex + 1)("X") * 1000
rec2(1) = Data.gratingMiddlePoints.Rows(rowIndex + 1)("Y") * 1000
rec1(0) = Data.gratingMiddlePoints.Rows(numOfMiddleRectangles * 4 - 4)("X") * 1000
rec1(1) = Data.gratingMiddlePoints.Rows(numOfMiddleRectangles * 4 - 4)("Y") * 1000
rec3(0) = Data.gratingMiddlePoints.Rows(rowIndex + 2)("X") * 1000
rec3(1) = Data.gratingMiddlePoints.Rows(rowIndex + 2)("Y") * 1000
rec2(0) = Data.gratingMiddlePoints.Rows(numOfMiddleRectangles * 4 - 3)("X") * 1000
rec2(1) = Data.gratingMiddlePoints.Rows(numOfMiddleRectangles * 4 - 3)("Y") * 1000
rec4(0) = Data.gratingMiddlePoints.Rows(rowIndex + 3)("X") * 1000
rec4(1) = Data.gratingMiddlePoints.Rows(rowIndex + 3)("Y") * 1000
rec3(0) = Data.gratingMiddlePoints.Rows(numOfMiddleRectangles * 4 - 2)("X") * 1000
rec3(1) = Data.gratingMiddlePoints.Rows(numOfMiddleRectangles * 4 - 2)("Y") * 1000
rec4(0) = Data.gratingMiddlePoints.Rows(numOfMiddleRectangles * 4 - 1)("X") * 1000
rec4(1) = Data.gratingMiddlePoints.Rows(numOfMiddleRectangles * 4 - 1)("Y") * 1000
End If
RP.Add(rec1)