.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

visible picture in a block definition remains UNREFERENCED

0 REPLIES 0
Reply
Message 1 of 1
Anonymous
205 Views, 0 Replies

visible picture in a block definition remains UNREFERENCED

Hi,

Is there any piece of logic in this, using AutoCAD 2007 and VB 2005 :
I programmaticaly create a block definition containing a rasterImageDef.

When I programmatically create a block reference, the rasterimage is viewable, drawn, in the model object.

But when I open the picture manager (or external references manager) the .jpg file remains unreferenced.

I would like to know more about the reference manager, concerning pictures, because I haven't found anything about this in the 7 API training Labs.

Here are some pieces of my code


'##########################################
Dim RasterImgDefID As ObjectId = ObjectId.Null
' PICTURE
Dim RasterImgDef As RasterImageDef = New RasterImageDef()
Dim RasterImg As RasterImage = New RasterImage()
Dim ImgDict As DBDictionary
Dim ImgDictID As ObjectId
' definition
With RasterImgDef
.SourceFileName = T_ApplicationParams.logo_cv_path
End With
'Dictionary
ImgDictID = RasterImageDef.GetImageDictionary(db)
If (ImgDictID.IsNull) Then
ImgDictID = RasterImageDef.CreateImageDictionary(db)
End If
ImgDict = trans.GetObject(ImgDictID, OpenMode.ForWrite, False)
If (Not ImgDict.Contains(T_AcadDatabaseParams.dict_Logo_CV_name)) Then
ImgDict.SetAt(T_AcadDatabaseParams.dict_Logo_CV_name, RasterImgDef)
End If

'def
'Image
With RasterImgDef
.Load()
.OpenImage()
.UpdateEntities()
End With
With RasterImg
.ImageDefId = RasterImgDef.ObjectId
.LayerId = layerId
.Visible = True
End With

Dim newBtr As BlockTableRecord = New BlockTableRecord()
newBtr.AppendEntity(RasterImg)
trans.AddNewlyCreatedDBObject(newBtr, True)
trans.AddNewlyCreatedDBObject(RasterImgDef, True)
trans.AddNewlyCreatedDBObject(RasterImg, True)

'After inserting the picture, I modify it
With RasterImg
Dim origin As Point3d = New Point3d( _
insPoint_LogoCV_min.X, _
insPoint_LogoCV_min.Y, _
0 _
)
Dim vectx As Vector3d = New Vector3d(insPoint_LogoCV_max.X - insPoint_LogoCV_min.X, 0, 0)
Dim vecty As Vector3d = New Vector3d(0, insPoint_LogoCV_max.Y - insPoint_LogoCV_min.Y, 0)
.Orientation = New CoordinateSystem3d(origin, vectx, vecty)
.ImageDefId = RasterImgDef.ObjectId
RasterImgDef.Load()
End With
'##########################################


I hope this will be enough to understand what' happening...

Thank you by advance.
0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost