Private Sub Form_Load()
Dim objApp As SolidEdgeFrameWork.Application
Dim objDoc As SolidEdgeDraft.DraftDocument
Dim objSheet As SolidEdgeDraft.Sheet
Dim objline As SolidEdgeFrameworkSupport.Line2d
Dim objdims As SolidEdgeFrameworkSupport.Dimensions
Dim objDimension As SolidEdgeFrameworkSupport.Dimension
Dim LngKeyPointCount As Long
' 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 an line2d
Set objline = objSheet.Lines2d.AddBy2Points(0.1, 0.1, 0.3, 0.1)
'create Dimension collection
Set objdims = objSheet.Dimensions
'create an coordinate dimension origin
Set objDimension = objdims.AddCoordinateOrigin(Object:=objline, _
x:=0.1, y:=0.1, z:=0, KeyPoint:=True)
'get keypointcount for dimension
LngKeyPointCount = objDimension.KeyPointCount
' USER DISPLAY
' Release objects
Set objApp = Nothing
Set objDoc = Nothing
Set objSheet = Nothing
Set objdims = Nothing
Set objDimension = Nothing
Set objline = Nothing
End Sub