Imports System.Runtime.InteropServices
Public Class AddAnnotAlignmentShapes
Private Sub btnAddAnnotationAlignmentShape_Click(sender As System.Object, e As System.EventArgs) Handles btnAddAnnotationAlignmentShape.Click
Dim objSheet As SolidEdgeDraft.Sheet = Nothing
Dim objAnnotAlignmentShapes As SolidEdgeFrameworkSupport.AnnotAlignmentShapes = Nothing
Dim objAnnotAlignmentShape As SolidEdgeFrameworkSupport.AnnotAlignmentShape = Nothing
Dim dPointX(0 To 5) As Double
Dim dPointY(0 To 5) As Double
Dim dPointX1(0 To 5) As Double
Dim dPointY1(0 To 5) As Double
Dim dPointX2(0 To 5) As Double
Dim dPointY2(0 To 5) As Double
Dim objApplication As SolidEdgeFramework.Application = Nothing
Dim objLine As SolidEdgeFrameworkSupport.Line2d = Nothing
Dim objCircle As SolidEdgeFrameworkSupport.Circle2d = Nothing
Dim objDraftDoc As SolidEdgeDraft.DraftDocument = Nothing
Dim objAlignmentShape As SolidEdgeFrameworkSupport.AnnotAlignmentShape = Nothing
Dim objType As Type = Nothing
Try
' Create/get the application with specific settings
objApplication = Marshal.GetActiveObject("SolidEdge.Application")
If objApplication Is Nothing Then
' Get the type from the Solid Edge ProgID
objType = Type.GetTypeFromProgID("SolidEdge.Application")
' Start Solid Edge
objApplication = Activator.CreateInstance(objType)
' Make Solid Edge visible
objApplication.Visible = True
End If
objDraftDoc = objApplication.ActiveDocument
objSheet = objDraftDoc.ActiveSheet
dPointX(0) = 0.0
dPointX(1) = 0.1
dPointX(2) = 0.1
dPointX(3) = 0.0
dPointX(4) = 0.0
dPointY(0) = 0.0
dPointY(1) = 0.0
dPointY(2) = 0.1
dPointY(3) = 0.1
dPointY(4) = 0.0
objAnnotAlignmentShapes = objSheet.AnnotAlignmentShapes
' for AddAnnotAlignmentShape and other properties specific to alignment shapes.
objAnnotAlignmentShape = objAnnotAlignmentShapes.AddAnnotAlignmentShape(dPointX, dPointY)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
End Class