SketchImages method failed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I want to add some images into the drawing document, but seem to have an issue with accessing the DrawingSketch.SketchImages method.
Also code samples from the forum or documentation with this method throw the same error for me.
I am using Inventor 2021. Is this a known issue? And are there other ways to include an image at a specified location in the drawing document?
Sub InsertImage()
Dim oDrawDoc As DrawingDocument
Set oDrawDoc = ThisApplication.ActiveDocument
Dim oSheet As Sheet
Set oSheet = oDrawDoc.ActiveSheet
Dim oDrawSketch As DrawingSketch
Set oDrawSketch = oSheet.Sketches.Add()
oDrawSketch.Edit
Dim oImagePath As String
oImagePath = "C:\Temp\image.png"
Dim oPoint2d As Point2d
Set oPoint2d = ThisApplication.TransientGeometry.CreatePoint2d(0, 0)
Dim oSketchImage As SketchImage
Set oSketchImage = oDrawSketch.SketchImages.Add(oImagePath, oPoint2d)
oDrawSketch.ExitEdit
End Sub