Solid Edge Assembly Type Library
Replace Method
Specifies whether to replace only the specific instance of the Occurrence or to replace all instances.
Description
Replaces the referenced file with a new file.
Syntax
Visual Basic
Public Sub Replace( _
   ByVal NewOccurrenceFileName As String, _
   ByVal ReplaceAll As Boolean, _
   Optional ByVal NewFamilyMemberName As Variant _
) 
Parameters
NewOccurrenceFileName
ReplaceAll
Specifies whether to replace only the specific instance of the Occurrence or to replace all instances.
NewFamilyMemberName
Example
Private Sub Form_Load()
    Dim objApp As SolidEdgeFramework.Application
    Dim objDoc As SolidEdgeAssembly.AssemblyDocument
    Dim objPart As SolidEdgeAssembly.Occurrence
    Const TESTFILE = "T:\vbtests\testcases\cube.par"
    Const REPLACEFILE = "T:\vbtests\testcases\chead.par"
    ' 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
    ' placing a part in the assembly
    Set objPart = objDoc.Occurrences.AddByFilename(OccurrenceFileName:=TESTFILE)
    ' replacing the placed part in the assembly
    Call objPart.Replace(NewOccurrenceFileName:=REPLACEFILE, ReplaceAll:=True)
    ' USER DISPLAY
    ' Release objects
    Set objApp = Nothing
    Set objDoc = Nothing
    Set objPart = Nothing
End Sub
See Also

Occurrence Object  | Occurrence Members