---------------
Insert 2D image in draft file
Solution
Imports System.IO
Imports System.Runtime.InteropServices
Imports SolidEdge.Constant.Interop
Module Insert2DImageInDraftFile
Sub Main()
Dim objApplication As SolidEdge.Framework.Interop.Application = Nothing
Dim objDraftDoc As SolidEdge.Draft.Interop.DraftDocument = Nothing
Dim objSheet As SolidEdge.Draft.Interop.Sheet = Nothing
Dim objType As Type = Nothing
Dim Image2d As SolidEdge.FrameworkSupport.Interop.Image2d = Nothing
Try
objApplication = Marshal.GetActiveObject("SolidEdge.Application")
If objApplication Is Nothing Then
objType = Type.GetTypeFromProgID("SolidEdge.Application")
objApplication = Activator.CreateInstance(objType)
objApplication.Visible = True
End If
objDraftDoc = objApplication.ActiveDocument
objSheet = objDraftDoc.ActiveSheet
objSheet.Images2d.AddImage(False, "D:\gtac.jpg")
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
End Module
Notes and References
Hardware/Software Configuration
Platform: AMD64
OS: window
OS Version: 764
Product: SOLID_EDGE
Application: AUTOMATION
Version: V109MP5
Function: API_DOCUMENT
Ref: 002-7009797