.NET

Reply
Valued Contributor
71 Posts
2 Kudos
Registered: ‎09-26-2007
Post 1 of 18

no thumbnail preview.

651 Views, 17 Replies
08-07-2012 05:27 AM

Does anybody know away to save the drawing and not lose the thumbnail preview.

Mentor
225 Posts
24 Kudos
Registered: ‎09-15-2011
Post 2 of 18

Re: no thumbnail preview.

08-07-2012 06:52 AM in reply to: michael.vanhoose

Try this before saving the DWG database to a file:

 

Document doc = Application.DocumentManager.MdiActiveDocument;
doc.Database.ThumbnailBitmap = doc.CapturePreviewImage(320, 240);

 

-Khoa

Valued Contributor
71 Posts
2 Kudos
Registered: ‎09-26-2007
Post 3 of 18

Re: no thumbnail preview.

08-07-2012 07:00 AM in reply to: khoa.ho
Spoiler
Dim doc As Autodesk.AutoCAD.ApplicationServices.Document
        doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
        doc.Database.ThumbnailBitmap = doc.CapturePreviewImage(320, 240)

        doc.Database.SaveAs(doc.Database.Filename, True, DwgVersion.Current, doc.Database.SecurityParameters)

 

Just tried this and it didn't work.  This is funny issue.

Mentor
225 Posts
24 Kudos
Registered: ‎09-15-2011
Post 4 of 18

Re: no thumbnail preview.

08-07-2012 07:35 AM in reply to: michael.vanhoose

I tried the following command to save the current thumbnail of an opened drawing and it works for me. When you re-open this drawing, you will see its new updated thumbnail on the AutoCAD Open Dialog.

 

[CommandMethod("SaveThumbnail")]
public static void SaveThumbnail()
{
    Document doc = Application.DocumentManager.MdiActiveDocument;
    Database db = doc.Database;
    db.ThumbnailBitmap = doc.CapturePreviewImage(320, 240);
    db.SaveAs(db.Filename, DwgVersion.Current);
}

 

-Khoa

Valued Contributor
71 Posts
2 Kudos
Registered: ‎09-26-2007
Post 5 of 18

Re: no thumbnail preview.

08-07-2012 08:24 AM in reply to: khoa.ho

I tried that and that don't work.  Does 2011 have anything to do with it?

Mentor
225 Posts
24 Kudos
Registered: ‎09-15-2011
Post 6 of 18

Re: no thumbnail preview.

08-07-2012 08:34 AM in reply to: michael.vanhoose

My using AutoCAD version is 2009. We may need other people in the forum to test out this code, to see if it can update the drawing thumbnail based on the current view on AutoCAD.

 

-Khoa

Moderator
1,464 Posts
277 Kudos
Registered: ‎04-09-2008
Post 7 of 18

Re: no thumbnail preview.

08-07-2012 11:46 AM in reply to: michael.vanhoose

michael.vanhoose wrote:

Does anybody know away to save the drawing and not lose the thumbnail preview.


Try using Database.RetainOriginalThumbnailBitmap to preserve preview.

 


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Valued Contributor
71 Posts
2 Kudos
Registered: ‎09-26-2007
Post 8 of 18

Re: no thumbnail preview.

08-07-2012 11:48 AM in reply to: Alexander.Rivilis

I have also tried that.  What version are you using of Autocad?

Moderator
1,464 Posts
277 Kudos
Registered: ‎04-09-2008
Post 9 of 18

Re: no thumbnail preview.

08-07-2012 11:54 AM in reply to: michael.vanhoose

I've tried that some years ago with pure ObjectARX (not AutoCAD .NET API):

AcDbDatabase *pDB = new AcDbDatabase(Adesk::kFalse, Adesk::kTrue);
if (pDB->readDwgFile(filePath) == Acad::eOk) {
  // Some actions with Database 
  pDB->setRetainOriginalThumbnailBitmap(true);
  pDB->saveAs(filePath);
}

 Also with C#: http://through-the-interface.typepad.com/through_the_interface/2007/08/purging-regis-1.html


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

New Member
1 Posts
0 Kudos
Registered: ‎10-29-2012
Post 10 of 18

Re: no thumbnail preview.

10-31-2012 03:50 PM in reply to: michael.vanhoose

I'm not sure if this is what you want...type op(option) on the command line. click open and save. click thumbnail preview setting and check SAE A THUMBNAIL PREVIEW IMAGE.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post