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 dblx As Double, dbly As Double, dblz As Double
Dim cKeyPoint As SolidEdgeConstants.KeyPointType
Dim lngHandle As SolidEdgeConstants.HandleType
' 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 keypoint
Call objDimension.GetKeyPoint(Index:=0, x:=dblx, y:=dbly, z:=dblz, _
KeyPointType:=cKeyPoint, HandleType:=lngHandle)
' USER DISPLAY
' Release objects
Set objApp = Nothing
Set objDoc = Nothing
Set objSheet = Nothing
Set objdims = Nothing
Set objDimension = Nothing
Set objline = Nothing
End Sub