Angle recess works for fill grid
This commit is contained in:
parent
6a1a75fab2
commit
e2fceeac69
Binary file not shown.
|
|
@ -178,6 +178,37 @@ Public Class Grating_Fill
|
||||||
|
|
||||||
Data.recessData.Rows(k)("GRATINGS") = tempList
|
Data.recessData.Rows(k)("GRATINGS") = tempList
|
||||||
Next
|
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
|
End If
|
||||||
Next
|
Next
|
||||||
End Sub
|
End Sub
|
||||||
|
|
|
||||||
|
|
@ -223,7 +223,7 @@ Public Class Model_3D_Fill
|
||||||
Assembly.ClearSelection2(True)
|
Assembly.ClearSelection2(True)
|
||||||
|
|
||||||
For k = 0 To gratingBodies.Length - 1
|
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
|
Dim bodyName As String = gratingBodies(k).Name & "@" & gratingPartName & "-1@" & designName
|
||||||
boolstatus = AssemblyExtension.SelectByID2(bodyName, "SOLIDBODY", 0, 0, 0, True, 2, Nothing, 0)
|
boolstatus = AssemblyExtension.SelectByID2(bodyName, "SOLIDBODY", 0, 0, 0, True, 2, Nothing, 0)
|
||||||
End If
|
End If
|
||||||
|
|
@ -268,7 +268,6 @@ Public Class Model_3D_Fill
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
|
|
||||||
|
|
||||||
Dim recessPartName As String = recessParts(i)("partName")
|
Dim recessPartName As String = recessParts(i)("partName")
|
||||||
boolstatus = AssemblyExtension.SelectByID2(recessPartName & "-1@" & designName, "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)
|
boolstatus = AssemblyExtension.SelectByID2(recessPartName & "-1@" & designName, "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)
|
||||||
Dim recessPart = SelMgr.GetSelectedObject6(1, -1)
|
Dim recessPart = SelMgr.GetSelectedObject6(1, -1)
|
||||||
|
|
@ -309,108 +308,177 @@ Public Class Model_3D_Fill
|
||||||
Assembly.EditAssembly
|
Assembly.EditAssembly
|
||||||
Next
|
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 recessPartName2 As String = recessParts(i)("partName")
|
||||||
Dim indexGrating As Integer
|
boolstatus = AssemblyExtension.SelectByID2(recessPartName2 & "-1@" & designName, "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)
|
||||||
For k = 0 To components.Length - 1
|
Dim recessPart2 = SelMgr.GetSelectedObject6(1, -1)
|
||||||
If components(k).Name2 = gratingPartName & "-1" Then
|
|
||||||
indexGrating = k
|
Assembly.EditPart
|
||||||
Exit For
|
|
||||||
|
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
|
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 gratingBodies = components(indexGrating).GetBodies2(0)
|
||||||
Dim cutBodyIndex As Integer
|
Dim cutBodyIndex As Integer
|
||||||
For k = 0 To gratingBodies.Length - 1
|
For l = 0 To gratingBodies.Length - 1
|
||||||
If gratingBodies(k).Name = "HorizontalSplitBody" Then
|
If gratingBodies(l).Name = splitBodyName Then
|
||||||
cutBodyIndex = k
|
cutBodyIndex = l
|
||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
Dim cutBody = gratingBodies(cutBodyIndex)
|
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 recessBody = recessBodies(l)
|
||||||
Dim bodyName As String = recessBody.Name & "@" & recessPartName & "-1@" & designName
|
|
||||||
boolstatus = AssemblyExtension.SelectByID2(bodyName, "SOLIDBODY", 0, 0, 0, True, 1, Nothing, 0)
|
|
||||||
|
|
||||||
sldata.Mark = 4
|
Assembly.ClearSelection2(True)
|
||||||
Dim cutFace = cutBody.GetFirstFace
|
|
||||||
cutFace.Select4(True, sldata)
|
|
||||||
|
|
||||||
Assembly.FeatureManager.InsertIndent(0.01, 0, False, True, True, False)
|
sldata.Mark = 1
|
||||||
End If
|
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.ClearSelection2(True)
|
||||||
|
|
||||||
Assembly.EditAssembly
|
|
||||||
Next
|
Next
|
||||||
|
|
||||||
|
Assembly.EditAssembly
|
||||||
Next
|
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
|
End Sub
|
||||||
|
|
||||||
Private Shared Sub Recess_Indent2()
|
Private Shared Sub Recess_Indent2()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue