I can find which images are attached to my current drawing with the following code. However, I don't know how to find out how many times they are attached.
Using tr As Transaction = db.TransactionManager.StartTransaction Try Dim nod As DBDictionary Dim imageDict As DBDictionary Console.WriteLine("Getting ACAD_IMAGE_DICT DB dictionary") nod = CType(tr.GetObject(db.NamedObjectsDictionaryId, OpenMode.ForRead, False), DBDictionary) imageDict = CType(tr.GetObject(nod.GetAt("ACAD_IMAGE_DICT"), OpenMode.ForRead, False), DBDictionary) For Each dicentry As DBDictionaryEntry In imageDict Dim myRasterImgDef As RasterImageDef = CType(tr.GetObject(CType(dicentry.Value, ObjectId), OpenMode.ForRead), RasterImageDef) If myRasterImgDef.IsLoaded Then Console.WriteLine("Found: " & myRasterImgDef.ActiveFileName) ' NEED TO COUNT INSTANCES HERE Else Console.WriteLine("Not found: " & myRasterImgDef.SourceFileName) End If Next tr.Commit() Catch ex As Exception System.Windows.Forms.MessageBox.Show(ex.ToString, "Configurator", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Stop) End Try End Using
Thanx in advance
Solved! Go to Solution.
Will give option 2 a shot, seems the most appropriate indeed.
If you happen to have an example for this iteration ,great, if not, I'll figure it out by myself ;-)
Can you try DevBlog solution "Identifying number times a Raster Image is used in a drawing"
Autodesk Devloper Network