Private Sub GetElement_Click(sender As Object, e As EventArgs) Handles GetElement1.Click
Dim objApp As SolidEdgeFramework.Application = Nothing
Dim objAsmDoc As SolidEdgeAssembly.AssemblyDocument = Nothing
Dim objrels As SolidEdgeAssembly.Relations3d = Nothing
Dim objrel As Object = Nothing
Dim objele1 As Object = Nothing
Dim objele2 As Object = Nothing
Dim objele1TR As SolidEdgeAssembly.TopologyReference = Nothing
Dim objele2TR As SolidEdgeAssembly.TopologyReference = Nothing
Dim objele1R As SolidEdgeFramework.Reference = Nothing
Dim objele2R As SolidEdgeFramework.Reference = Nothing
Dim boolval1 As Boolean = Nothing
Dim boolval2 As Boolean = Nothing
Dim objocc1 As SolidEdgeAssembly.Occurrence = Nothing
Dim objocc2 As SolidEdgeAssembly.Occurrence = Nothing
Dim objTopOcc1 As Object = Nothing
Dim aSubOccs1(0 To 4) As Object
Dim numSubOcc1 As Integer
Dim numBoundSubOcc1 As Integer
Dim objTopOcc2 As Object = Nothing
Dim aSubOccs2(0 To 4) As Object
Dim numSubOcc2 As Integer
Dim numBoundSubOcc2 As Integer
Dim sName1 As String
Dim sName2 As String
Dim strRetStatusMsg As String
Dim lCount As Integer
Dim lIndex As Integer
Try
' Create/get the application with specific settings
objApp = GetObject(, "SolidEdge.Application")
' open the document mentioned in the doc files.
objAsmDoc = objApp.ActiveDocument
objrels = objAsmDoc.Relations3d
lCount = objrels.Count
For lIndex = 1 To lCount
objrel = objrels.Item(lIndex)
If objrel.Type <> SolidEdgeFramework.ObjectType.igAngularRelation3d Then
objele1 = objrel.GetElement1(boolval1)
objele2 = objrel.GetElement2(boolval2)
objocc1 = objrel.Occurrence1
objocc2 = objrel.Occurrence2
sName1 = objocc1.Name
sName2 = objocc2.Name
If boolval1 Then
objele1TR = DirectCast(objele1, SolidEdgeAssembly.TopologyReference)
objele1TR.GetOccurrencesInPath(objTopOcc1, numSubOcc1, numBoundSubOcc1, aSubOccs1)
Else
objele1R = DirectCast(objele1, SolidEdgeFramework.Reference)
objele1R.GetOccurrencesInPath(objTopOcc1, numSubOcc1, numBoundSubOcc1, aSubOccs1)
End If
If boolval2 Then
objele2TR = DirectCast(objele2, SolidEdgeAssembly.TopologyReference)
objele2TR.GetOccurrencesInPath(objTopOcc2, numSubOcc2, numBoundSubOcc2, aSubOccs2)
Else
objele2R = DirectCast(objele2, SolidEdgeFramework.Reference)
objele2R.GetOccurrencesInPath(objTopOcc2, numSubOcc2, numBoundSubOcc2, aSubOccs2)
End If
End If
Next lIndex
Catch ex As Exception
Clipboard.SetText(ex.ToString)
End Try
End Sub