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

DwgPreview / Thumbnail

3 REPLIES 3
Reply
Message 1 of 4
Matt S
550 Views, 3 Replies

DwgPreview / Thumbnail

I have followed the advice given in this thread

http://discussion.autodesk.com/thread.jspa?messageID=5316869

in the use of DwgPreview.arx in Acad2006 to save the drawing preview image to a file. Everything works fine, but is there any way to change the image size or image format? I think the dimensions in pixels is something like 180x116, and I would really like to have it smaller, say 94x62.

Is this possible, and is it possible to change the formag from a .BMP to a .JPG?

Any advice is appreciated.
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Matt S

Hi, Matt.
DwgPreview.arx save thumbnail as it existent in dwg-file. You can translate it from BMP to JPG or any format an scale it to any dimensions.
Message 3 of 4
Matt S
in reply to: Matt S

I know I can do that after the fact, but it would be far more convienient to get the image in the format and the size that I want instead of converting lots of image files.

I may just have to do it manually though.
Message 4 of 4
Anonymous
in reply to: Matt S

Size of thumbnail fixed in dwg-file. It is not intresting for me to rewrite DwgPreview.arx in order to it can convert bmp-image to other format and scale it. 😞 It is more easy to do converting in C#-code. For example:

[code]
[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("dwgpreview.arx", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi ,
EntryPoint = "SaveDWGPreview")]
extern static private int SaveDWGPreview(string dwgfilename, string bmpfilename);
[CommandMethod("SavePreview")]
public void SavePreview()
{
Database db = HostApplicationServices.WorkingDatabase;
Autodesk.AutoCAD.Runtime.SystemObjects.DynamicLinker.LoadModule("DWGPreview.arx", false, false);
SaveDWGPreview(db.Filename, "C:\\dwgpreview.bmp");
System.Drawing.Image img = System.Drawing.Image.FromFile("C:\\dwgpreview.bmp");
System.Drawing.Bitmap bm = new System.Drawing.Bitmap(img,94,62);
img.Dispose(); System.IO.File.Delete("C:\\dwgpreview.bmp");
bm.Save("C:\\dwgpreview.jpg",ImageFormat.Jpeg);
bm.Dispose();
}
[/code]

Also look at this topic: http://www.autocad.ru/cgi-bin/f1/board.cgi?t=29565Fx
Message was edited by: Alexander Rivilis

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