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

Problem Extracting 3D Drawings

1 REPLY 1
Reply
Message 1 of 2
aslam
180 Views, 1 Reply

Problem Extracting 3D Drawings

Dear all,
I am using following code for extracting Thumbnail of the drawing. It is working well for Autocad\Samples\Tablet.dwg file but not working for Autocad\Samples\3D House.dwg. Why this code is not generating thumbnail for all types of files.

[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl,
EntryPoint = "?acedReleaseThumbnailBitmap@@YAXPAUtagABITMAPINFO@@@Z")]
private static extern IntPtr acedReleaseThumbnailBitmap();

private void Form1_Load(object sender, EventArgs e)
{
IntPtr bmi = acedReleaseThumbnailBitmap();
if (bmi != IntPtr.Zero)
{

Bitmap bm = Marshaler.BitmapInfoToBitmap(bmi);

pictureBox1.Image = (System.Drawing.Image)bm.Clone();
bm.Dispose();
}
}
1 REPLY 1
Message 2 of 2
Anonymous
in reply to: aslam

It looks like acedGenerateThumbnailBitmap() does not
support the kludgy way Autodesk chose for evolving
AutoCAD to 3D (sort of like another application hiding
within AutoCAD, with minimal integration).

All of the SHADEMODE settings aside from 2d wireframe
use a different graphics display engine.

The only way I've found to get rendered thumbnails
is through AcDbViewTableRecord::getThumbnail(), and
they are only generated when you use the View toolbar
combo to switch views (probably because they use the
current viewport device context to do it (read: kludge)).

There is probably an API that will generate a thumbnail
for a view (e.g., requiring the view to be restored), but I
don't know what it is.

So, the way to get a rendered thumbnail is to create a
temporary AcDbViewTableRecord for a view comprising
the entire current/active viewport, and then find a way
to get AutoCAD to generate the view's thumbnail; grab
it, and then delete the view.

My guess is that that's exactly how they're doing it.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

wrote in message news:5316645@discussion.autodesk.com...
Dear all,
I am using following code for extracting Thumbnail of the drawing. It is working well for Autocad\Samples\Tablet.dwg file but not working for Autocad\Samples\3D House.dwg. Why this code is not generating thumbnail for all types of files.

[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl,
EntryPoint = "?acedReleaseThumbnailBitmap@@YAXPAUtagABITMAPINFO@@@Z")]
private static extern IntPtr acedReleaseThumbnailBitmap();

private void Form1_Load(object sender, EventArgs e)
{
IntPtr bmi = acedReleaseThumbnailBitmap();
if (bmi != IntPtr.Zero)
{

Bitmap bm = Marshaler.BitmapInfoToBitmap(bmi);

pictureBox1.Image = (System.Drawing.Image)bm.Clone();
bm.Dispose();
}
}

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