Solid Edge Assembly Type Library
AddByFilename Method
Specifies the complete path and file name for the associated PartDocument or AssemblyDocument.
Description
Adds an occurrence to the active assembly.
Syntax
Visual Basic
Public Function AddByFilename( _
   ByVal OccurrenceFileName As String, _
   Optional ByVal UseSimplifiedPart As Variant _
) As Occurrence
Parameters
OccurrenceFileName
Specifies the complete path and file name for the associated PartDocument or AssemblyDocument.
UseSimplifiedPart
Example
Private Sub Form_Load()
    Dim objApp As SolidEdgeFramework.Application
    Dim objDoc As SolidEdgeAssembly.AssemblyDocument
    Dim objParts As SolidEdgeAssembly.Occurrences
    Const TESTFILE = "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
    ' adding a part document from a file to the assembly document
    Set objParts = objDoc.Occurrences
    Call objParts.AddByFilename(OccurrenceFileName:=TESTFILE)
    ' USER DISPLAY
    ' Release objects
    Set objApp = Nothing
    Set objDoc = Nothing
    Set objParts = Nothing
End Sub
See Also

Occurrences Collection  | Occurrences Members

Send comments on this topic.