.NET

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

no thumbnail preview.

635 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: 219
Registered: ‎09-15-2011
Message 2 of 18 (625 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 (621 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: 219
Registered: ‎09-15-2011
Message 4 of 18 (614 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 (606 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: 219
Registered: ‎09-15-2011
Message 6 of 18 (602 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,431
Registered: ‎04-09-2008
Message 7 of 18 (591 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 (588 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,431
Registered: ‎04-09-2008
Message 9 of 18 (584 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 (457 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
Need installation help?

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