Imports System.Runtime.InteropServices
Public Class Balloon_GetSetAlignmentShape
Private Sub btnGetSetAlignmentShape_Click(sender As System.Object, e As System.EventArgs) Handles btnGetSetAlignmentShape.Click
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
Dim DrawingView As SolidEdgeDraft.DrawingView = Nothing
Dim DrawingViews As SolidEdgeDraft.DrawingViews = Nothing
Dim DrawingView1 As SolidEdgeDraft.DrawingView = Nothing
Dim balloons As SolidEdgeFrameworkSupport.Balloons = Nothing
Dim balloon As SolidEdgeFrameworkSupport.Balloon = Nothing
Dim itemNumberDir As SolidEdgeFrameworkSupport.DimItemNumDirConstants = Nothing
Dim objFirstballoon As SolidEdgeFrameworkSupport.Balloon = Nothing
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 PointX As Double
Dim PointY As Double
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
'Get reference to active document
objDraftDoc = objApplication.ActiveDocument
'Get reference to sheet
objSheet = objDraftDoc.ActiveSheet
'Populate array for x-coordinate of points of Annotation Alignment Shape
dPointX(0) = 0.0
dPointX(1) = 0.1
dPointX(2) = 0.1
dPointX(3) = 0.0
dPointX(4) = 0.0
'Populate array for y-coordinate of points of Annotation Alignment Shape
dPointY(0) = 0.0
dPointY(1) = 0.0
dPointY(2) = 0.1
dPointY(3) = 0.1
dPointY(4) = 0.0
objAnnotAlignmentShapes = objSheet.AnnotAlignmentShapes
'Add balloon in the sheet
balloons = objSheet.Balloons
balloon = balloons.Add(0.1, 0.1, 0)
balloon.Leader = True
balloon.AddVertex(0.1, 0.1, 0)
' for AddAnnotAlignmentShape and other properties specific to alignment shapes.
objAnnotAlignmentShape = objAnnotAlignmentShapes.AddAnnotAlignmentShape(dPointX, dPointY)
Call balloon.SetAlignmentShape(objAnnotAlignmentShape, 0.05, 0.0)
Call balloon.GetAlignmentShape(objAlignmentShape, PointX, PointY)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
End Class