Solid Edge Assembly Type Library
CreateTopologyReferenceToBodyOverride Method
Description
Syntax
Visual Basic
Public Sub CreateTopologyReferenceToBodyOverride( _
   ByRef ReferenceKey() As Byte, _
   ByRef TopologyReference As TopologyReference _
) 
Parameters
ReferenceKey
TopologyReference
Example
Imports System.Runtime.InteropServices
Public Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
     
        Dim objApplication As SolidEdgeFramework.Application = Nothing
        Dim objDocuments As SolidEdgeFramework.Documents = Nothing
        Dim objAssemblyDocument As SolidEdgeAssembly.AssemblyDocument = Nothing
        Dim objOccurrences As SolidEdgeAssembly.Occurrences
        Dim Ref1 As SolidEdgeGeometry.Body = Nothing
        Dim objTopoRef As SolidEdgeAssembly.TopologyReference = Nothing

        Dim RefKey(1) As Byte
        Dim RefKeySize As Integer
        Dim objObject As Object = Nothing
        Dim nType As SolidEdgeConstants.ObjectType
        Dim objFaceRef As SolidEdgeAssembly.TopologyReference
        Dim objFace As SolidEdgeGeometry.Face
        Dim objOverrideBodyFaces As SolidEdgeGeometry.Faces
        Dim objOccurrence As SolidEdgeAssembly.Occurrence = Nothing
        Dim objOccurrence2 As SolidEdgeAssembly.Occurrence = Nothing
        Dim i As Integer

        Try
            objApplication = Marshal.GetActiveObject("SolidEdge.Application")
            objApplication.Visible = True
            objDocuments = objApplication.Documents
            objAssemblyDocument = objApplication.ActiveDocument
            objOccurrences = objAssemblyDocument.Occurrences

            For i = 1 To objOccurrences.Count
                objOccurrence = objOccurrences.Item(i)
                If objOccurrence.HasBodyOverride = True And objOccurrence.Subassembly = False Then
                    'Create Ref1 so that it can be used for further operations
                    Ref1 = objOccurrence.Body
                    objOverrideBodyFaces = Ref1.Faces(SolidEdgeGeometry.FeatureTopologyQueryTypeConstants.igQueryAll)
                    objFace = objOverrideBodyFaces(1)
                    nType = objFace.Type
                    ' Create a Reference to the first face of the override body
                    objFaceRef = objAssemblyDocument.CreateReference2(objOccurrence, objFace)
                    nType = objFaceRef.Type
                    'Get RefKey
                    objFaceRef.GetReferenceKey(RefKey, RefKeySize)
                    objOccurrence.CreateTopologyReferenceToBodyOverride(RefKey, objObject)
                    'Rebind the stored refkey to get the object
                    objAssemblyDocument.BindKeyToObject(RefKey, objObject)
                    nType = objObject.Type()
                End If
            Next

        Catch ex As Exception
            MsgBox(ex.Message)
            Clipboard.SetText(ex.ToString)
        End Try
    End Sub

End Class
See Also

Occurrence Object  | Occurrence Members  | Solid Edge ST5 - What's New  | Solid Edge ST4 MP2 - What's New  | Solid Edge ST3 MP9 - What's New