Solid Edge Assembly Type Library
CreateReference Method
Specifies the object for which a reference is to be created.
Specifies the matrix that describes where the Reference object is to be located in the assembly.
Description
Returns the Reference object created for the given ReferenceKey.
Syntax
Visual Basic
Public Function CreateReference( _
   ByVal Occurrence As Occurrence, _
   ByVal Entity As Variant _
) As Object
Parameters
Occurrence
Specifies the object for which a reference is to be created.
Entity
Specifies the matrix that describes where the Reference object is to be located in the assembly.
Remarks
This method creates a Reference object. Because part documents are not stored in assembly documents themselves, relationships between part features within an assembly are stored through references. The CreateReference method is the automation interface to this service. When you want to use the edges of peer parts to place geometric and dimensional constraints, use the CreateReference method. The resulting Reference object can be used as input for these operations.
Example
Private Sub Form_Load()
    Dim objApp As SolidEdgeFramework.Application
    Dim objDoc As SolidEdgeAssembly.AssemblyDocument
    Dim objPart As SolidEdgeAssembly.Occurrence
    Dim objFace As SolidEdgeGeometry.Face
    Dim objReference As Object
    Const TESTFILE = "T:\vbtests\TestCases\Cube.par"
    ' Used for temporary storage of datadump return string
    Dim sDumpStatus As String
    ' Report errors
    Const PI = 3.14159265358979
    ' Create/get the application with specific settings
    On Error Resume Next
    Set objApp = GetObject(, "SolidEdge.Application")
    If Err Then
        Err.Clear
        Set objApp = CreateObject("SolidEdge.Application")
        Set objDoc = objApp.Documents.Add("SolidEdge.AssemblyDocument")
        objApp.Visible = True
    Else
        Set objDoc = objApp.ActiveDocument
    End If
    ' Place a Part on the Assembly Document
    Set objPart = objDoc.Occurrences.AddByFilename(TESTFILE)
    ' Get a face on the Part placed
    Set objFace = objPart.PartDocument.Models(1).Body.Faces(FaceType:=igQueryAll).Item(1)
    ' Create a reference to a face on the Part placed
    Set objReference = objDoc.CreateReference(Occurrence:=objPart, Entity:=objFace)
    ' USER DISPLAY
    ' Release objects
    Set objApp = Nothing
    Set objDoc = Nothing
    Set objPart = Nothing
    Set objFace = Nothing
    Set objReference = Nothing
End Sub
See Also

AssemblyDocument Object  | AssemblyDocument Members