bikelink 发表于 2009-11-17 05:59:31

不使用autocad如何得到预览dwg?

我已经搜索了一段时间,以便在不使用readdwg的情况下获得预览 - >getthumbnail,但我还没有找到解决方案。
有人可以给我一些建议吗?
提前致谢。
**** Hidden Message *****

dgorsman 发表于 2009-11-17 14:05:46

启动 TrueView 会话,并将图形文件用作参数。

BillZndl 发表于 2009-11-17 14:31:02

你没有说你正在使用什么版本,但这里有一些关于这个主题的更多信息:
http://discussion.autodesk.com/forums/thread.jspa?messageID=5405749&#5405749

bikelink 发表于 2009-11-18 02:09:47

有些是“提取图像”,因为我需要获取文件夹中文件的预览。我试过,但它不起作用。

BillZndl 发表于 2009-11-18 06:37:45


不起作用?真?
这正是我使用它的目的。
什么不起作用?
哦,这是你正在使用的外部应用程序?
我在AutoCAD中以可网络加载的dll使用它。

bikelink 发表于 2009-11-18 09:11:30

是的,它是extern代码。我正在尝试编写一个用户控件,以便显示文件夹绘图的预览。
在autocad中我没有遇到麻烦,我可以使用数据库的缩略图或某种方法来创建预览吗...(我不记得确切的名称,但我已经写了)。
好吧...我无法想象extern程序如何从dwg中检索预览!
检索位图的API,加载acmgdb.dll然后如果您不在autocad中运行,它会崩溃。

Keith™ 发表于 2009-11-18 23:35:55

好的,我修改了几年前使用的一段代码……无论如何,它都需要更新……我本来可以稍微更改代码以添加额外的错误检查,但我决定不这样做……
我的代码是按照VBA实用程序建模的,该工具设计用于读取位图并将其逐像素写入用户控件。我不记得最初的来源(已经很多年了),所以如果有人知道它是谁,请告诉我,我很乐意将这个想法归功于他们
无论如何,我已将其更新为读取缩略图信息,并将其放入位图对象中,该对象可以分配给需要图像的任何控件。i、 例如图片盒、框架、表格等。我还添加了将背景颜色从缩略图中的默认白色切换为黑色(反之亦然)的功能,以及在需要时保存文件的功能
用法非常简单…
这将从文件名中的文件加载位图,并将背景色设置为黑色
Dim imgMyImage As Image
imgMyImage = acThumbnailReader.GetThumbnail(FileName, False)
Me.PictureBox1.Image = imgMyImage

其他选项:
'returns bitmap image exactly as it is in the file
imgMyImage = acThumbnailReader.GetThumbnail(FileName)
'returns bitmap image exactly as it is in the file
imgMyImage = acThumbnailReader.GetThumbnail(FileName, True)
'returns bitmap image with inverted backcolor
imgMyImage = acThumbnailReader.GetThumbnail(FileName, False)
'returns bitmap image exactly as it is in the file and saves it as a temporary file in %temp%
imgMyImage = acThumbnailReader.GetThumbnail(FileName, True, True)
'returns bitmap image with inverted backcolor and saves it as a temporary file in %temp%
imgMyImage = acThumbnailReader.GetThumbnail(FileName, False, True)
'returns bitmap image exactly as it is in the file and saves it to a specified file
imgMyImage = acThumbnailReader.GetThumbnail(FileName, True, True, SaveNameWithPath)
'returns bitmap image with inverted backcolor and saves it to a specified file
imgMyImage = acThumbnailReader.GetThumbnail(FileName, False, True, SaveNameWithPath)

只需将附加的类添加到您的VB.Net项目中
我会将其转换为C#,但已经晚了..也许明天

Keith™ 发表于 2009-11-20 11:15:21

好的..我已经用C#重写了它,对于那些喜欢…
的人来说,它适用于VB.Net版本(即GetThumbnail有4个重载)…并且位图可以保存到文件和/或设置为任何控件的image属性
一如既往,错误检查是有限的,因此请记住这一点。
尽情享受吧!

bikelink 发表于 2009-12-1 05:20:59

哇!我刚才看到了...我要去试试!

ognyandim 发表于 2010-11-15 05:30:40

它在AutoCAD 2008 64位上工作正常! 非常好的工作!
页: [1] 2
查看完整版本: 不使用autocad如何得到预览dwg?