Private Sub Form_Load()
Dim objApp As SolidEdgeframework.Application
Dim objDoc As Solidedgedraft.DraftDocument
Dim objArr(1 To 3) As Object
Dim objRelns As SolidEdgeframeworksupport.Relations2d
Dim objReln1 As SolidEdgeframeworksupport.Relation2d
Dim objSheet As Solidedgedraft.Sheet
' 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
' Get the active sheet
Set objSheet = objDoc.ActiveSheet
' Create a Line object
Set objArr(1) = objSheet.Lines2d.AddBy2Points(x1:=0.15, y1:=0.15, x2:=0.2, y2:=0.2)
' Create a Circle object
Set objArr(2) = objSheet.Circles2d.AddByCenterRadius(x:=0.15, y:=0.15, Radius:=0.05)
' Create an Arc object
Set objArr(3) = objSheet.Arcs2d.AddByStartAlongEnd(xStart:=0.2, yStart:=0.2, _
xAlong:=0.25, yAlong:=0.2, xEnd:=0.2, yEnd:=0.25)
' Create a Set Relation between the objects
Set objRelns = objSheet.Relations2d
Set objReln1 = objRelns.AddSet(NumberElements:=3, Elements:=objArr())
' USER DISPLAY
' Release objects
Set objApp = Nothing
Set objDoc = Nothing
Set objArr(1) = Nothing
Set objArr(2) = Nothing
Set objArr(3) = Nothing
Set objSheet = Nothing
Set objRelns = Nothing
Set objReln1 = Nothing
End Sub