- UID
- 5280
- 积分
- 9466
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-5-18
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
问题:
How do I extract the DWG thumbnail image? Is an OCX control available I can
use to display the image in my dialog boxes?
解答:
The following lists the different methods for accessing the DWG thumbnail image:
Method #1
Use the ObjectARX API's acdbDisplayPreviewFromDwg() function to display a preview
image, but you need to use MFC. See DevNote #5298 for a detailed sample.
Method #2
Use the DWGThumbnail ActiveX control to view AutoCAD DWG preview images in any
ActiveX control container, such as VB. You'll find the DwgThumbnail OCX control
in the ADN web site using the Knowledge Base. (AutoCAD Utility Apllication)
Method #3
This method is the more powerful of the fourth methods detailed in this DevNote
because it uses the last technology of Autodesk product and displays the drawing
content rather than just the preview image. It uses the VoloView OCX control.
It also requires that VoloView or VoloView Express to be installed on your computer
(VoloView Express is for free!).
Download VoloView Express from the Autodesk web site at http://www.autodesk.com
Method #4
Examine the code that follows to learn how theDWG preview image information
(thumbnail image) is stored in AutoCAD DWG files. Note that this information
is subject to change without notice in future versions of AutoCAD.
*** DWG Preview Image Information ***
Offset 14 in the dwg (if you start counting from 1) contains a long which points
to the thumbnail sentinel.
Following the 16-byte sentinel are 4 bytes containing the size of of the
thumbnail data (excluding the sentinels).
Next, a single byte that contains the number of thumbnail objects follows. After
that, an array of thumbnail object descriptors follows, which is just a block
that describes what type of object it is, its offset in the dwg, and its size.
The object descriptors, and their data, can be in any order. The current types
are:
1. Title - A minimum of 80 bytes that may be used to describe the drawings
contents. Even if the title has fewer than 80 characters, 80 bytes of space is
always allocated.
2. BMP - A bitmap image of the drawing is actually everything in a BMP file
except for the BITMAPFILEHEADER. Any type is allowed, but the ones Autodesk
products write have 256 colors, and are compressed using BI_RLE8 format.
3 - WMF - A Windows metafile with the 22 byte Aldus header.
Afterwards, all the data for the formats are specified. What follows the data
next is another thumbnail sentinel that has its bits inverted.
+-------------------------------------------------------------------+
| thumnail sentinel - 16 bytes |
+-------------------------------------------------------------------+
| size of thumnail data - 4 bytes |
+-------------------------------------------------------------------|
| number of thumbnail objects - 1 byte +
+-------------------------------------------------------------------+
| array of thumbnail | type of object - 1byte |
| object descriptors +----------------------------------------------+
| | offset of object from start of dwg - 4 bytes |
| (0 thru n - 1) +----------------------------------------------+
| | size of object - 4 bytes |
+--------------------+----------------------------------------------+
| thumbnail data for objects 0 thru n - 1 |
+-------------------------------------------------------------------+
| inverse thumbnail sentinel |
+-------------------------------------------------------------------+
|
|