.NET

Reply
*Expert Elite*
Alfred.NESWADBA
Posts: 9,084
Registered: ‎06-29-2007
Message 21 of 25 (210 Views)

Re: Problem with PaletteSet location in Autocad

11-20-2012 01:19 AM in reply to: ZK_BUDiKOM

Hi,

 

have you found that blog:

>>>Database.ThumbnailBitmap returns Nothing when called for a side database<<<?

I think that will be the answer.

 

- alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Active Contributor
ZK_BUDiKOM
Posts: 30
Registered: ‎09-13-2012
Message 22 of 25 (205 Views)

Re: Problem with PaletteSet location in Autocad

11-20-2012 02:31 AM in reply to: Alfred.NESWADBA

Hi alfred,

 

I have no idea what is wrong in this project :smileyhappy:

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 :smileyhappy:

 

My control "Palette" look like:

 

in AutoCAD (during run & debug), my Palette look like:

AutoCAD 2013 - NOT FOR RESALE - [Drawing1.dwg].jpg

 

no label.control, no background.color - This is weird, do not you think?

Maybe I do something wrong in other place?

 

regards

 

*Expert Elite*
Alfred.NESWADBA
Posts: 9,084
Registered: ‎06-29-2007
Message 23 of 25 (194 Views)

Re: Problem with PaletteSet location in Autocad

11-20-2012 10:06 AM in reply to: ZK_BUDiKOM

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 -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Active Contributor
ZK_BUDiKOM
Posts: 30
Registered: ‎09-13-2012
Message 24 of 25 (182 Views)

Re: Problem with PaletteSet location in Autocad

11-20-2012 11:56 PM in reply to: Alfred.NESWADBA

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

*Expert Elite*
Alfred.NESWADBA
Posts: 9,084
Registered: ‎06-29-2007
Message 25 of 25 (177 Views)

Re: Problem with PaletteSet location in Autocad

11-21-2012 01:27 AM in reply to: ZK_BUDiKOM

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 -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Need installation help?

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