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