Imports System.IO
Imports System.Runtime.InteropServices
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
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 objLine2 As SolidEdgeFrameworkSupport.Line2d
Dim objCenLine As SolidEdgeFrameworkSupport.CenterLine
Dim objCenLines As SolidEdgeFrameworkSupport.CenterLines
Dim strDfltlayer As String
Dim strLay1 As String
' Report errors
Const PI = 3.14159265358979
' Create/get the application with specific settings
Try
objApp = GetObject(, "SolidEdge.Application")
If objApp Is Nothing Then
Err.Clear()
objApp = CreateObject("SolidEdge.Application")
objDoc = objApp.Documents.Add("SolidEdge.DraftDocument")
objApp.Visible = True
Else
objDoc = objApp.Documents.Add("SolidEdge.DraftDocument")
End If
'getting the Active Sheet object
objSheet = objDoc.ActiveSheet
' getting the lines2d collection object
objLines2d = objSheet.Lines2d
' Create Line2d object using AddBy2Points method
objLine1 = objLines2d.AddBy2Points(x1:=0.05, y1:=0.05, x2:=0.1, y2:=0.05)
' Create Line2d object using AddBy2Points method
objLine2 = objLines2d.AddBy2Points(x1:=0.05, y1:=0.1, x2:=0.1, y2:=0.1)
objCenLines = objSheet.CenterLines
objCenLine = objCenLines.AddBetweenTwoLines(objLine1, objLine2)
Catch ex As Exception
MsgBox(ex.ToString)
' Release objects
objApp = Nothing
objDoc = Nothing
objSheet = Nothing
objLines2d = Nothing
objLine1 = Nothing
End Try
End Sub
End Class