Hi,
have you found that blog:
>>>Database.ThumbnailBitmap returns Nothing when called for a side database<<<?
I think that will be the answer.
- alfred -
Hi alfred,
I have no idea what is wrong in this project 🙂
I changed like this:
public System.Drawing.Bitmap get_image_of_file(string filename) { //create a new database instance and load the dwg file into it. Database dbb = new Database(false, true); //dbb.ReadDwgFile(filename, FileOpenMode.OpenForReadAndAllShare, false, ""); dbb.ReadDwgFile(filename, FileOpenMode.OpenForReadAndReadShare, true, ""); MessageBox.Show(filename); //grab the thumbnail bitmap and get rid of the white background System.Drawing.Bitmap preview = dbb.ThumbnailBitmap; // preview.MakeTransparent(System.Drawing.Color.White); return preview; }
and it did not work. Error is the same.
Messagebox show me path to DWG file - is correct.
But I thank you for your patience and help 🙂
My control "Palette" look like:
in AutoCAD (during run & debug), my Palette look like:
no label.control, no background.color - This is weird, do not you think?
Maybe I do something wrong in other place?
regards
Hi,
do you have an older version of AutoCAD? I did test the attached project in debug-mode (with AutoCAD 2010) and it shows the preview icon. Update the references and verify it on your system.
-.alfred -
Hi Alfred,
I don't have AutoCAD2010, but I did test in AutoCAD2012.
It's work good, but... I noticed that some of the blocks are correct, others do not.
In attached are two blocks: 2010 not read, 2011 read.
Maybe here is the problem, not in program?
regards
Hi,
the 2010.DWG is a definition of a dynamic block, so when you open this drawing you get the question like that.
When opening your block with your preview-tool I get then this exception:
makes me thinking that opening a dynamic-blockdefinition is not supported yet by the API (at least with AutoCAD-2010).
In this case I would understand some difficulties to querying the thumbnail from the db-object.
But the 2011.DWG does work with your preview (at my workstation/with AutoCAD 2010).
- alfred -