.NET

Reply
Valued Contributor
michael.vanhoose
Posts: 71
Registered: ‎09-26-2007
Message 1 of 18 (645 Views)

no thumbnail preview.

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

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

Mentor
khoa.ho
Posts: 224
Registered: ‎09-15-2011
Message 2 of 18 (635 Views)

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
michael.vanhoose
Posts: 71
Registered: ‎09-26-2007
Message 3 of 18 (631 Views)

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
khoa.ho
Posts: 224
Registered: ‎09-15-2011
Message 4 of 18 (624 Views)

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
michael.vanhoose
Posts: 71
Registered: ‎09-26-2007
Message 5 of 18 (616 Views)

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
khoa.ho
Posts: 224
Registered: ‎09-15-2011
Message 6 of 18 (612 Views)

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
Alexander.Rivilis
Posts: 1,450
Registered: ‎04-09-2008
Message 7 of 18 (601 Views)

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
michael.vanhoose
Posts: 71
Registered: ‎09-26-2007
Message 8 of 18 (598 Views)

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
Alexander.Rivilis
Posts: 1,450
Registered: ‎04-09-2008
Message 9 of 18 (594 Views)

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
rizcusile11
Posts: 1
Registered: ‎10-29-2012
Message 10 of 18 (467 Views)

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
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.