Private Sub Form_Load()
Dim objApp As SolidEdgeFrameWork.Application
Dim objDoc As SolidEdgeDraft.DraftDocument
Dim objSheet As SolidEdgeDraft.Sheet
Dim objLines2d As SolidEdgeFrameworkSupport.Lines2d
Dim objLine1 As SolidEdgeFrameworkSupport.Line2d
' Dim dblx1 As Double, dbly1 As Double,
Dim dbllength As Double, dblScale As Double
Dim temp As Variant
' 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
' getting the lines2d collection object
Set objLines2d = objSheet.Lines2d
' Create Line2d object using AddBy2Points method
Set objLine1 = objLines2d.AddBy2Points(x1:=0.5, y1:=0.25, x2:=0.1, y2:=0.25)
'set the line length
objLine1.Length = 0.25
'scale the line2d
dblScale = 2
temp = objLine1.Scale(Factor:=dblScale)
'get the line length
dbllength = objLine1.Length
' USER DISPLAY
' Release objects
Set objApp = Nothing
Set objDoc = Nothing
Set objSheet = Nothing
Set objLines2d = Nothing
Set objLine1 = Nothing
End Sub