Frames > 2m

This commit is contained in:
Mans 2021-04-08 15:18:55 +02:00
parent df4726889a
commit ee20b6ebb7
3 changed files with 128 additions and 48 deletions

Binary file not shown.

View File

@ -231,8 +231,62 @@ Public Class Individual_Frame_3D
End If
DTRow("ROTATION") = 360 - DTRow("SIDE") * 90
If DTRow("LENGTH") >= 125 Then
If DTRow("LENGTH") >= 125 AndAlso DTRow("LENGTH") <= 2000 Then
DT.Rows.Add(DTRow)
ElseIf DTRow("LENGTH") > 2000 Then
Dim numOfRows As Integer = Math.Floor(CDec(DTRow("LENGTH")) / 2000) + 1
Dim DTRowList As New List(Of DataRow)
For j = 1 To numOfRows
Dim DTRow1 As DataRow = DT.NewRow
DTRowList.Add(DTRow1)
Next
Dim offsetDir As String = ""
Dim addOffset As Boolean
For Each DC As DataColumn In DT.Columns
If DC.ColumnName = "LENGTH" Then
For j = 0 To DTRowList.Count - 1
If j = DTRowList.Count - 1 Then
DTRowList(j)(DC.ColumnName) = DTRow("LENGTH") - (j * 2000)
Else
DTRowList(j)(DC.ColumnName) = 2000
End If
Next
ElseIf DC.ColumnName = "SIDE" Then
For j = 0 To DTRowList.Count - 1
DTRowList(j)(DC.ColumnName) = DTRow("SIDE")
Next
If DTRow("SIDE") = 1 Then
offsetDir = "OFFSET_W"
addOffset = False
ElseIf DTRow("SIDE") = 2 Then
offsetDir = "OFFSET_L"
addOffset = False
ElseIf DTRow("SIDE") = 3 Then
offsetDir = "OFFSET_W"
addOffset = True
Else
offsetDir = "OFFSET_L"
addOffset = True
End If
ElseIf DC.ColumnName = offsetDir Then
For j = 0 To DTRowList.Count - 1
If addOffset = True Then
DTRowList(j)(DC.ColumnName) = DTRow(offsetDir) + j * 2000
Else
DTRowList(j)(DC.ColumnName) = DTRow(offsetDir) - j * 2000
End If
Next
Else
For j = 0 To DTRowList.Count - 1
DTRowList(j)(DC.ColumnName) = DTRow(DC.ColumnName)
Next
End If
Next
For j = 0 To DTRowList.Count - 1
DT.Rows.Add(DTRowList(j))
Next
End If
End If
Next
@ -328,6 +382,7 @@ Public Class Individual_Frame_3D
For k = numOfValues To 1 Step -1
If frameCombDT.Rows(j - 1)("Enum " & k) < frameLengths.Count - (numOfValues - k) Then
frameEnum = k
Exit For
End If
Next
@ -407,49 +462,57 @@ Public Class Individual_Frame_3D
Dim longstatus As Integer, longwarnings As Integer
For j = 0 To cuttingList.Count - 1
Dim Part = swApp.OpenDoc6(Settings.HLCtFolder & "\HLCt\frame_l_straight.SLDPRT", 1, 0, "", longstatus, longwarnings)
longstatus = Part.SaveAs3(Settings.folderPaths("object_" & Data.objectNum & "_models3D_frames_sw_support") & "\FRAME_L_END_PIECE" & j + 1 & ".SLDPRT", 0, 0)
Dim swEquationMgr As EquationMgr
swEquationMgr = Part.GetEquationMgr()
Dim counter As String = 0
For i = 0 To swEquationMgr.GetCount() - 1
Dim equationName = swEquationMgr.Equation(i)
Dim tempName = equationName.Substring(1, equationName.Length - 2)
tempName = tempName.Split("""")(0)
equationName = equationName.Split("=")(0) & "= "
If tempName = "DP_HEIGHT" Then
swEquationMgr.Equation(i) = equationName & 30 'FIXA
counter += 1
ElseIf tempName = "DP_WIDTH" Then
swEquationMgr.Equation(i) = equationName & 40 'FIXA
counter += 1
ElseIf tempName = "DP_CUTOFFSET1" Then
Dim cutLength As Integer = 0
For k = 0 To cuttingList.ElementAt(j).Value.Count - 1
cutLength += sideFrameLengths("Frame " & cuttingList.ElementAt(j).Value(k))
Next
swEquationMgr.Equation(i) = equationName & cutLength
counter += 1
ElseIf tempName.Split("_")(0) = "DP" Then
swEquationMgr.Equation(i) = equationName & 0
counter += 1
End If
If counter = 7 Then
Exit For
End If
Dim endPieceLength As Integer = 2000
For k = 0 To cuttingList.ElementAt(j).Value.Count - 1
endPieceLength -= sideFrameLengths("Frame " & cuttingList.ElementAt(j).Value(k))
Next
boolstatus = Part.EditRebuild3()
Dim swErrors As Integer
Dim swWarnings As Integer
boolstatus = Part.Save3(1, swErrors, swWarnings)
swApp.CloseDoc(Settings.folderPaths("object_" & Data.objectNum & "_models3D_frames_sw_support") & "\FRAME_L_END_PIECE" & j + 1 & ".SLDPRT")
If endPieceLength > 0 Then
Dim Part = swApp.OpenDoc6(Settings.HLCtFolder & "\HLCt\frame_l_straight.SLDPRT", 1, 0, "", longstatus, longwarnings)
longstatus = Part.SaveAs3(Settings.folderPaths("object_" & Data.objectNum & "_models3D_frames_sw_support") & "\FRAME_L_END_PIECE" & j + 1 & ".SLDPRT", 0, 0)
Dim swEquationMgr As EquationMgr
swEquationMgr = Part.GetEquationMgr()
Dim counter As Integer = 0
For i = 0 To swEquationMgr.GetCount() - 1
Dim equationName = swEquationMgr.Equation(i)
Dim tempName = equationName.Substring(1, equationName.Length - 2)
tempName = tempName.Split("""")(0)
equationName = equationName.Split("=")(0) & "= "
If tempName = "DP_HEIGHT" Then
swEquationMgr.Equation(i) = equationName & 30 'FIXA
counter += 1
ElseIf tempName = "DP_WIDTH" Then
swEquationMgr.Equation(i) = equationName & 40 'FIXA
counter += 1
ElseIf tempName = "DP_CUTOFFSET1" Then
Dim cutLength As Integer = 0
For k = 0 To cuttingList.ElementAt(j).Value.Count - 1
cutLength += sideFrameLengths("Frame " & cuttingList.ElementAt(j).Value(k))
Next
swEquationMgr.Equation(i) = equationName & cutLength
counter += 1
ElseIf tempName.Split("_")(0) = "DP" Then
swEquationMgr.Equation(i) = equationName & 0
counter += 1
End If
If counter = 7 Then
Exit For
End If
Next
boolstatus = Part.EditRebuild3()
Dim swErrors As Integer
Dim swWarnings As Integer
boolstatus = Part.Save3(1, swErrors, swWarnings)
swApp.CloseDoc(Settings.folderPaths("object_" & Data.objectNum & "_models3D_frames_sw_support") & "\FRAME_L_END_PIECE" & j + 1 & ".SLDPRT")
End If
Next
End Sub
End Class

View File

@ -13,17 +13,33 @@ Public Class Individual_Frame_Drawing
model = swApp.NewDocument("C:\ProgramData\SolidWorks\SOLIDWORKS 2020\templates\Assembly.asmdot", 0, 0, 0)
assembly = model
Dim compNames(Individual_Frame_3D.cuttingList.ElementAt(i).Value.Count) As String
Dim coordNames(Individual_Frame_3D.cuttingList.ElementAt(i).Value.Count) As String
Dim endPieceLength As Integer = 2000
For j = 0 To Individual_Frame_3D.cuttingList.ElementAt(i).Value.Count - 1
endPieceLength -= Individual_Frame_3D.sideFrameLengths("Frame " & Individual_Frame_3D.cuttingList.ElementAt(i).Value(j))
Next
Dim numOfParts As Integer = 0
Dim endPieceExist As Integer = 0
If endPieceLength > 0 Then
numOfParts = Individual_Frame_3D.cuttingList.ElementAt(i).Value.Count
Else
numOfParts = Individual_Frame_3D.cuttingList.ElementAt(i).Value.Count - 1
endPieceExist = 1
End If
Dim compNames(numOfParts) As String
Dim coordNames(numOfParts) As String
Dim transMatrix As Object = Nothing
For j = 0 To compNames.Count - 2
For j = 0 To compNames.Count - 2 + endPieceExist
Dim frameID = Individual_Frame_3D.cuttingList.ElementAt(i).Value(j) - 1
compNames(j) = Settings.filesFolder & "\Files\CADStart\" & frameComponents(frameID)("partName") & ".SLDPRT"
coordNames(j) = ""
Next
compNames(compNames.Count - 1) = Settings.folderPaths("object_" & Data.objectNum & "_models3D_frames_sw_support") & "\FRAME_L_END_PIECE" & i + 1 & ".SLDPRT"
coordNames(coordNames.Count - 1) = ""
If endPieceLength > 0 Then
compNames(compNames.Count - 1) = Settings.folderPaths("object_" & Data.objectNum & "_models3D_frames_sw_support") & "\FRAME_L_END_PIECE" & i + 1 & ".SLDPRT"
coordNames(coordNames.Count - 1) = ""
End If
Dim assemComps As Object
assemComps = assembly.AddComponents3((compNames), (transMatrix), (coordNames))
@ -98,7 +114,8 @@ Public Class Individual_Frame_Drawing
Dim OutLine = myView.GetOutline
For j = 0 To Individual_Frame_3D.cuttingList.ElementAt(i).Value.Count
Dim components = RootComp.GetChildren()
For j = 0 To components.Length - 1
Dim frameComponentName As String
If j = Individual_Frame_3D.cuttingList.ElementAt(i).Value.Count Then
frameComponentName = "frame_l_end_piece" & i + 1