Private Sub Form_Load()
Dim objApp As SolidEdgeFramework.Application
Dim objDoc As SolidEdgeDraft.DraftDocument
Dim objSheet As SolidEdgeDraft.Sheet
Dim objLine1 As SolidEdgeFrameworkSupport.Line2d
Dim objLine2 As SolidEdgeFrameworkSupport.Line2d
Dim objCircle1 As SolidEdgeFrameworkSupport.Circle2d
Dim objSelectSet As SolidEdgeFramework.SelectSet
' 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.DraftDocument")
objApp.Visible = True
Else
Set objDoc = objApp.ActiveDocument
End If
' getting the Active Sheet object
Set objSheet = objDoc.ActiveSheet
'Create few 2d entities
Set objLine1 = objSheet.Lines2d.AddBy2Points(x1:=0.1, y1:=0.1, x2:=0.25, y2:=0.1)
Set objLine2 = objSheet.Lines2d.AddByPointAngleLength(x:=0.1, y:=0.1, Angle:=45 / 180 * PI, Length:=0.25)
Set objCircle1 = objSheet.Circles2d.AddByCenterRadius(x:=0.01, y:=0.01, Radius:=0.05)
'Get hold of SelectSet object from Document object
Set objSelectSet = objDoc.SelectSet
'Add to SelectSet using AddAll method
Call objSelectSet.AddAll
' USER DISPLAY
If objSelectSet.Count <> 3 Then
MsgBox "Add method failed to add an item to the SelectSet"
End If
' Release objects
Set objApp = Nothing
Set objDoc = Nothing
Set objSheet = Nothing
Set objLine1 = Nothing
Set objLine2 = Nothing
Set objCircle1 = Nothing
Set objSelectSet = Nothing
End Sub