找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 1515|回复: 1

Accessing the DWG thumbnail image (preview image)

[复制链接]

已领礼包: 40个

财富等级: 招财进宝

发表于 2021-1-11 20:35:15 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×

问题:
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                        |
+-------------------------------------------------------------------+



论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!

已领礼包: 604个

财富等级: 财运亨通

发表于 2021-1-11 21:15:41 | 显示全部楼层
N版呀,既然搞过来,想必您全看懂了,来个示例好不好?怎么搞"缩略图",既然能搞,就可独显示块,或者组,或者一部分对象,那就很有用处了。
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-12-14 17:49 , Processed in 0.393359 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表