diff --git a/HLCt/pressure_welded.SLDPRT b/HLCt/pressure_welded.SLDPRT index b7fe0cb..95a2a3d 100644 Binary files a/HLCt/pressure_welded.SLDPRT and b/HLCt/pressure_welded.SLDPRT differ diff --git a/Wardrobe/Gratings Data/Grating_Fill.vb b/Wardrobe/Gratings Data/Grating_Fill.vb index e7f01da..9181441 100644 --- a/Wardrobe/Gratings Data/Grating_Fill.vb +++ b/Wardrobe/Gratings Data/Grating_Fill.vb @@ -178,6 +178,37 @@ Public Class Grating_Fill Data.recessData.Rows(k)("GRATINGS") = tempList Next + + Dim tempList2 As New List(Of Integer) + Try + tempList2 = Data.recessData.Rows(k)("GRATINGS") + Catch ex As Exception + End Try + + Dim gratingIndex2 As Integer + + If Data.recessData.Rows(k)("CORNER") = 1 Then + gratingIndex2 = 0 + ElseIf Data.recessData.Rows(k)("CORNER") = 2 Then + gratingIndex2 = numOfHorizontal - 1 + ElseIf Data.recessData.Rows(k)("CORNER") = 3 Then + gratingIndex2 = numOfHorizontal * numOfVertical - 1 + Else + gratingIndex2 = numOfHorizontal * (numOfVertical - 1) + End If + + Dim indexNotAdded2 As Boolean = True + For j = 0 To tempList2.Count - 1 + If gratingIndex2 = tempList2(j) Then + indexNotAdded2 = False + Exit For + End If + Next + If indexNotAdded2 Then + tempList2.Add(gratingIndex2) + End If + + Data.recessData.Rows(k)("GRATINGS") = tempList2 End If Next End Sub diff --git a/Wardrobe/SolidWorks/Model_3D_Fill.vb b/Wardrobe/SolidWorks/Model_3D_Fill.vb index 6a25c44..130b213 100644 --- a/Wardrobe/SolidWorks/Model_3D_Fill.vb +++ b/Wardrobe/SolidWorks/Model_3D_Fill.vb @@ -223,7 +223,7 @@ Public Class Model_3D_Fill Assembly.ClearSelection2(True) For k = 0 To gratingBodies.Length - 1 - If gratingBodies(k).Name <> "HorizontalSplitBody" Then + If gratingBodies(k).Name <> "HorizontalSplitBody" AndAlso gratingBodies(k).Name <> "VerticalSplitBody" Then Dim bodyName As String = gratingBodies(k).Name & "@" & gratingPartName & "-1@" & designName boolstatus = AssemblyExtension.SelectByID2(bodyName, "SOLIDBODY", 0, 0, 0, True, 2, Nothing, 0) End If @@ -268,7 +268,6 @@ Public Class Model_3D_Fill End If Next - Dim recessPartName As String = recessParts(i)("partName") boolstatus = AssemblyExtension.SelectByID2(recessPartName & "-1@" & designName, "COMPONENT", 0, 0, 0, False, 0, Nothing, 0) Dim recessPart = SelMgr.GetSelectedObject6(1, -1) @@ -309,108 +308,177 @@ Public Class Model_3D_Fill Assembly.EditAssembly Next - For j = 0 To tempList.Count - 2 - Assembly.ClearSelection2(True) - Dim recessPartName As String = recessParts(i)("partName") - boolstatus = AssemblyExtension.SelectByID2(recessPartName & "-1@" & designName, "COMPONENT", 0, 0, 0, False, 0, Nothing, 0) - Dim recessPart = SelMgr.GetSelectedObject6(1, -1) - Assembly.EditPart + Assembly.ClearSelection2(True) - Dim gratingPartName As String = partDT.Rows(Data.recessData.Rows(i)("GRATINGS")(j))("partName") - Dim indexGrating As Integer - For k = 0 To components.Length - 1 - If components(k).Name2 = gratingPartName & "-1" Then - indexGrating = k - Exit For + Dim recessPartName2 As String = recessParts(i)("partName") + boolstatus = AssemblyExtension.SelectByID2(recessPartName2 & "-1@" & designName, "COMPONENT", 0, 0, 0, False, 0, Nothing, 0) + Dim recessPart2 = SelMgr.GetSelectedObject6(1, -1) + + Assembly.EditPart + + Dim indexRecess2 As Integer + For k = 0 To components.Length - 1 + If components(k).Name2 = recessPartName2 & "-1" Then + indexRecess2 = k + Exit For + End If + Next + + For j = 0 To Grating_Fill.numOfVertical * Grating_Fill.numOfHorizontal + For k = 1 To 2 + + Dim gratingPartName As String = partDT.Rows(j)("partName") + Dim indexGrating As Integer + For l = 0 To components.Length - 1 + If components(l).Name2 = gratingPartName & "-1" Then + indexGrating = l + Exit For + End If + Next + + Dim splitBodyName As String + If k = 1 Then + splitBodyName = "VerticalSplitBody" + Else + splitBodyName = "HorizontalSplitBody" End If - Next - - Dim indexRecess As Integer - For k = 0 To components.Length - 1 - If components(k).Name2 = recessPartName & "-1" Then - indexRecess = k - Exit For - End If - Next - - Dim recessBodies = components(indexRecess).GetBodies2(0) - Dim recessBodyIndex As Integer - For k = 0 To recessBodies.Length - 1 - If recessBodies(k).Name = "Boss-Extrude2" Then - recessBodyIndex = k - Exit For - End If - Next - Dim recessBody = recessBodies(recessBodyIndex) - - If Math.Abs(tempList(0) - tempList(1)) = 1 Then - 'Plane split - Dim planeName As String = "VerticalSplitPlane@" & gratingPartName & "-1@" & designName - boolstatus = AssemblyExtension.SelectByID2(planeName, "PLANE", 0, 0, 0, True, 0, Nothing, 0) - - Dim RefPlane As Object - RefPlane = Assembly.FeatureManager.InsertRefPlane(4, 0, 0, 0, 0, 0) - Assembly.ClearSelection2(True) - - - - Dim vResultingBodies As Object - vResultingBodies = Assembly.FeatureManager.PreSplitBody() - - Dim bodyOrigins As Object - Dim splitFeat As SldWorks.Feature - - splitFeat = Assembly.FeatureManager.PostSplitBody(vResultingBodies, False, bodyOrigins, "") - Assembly.ClearSelection2(True) - - gratingPartName = partDT.Rows(Data.recessData.Rows(i)("GRATINGS")(j + 1))("partName") - planeName = "VerticalSplitPlane@" & gratingPartName & "-1@" & designName - boolstatus = AssemblyExtension.SelectByID2(planeName, "PLANE", 0, 0, 0, True, 0, Nothing, 0) - - Dim RefPlane2 As Object - RefPlane2 = Assembly.FeatureManager.InsertRefPlane(4, 0, 0, 0, 0, 0) - Assembly.ClearSelection2(True) - - vResultingBodies = Assembly.FeatureManager.PreSplitBody() - splitFeat = Assembly.FeatureManager.PostSplitBody(vResultingBodies, False, bodyOrigins, "") - - Else Dim gratingBodies = components(indexGrating).GetBodies2(0) Dim cutBodyIndex As Integer - For k = 0 To gratingBodies.Length - 1 - If gratingBodies(k).Name = "HorizontalSplitBody" Then - cutBodyIndex = k + For l = 0 To gratingBodies.Length - 1 + If gratingBodies(l).Name = splitBodyName Then + cutBodyIndex = l Exit For End If Next Dim cutBody = gratingBodies(cutBodyIndex) - Assembly.ClearSelection2(True) + Dim recessBodies = components(indexRecess2).GetBodies2(0) + For l = 0 To recessBodies.Length - 1 + If recessBodies(l).Name <> "Boss-Extrude1" Then - sldata.Mark = 1 - Dim bodyName As String = recessBody.Name & "@" & recessPartName & "-1@" & designName - boolstatus = AssemblyExtension.SelectByID2(bodyName, "SOLIDBODY", 0, 0, 0, True, 1, Nothing, 0) + Dim recessBody = recessBodies(l) - sldata.Mark = 4 - Dim cutFace = cutBody.GetFirstFace - cutFace.Select4(True, sldata) + Assembly.ClearSelection2(True) - Assembly.FeatureManager.InsertIndent(0.01, 0, False, True, True, False) - End If + sldata.Mark = 1 + Dim bodyName As String = recessBodies(l).Name & "@" & recessPartName2 & "-1@" & designName + boolstatus = AssemblyExtension.SelectByID2(bodyName, "SOLIDBODY", 0, 0, 0, True, 1, Nothing, 0) + + sldata.Mark = 4 + Dim cutFace = cutBody.GetFirstFace + cutFace.Select4(True, sldata) + + Assembly.FeatureManager.InsertIndent(0.01, 0, False, True, True, False) + + End If + Next + + Next Assembly.ClearSelection2(True) - - Assembly.EditAssembly Next + Assembly.EditAssembly Next + 'Dim recessBodyIndex As Integer + 'For k = 0 To recessBodies.Length - 1 + ' If recessBodies(k).Name = bodyToSplit Then 'Kommer ändras + ' recessBodyIndex = k + ' Exit For + ' End If + 'Next + + 'Dim recessBody = recessBodies(recessBodyIndex) + + 'Dim splitBodyName As String + 'Dim numOfSplits As Integer + 'If Math.Abs(tempList(0) - tempList(1)) = 1 Then + ' splitBodyName = "VerticalSplitBody" + ' numOfSplits = Grating_Fill.numOfHorizontal + 'Else + ' splitBodyName = "HorizontalSplitBody" + ' numOfSplits = Grating_Fill.numOfVertical + 'End If + + 'For k = 0 To numOfSplits - 1 + ' gratingPartName = partDT.Rows(Data.recessData.Rows(i)("GRATINGS")(j + k))("partName") + ' For l = 0 To components.Length - 1 + ' If components(l).Name2 = gratingPartName & "-1" Then + ' indexGrating = l + ' Exit For + ' End If + ' Next + + ' Dim gratingBodies = components(indexGrating).GetBodies2(0) + ' Dim cutBodyIndex As Integer + ' For l = 0 To gratingBodies.Length - 1 + ' If gratingBodies(l).Name = splitBodyName Then + ' cutBodyIndex = l + ' Exit For + ' End If + ' Next + ' Dim cutBody = gratingBodies(cutBodyIndex) + + ' Assembly.ClearSelection2(True) + + ' sldata.Mark = 1 + ' Dim bodyName As String = recessBody.Name & "@" & recessPartName & "-1@" & designName + ' boolstatus = AssemblyExtension.SelectByID2(bodyName, "SOLIDBODY", 0, 0, 0, True, 1, Nothing, 0) + + ' sldata.Mark = 4 + ' Dim cutFace = cutBody.GetFirstFace + ' cutFace.Select4(True, sldata) + + ' Assembly.FeatureManager.InsertIndent(0.01, 0, False, True, True, False) + ' Next + + ''Plane split + 'gratingPartName = partDT.Rows(Data.recessData.Rows(i)("GRATINGS")(j + k))("partName") + + 'Dim planeName As String = "VerticalSplitPlane@" & gratingPartName & "-1@" & designName + 'boolstatus = AssemblyExtension.SelectByID2(planeName, "PLANE", 0, 0, 0, True, 0, Nothing, 0) + + 'Dim RefPlane As Object + 'RefPlane = Assembly.FeatureManager.InsertRefPlane(4, 0, 0, 0, 0, 0) + 'Assembly.ClearSelection2(True) + + 'planeName = "Top Plane@" & recessPartName & "-1@" & designName + 'boolstatus = AssemblyExtension.SelectByID2(planeName, "PLANE", 0, 0, 0, True, 0, Nothing, 0) + 'Dim swCompEnt = SelMgr.GetSelectedObject6(1, 0) + 'Dim swComp = SelMgr.GetSelectedObjectsComponent3(1, 0) + 'Dim swCompModel = swComp.GetModelDoc + + 'Dim swFeat As SldWorks.Feature + 'swFeat = swCompModel.FirstFeature + + 'Dim planeFeat As SldWorks.Feature + 'Do While Not swFeat Is Nothing + ' planeFeat = swFeat + ' swFeat = swFeat.GetNextFeature + 'Loop + + 'Assembly.ClearSelection2(True) + 'planeName = planeFeat.Name & "@" & recessPartName & "-1@" & designName + 'boolstatus = AssemblyExtension.SelectByID2(planeName, "PLANE", 0, 0, 0, True, 0, Nothing, 0) + + 'Dim vResultingBodies As Object + 'vResultingBodies = Assembly.FeatureManager.PreSplitBody() + + 'Dim bodyOrigins(1) As Object + 'bodyOrigins(0) = Nothing + 'bodyOrigins(1) = Nothing + 'Dim splitFeat As SldWorks.Feature + + 'splitFeat = Assembly.FeatureManager.PostSplitBody(vResultingBodies, False, bodyOrigins, "") + 'Assembly.ClearSelection2(True) + End Sub Private Shared Sub Recess_Indent2()