Private Sub Form_Load()
Dim objApp As SolidEdgeFramework.Application
Dim objDoc As SolidEdgeDraft.DraftDocument
Dim objCenterLines As SolidEdgeFrameworkSupport.CenterLines
Dim objCircle 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.DraftDocument")
objApp.Visible = True
Else
Set objDoc = objApp.ActiveDocument
End If
' drawing a circle on the active sheet
Set objCircle = objDoc.ActiveSheet.Circles2d.AddByCenterRadius(x:=0.25, y:=0.25, Radius:=0.05)
' getting the CenterLines object on the active sheet
Set objCenterLines = objDoc.ActiveSheet.CenterLines
' drawing a center line on the active sheet using the nearest KeyPoint on the Circle object as reference for the Start point
Call objCenterLines.AddByStart(StartObject:=objCircle, x1:=0.25, y1:=0.5, z1:=0, keyPoint:=False, _
x2:=0.1, y2:=0.1, z2:=0)
' USER DISPLAY
' Release objects
Set objApp = Nothing
Set objDoc = Nothing
Set objCenterLines = Nothing
Set objCircle = Nothing
End Sub