Private Sub Form_Load()
Dim objApp As SolidEdgeFramework.Application
Dim objDoc As SolidEdgePart.PartDocument
Dim objSelectSet As SolidEdgeFramework.SelectSet
Dim objProfile As SolidEdgePart.Profile
Dim objLine1 As SolidEdgeFrameworkSupport.Line2d
Dim objLine2 As SolidEdgeFrameworkSupport.Line2d
Dim objCircle1 As SolidEdgeFrameworkSupport.Circle2d
' 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.PartDocument")
objApp.Visible = True
Else
Set objDoc = objApp.ActiveDocument
End If
'Create few 2d elements
Set objProfile = objDoc.ProfileSets.Add.Profiles.Add(pRefPlaneDisp:=objDoc.RefPlanes(1))
Set objLine1 = objProfile.Lines2d.AddBy2Points(x1:=0, y1:=0, x2:=0.1, y2:=0.1)
Set objLine2 = objProfile.Lines2d.AddBy2Points(x1:=0, y1:=0, x2:=0, y2:=0.1)
Set objCircle1 = objProfile.Circles2d.AddByCenterRadius(x:=0, y:=0, Radius:=0.05)
'Get SelectSet object from the PartDocument
Set objSelectSet = objDoc.SelectSet
'Add a line and circle to the selectset
Call objSelectSet.Add(dispatch:=objLine1)
Call objSelectSet.Add(dispatch:=objCircle1)
'Remove All elements from the selectset
objSelectSet.RemoveAll
' USER DISPLAY
' Release objects
Set objApp = Nothing
Set objDoc = Nothing
Set objSelectSet = Nothing
Set objLine1 = Nothing
Set objLine2 = Nothing
Set objCircle1 = Nothing
End Sub