Files
Find intersecting edges between two bodies
Code
'Demonstrates how to determine if two bodies intersect one another using _
IBody2::GetIntersectionEdges
'Preconditions: Part with two non-intersecting bodies is open and they are both selected _
in the FM tree
'Results: message box is displayed if intersection edges are found
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swSelMgr As SldWorks.SelectionMgr
Dim swBody1 As SldWorks.Body2
Dim swBody2 As SldWorks.Body2
Dim vResults As Variant
Dim lngErrors As Long
Dim i As Integer
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swSelMgr = swModel.SelectionManager
Set swBody1 = swSelMgr.GetSelectedObject6(1, -1)
Set swBody1 = swBody1.Copy
Set swBody2 = swSelMgr.GetSelectedObject6(2, -1)
Set swBody2 = swBody2.Copy
vResults = swBody1.GetIntersectionEdges(swBody2)
If UBound(vResults) <> -1 Then MsgBox "Intersection edges found"
End Sub
'Note that an "empty" variant can mean a variant that has value "Empty" or value "No variables". _
If the latter case then IsEmpty() will not return true. Instead, test for whether the _
Ubound() is -1.