New Member
Posts: 1
Registered: ‎04-28-2006
Message 1 of 1 (159 Views)


159 Views, 0 Replies
04-28-2006 04:02 PM
I need to insert raster image in Map 3D 2006 by using VB.NET DLL that is loaded via NETLOAD

This is a code from my .net assembly
Dim db As Database = HostApplicationServices.WorkingDatabase
Dim tm As Autodesk.AutoCAD.DatabaseServices.TransactionManager = db.TransactionManager
Dim trans As Autodesk.AutoCAD.DatabaseServices.Transaction = tm.StartTransaction

Dim ID As ObjectId
Dim bt As BlockTable
Dim btr As BlockTableRecord
Dim msbtr As BlockTableRecord ' model space block table record

Dim RasterImgDef As New RasterImageDef
Dim RasterImg As New RasterImage
Dim ImgDict As DBDictionary
Dim ImgDictID As ObjectId
' definition
RasterImgDef.SourceFileName = "c:\picture\sunset.jpg"
' dictionary
ImgDictID = RasterImgDef.GetImageDictionary(db)
If ImgDictID.IsNull Then
ImgDictID = RasterImgDef.CreateImageDictionary(db)
End If
ImgDict = tm.GetObject(ImgDictID, OpenMode.ForWrite)
If Not ImgDict.Contains(NazivFajla(Putanja)) Then
ID = ImgDict.SetAt(NazivFajla(Putanja), RasterImgDef)
End If
tm.AddNewlyCreatedDBObject(RasterImgDef, True)

' image
RasterImg.ImageDefId = RasterImgDef.ObjectId
bt = tm.GetObject(db.BlockTableId, OpenMode.ForRead)

msbtr = tm.GetObject(bt.Item(msbtr.ModelSpace), OpenMode.ForWrite)
ID = msbtr.AppendEntity(RasterImg)
tm.AddNewlyCreatedDBObject(RasterImg, True)

Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical)
If (Not trans Is Nothing) Then
End If
End Try

It works fine (no errors), and I can see my image, but image is marked as "unreferenced" when I open Image manager. Also image does not react to reloading or detaching.
What am I doing wrong?

Another question
How can I get all rasterimage objects that reference rasterimagedef. I can count them with getentitycount method them but I can't get them.
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.