Message 1 of 2
Delete SketchImage from drawing border
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am using Inventor 2024.1.1 and I have the following iLogic code, in which I am trying to delete certain images from a drawing border. I have confirmed that the loop is finding the correct images that I am trying to delete (I did this by adding msgbox(sketchImg.Name) inside the If statement in the For loop, and it does show the correct names of the images I want to delete). However, the images are not actually getting deleted. The program is also not erroring out. It seems as if the "sketchImg.Delete()" line simply isn't actually doing anything.
I am wondering if anybody could give me any insight into this. Perhaps I am just missing something simple? Any thoughts are very much appreciated!
'Get the drawing document and its first sheet Dim doc As DrawingDocument = ThisApplication.ActiveDocument Dim sht As Sheet = doc.Sheets(1) 'Get the sheet's border Dim border As Border = sht.Border 'Get the border's definition, sketch, and sketch images Dim borderDef As BorderDefinition = border.Definition Dim borderSketch As DrawingSketch = borderDef.Sketch Dim sketchImages As SketchImages = borderSketch.SketchImages 'Edit the border by deleting the barcodes borderDef.Edit(borderSketch) For Each sketchImg As SketchImage In sketchImages If sketchImg.Name.ToUpper().Contains("MYIMAGE") sketchImg.Delete() End If Next borderDef.ExitEdit(True)