Only indent relevant bodies
This commit is contained in:
parent
f1cf8d5d1a
commit
4ace2261ca
Binary file not shown.
|
|
@ -249,6 +249,9 @@ Public Class Model_3D
|
|||
AssemblyExtension = Assembly.Extension
|
||||
Dim sldata = SelMgr.CreateSelectData
|
||||
|
||||
Dim swErrors As Integer
|
||||
Dim swWarnings As Integer
|
||||
Dim components = Assembly.GetComponents(True)
|
||||
|
||||
partDT = partModel.selectPart("*")
|
||||
|
||||
|
|
@ -261,7 +264,12 @@ Public Class Model_3D
|
|||
|
||||
Assembly.EditPart
|
||||
|
||||
Dim components = Assembly.GetComponents(True)
|
||||
Dim modelDoc As IModelDoc2
|
||||
modelDoc = Assembly
|
||||
boolstatus = AssemblyExtension.SelectByID2("HorizontalSplitBody@" & gratingPartName & "-1@" & designName, "BODYFEATURE", 0, 0, 0, False, 0, Nothing, 0)
|
||||
modelDoc.EditSuppress2()
|
||||
boolstatus = AssemblyExtension.SelectByID2("VerticalSplitBody@" & gratingPartName & "-1@" & designName, "BODYFEATURE", 0, 0, 0, False, 0, Nothing, 0)
|
||||
modelDoc.EditSuppress2()
|
||||
|
||||
Dim indexGrating As Integer
|
||||
For i = 0 To components.Length - 1
|
||||
|
|
@ -271,6 +279,7 @@ Public Class Model_3D
|
|||
End If
|
||||
Next
|
||||
|
||||
Dim gratingComponent As SldWorks.Component2 = components(indexGrating)
|
||||
Dim gratingBodies = components(indexGrating).GetBodies2(0)
|
||||
|
||||
Dim recessParts = partDT.Select("parentName = '" & gratingPartName & "'")
|
||||
|
|
@ -282,6 +291,8 @@ Public Class Model_3D
|
|||
' End If
|
||||
'Next
|
||||
|
||||
|
||||
|
||||
Dim recessPartName As String
|
||||
For i = 0 To recessParts.Count - 1
|
||||
Dim partName As String = recessParts(i)("partName")
|
||||
|
|
@ -302,11 +313,13 @@ Public Class Model_3D
|
|||
Next
|
||||
|
||||
Dim recessBodies = components(indexRecess).GetBodies2(0)
|
||||
Dim recessComponent As SldWorks.Component2 = components(indexRecess)
|
||||
Dim bodiesToCut = Check_Interference(gratingComponent, recessComponent)
|
||||
|
||||
For j = 0 To gratingBodies.Length - 1
|
||||
For j = 0 To bodiesToCut.Length - 1
|
||||
sldata.Mark = 1
|
||||
|
||||
Dim bodyName As String = gratingBodies(j).Name & "@" & gratingPartName & "-1@" & designName
|
||||
Dim bodyName As String = bodiesToCut(j).Name & "@" & gratingPartName & "-1@" & designName
|
||||
boolstatus = AssemblyExtension.SelectByID2(bodyName, "SOLIDBODY", 0, 0, 0, True, 1, Nothing, 0)
|
||||
|
||||
sldata.Mark = 4
|
||||
|
|
@ -329,8 +342,6 @@ Public Class Model_3D
|
|||
Next
|
||||
|
||||
Assembly.EditAssembly
|
||||
Dim swErrors As Integer
|
||||
Dim swWarnings As Integer
|
||||
|
||||
components = Assembly.GetComponents(True)
|
||||
For i = 0 To UBound(components)
|
||||
|
|
@ -340,4 +351,57 @@ Public Class Model_3D
|
|||
boolstatus = Assembly.Save3(1, swErrors, swWarnings)
|
||||
End Sub
|
||||
|
||||
Private Shared Function Check_Interference(comp1 As SldWorks.Component2, comp2 As SldWorks.Component2) ' Test Albins mocro för interference
|
||||
|
||||
Dim swApp As SldWorks.SldWorks
|
||||
Dim swModel As SldWorks.ModelDoc2
|
||||
Dim swAssy As SldWorks.AssemblyDoc
|
||||
Dim CompArray(1) As SldWorks.Component2
|
||||
Dim vCompArray
|
||||
Dim vIntCompArray
|
||||
Dim vIntFaceArray
|
||||
|
||||
Dim interfering
|
||||
|
||||
swApp = CType(System.Runtime.InteropServices.Marshal.GetActiveObject("SldWorks.Application"), SldWorks.SldWorks)
|
||||
swModel = swApp.ActiveDoc
|
||||
swAssy = swModel
|
||||
|
||||
CompArray(0) = comp1
|
||||
CompArray(1) = comp2
|
||||
|
||||
vCompArray = CompArray
|
||||
swAssy.ToolsCheckInterference2(2, (vCompArray), interfering, vIntCompArray, vIntFaceArray)
|
||||
|
||||
Dim Bodies(UBound(vIntFaceArray)) As Object
|
||||
Dim BodyNames(UBound(vIntFaceArray)) As String
|
||||
Dim CompNames(UBound(vIntFaceArray)) As String
|
||||
|
||||
For i = 0 To UBound(vIntFaceArray)
|
||||
|
||||
Bodies(i) = vIntFaceArray(i).GetBody
|
||||
BodyNames(i) = Bodies(i).Name
|
||||
CompNames(i) = vIntCompArray(i).Name2
|
||||
|
||||
Next
|
||||
|
||||
Dim gratingName As String = CompNames(0)
|
||||
Dim bodiesToCutList As New List(Of Object)
|
||||
|
||||
bodiesToCutList.Add(Bodies(0))
|
||||
For i = 1 To CompNames.Length - 1
|
||||
|
||||
If CompNames(i) <> gratingName Then
|
||||
Exit For
|
||||
ElseIf BodyNames(i) <> BodyNames(i - 1) Then
|
||||
bodiesToCutList.Add(Bodies(i))
|
||||
End If
|
||||
Next
|
||||
|
||||
Dim bodiesToCut() As Object
|
||||
bodiesToCut = bodiesToCutList.ToArray()
|
||||
|
||||
Return bodiesToCut
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
|
|
|||
Loading…
Reference in New Issue