龙龙仔 发表于 2005-10-20 11:01:00

[推荐]Thumbnailer.arx for objectdbx

<P>Thumbnailer.arx&nbsp; Copyright 2005&nbsp; <A href="http://www.caddzone.com/" target="_blank" >www.caddzone.com</A></P>
<P>&nbsp;&nbsp; Thumbnailer ActiveX Server Documentation</P>
<P>&nbsp;&nbsp; Library:&nbsp;&nbsp; Thumbnailer.arx</P>
<P>&nbsp;&nbsp; Class:&nbsp;&nbsp;&nbsp;&nbsp; Application</P>
<P>&nbsp;&nbsp; ProgID:&nbsp;&nbsp;&nbsp; "Thumbnailer.Application"</P>
<P>&nbsp;&nbsp; Reference: "Thumbnailer 1.0 Type Library"</P>
<P>&nbsp;&nbsp; Requirements:&nbsp; AutoCAD 2004-2006</P>
<P>&nbsp;&nbsp; Terms and conditions of use:</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; This software may be used and freely distributed, <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; provided this notice and the copyright notice <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; displayed by the application when it loads, is not <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; removed, altered, or concealed.</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; This software is not warranted to be free of defects.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Any and all use of this software is undertaken at the <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; risk of the user. The author is not responsible for<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; any loss resulting directly or indirectly from the <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; use of this software.</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Your use of this software constitutes your acceptance<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; of these terms and conditions.<BR>&nbsp; <BR>&nbsp; Installation:<BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Thumbnailer.arx must be registered once when installed,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; by dragging it onto the AutoCAD window, or by loading it<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; as an ARX library using any supported means. If the<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; location of the Thumbnailer.arx file changes, it must<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; be re-registered again.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IMPORTANT: To install this library you must be logged<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; in with superuser or administrator rights.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IMPORTANT: Use of this library does NOT require it to be<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; loaded as an ARX library, and it should never be loaded<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; as such for normal use (e.g., do not add Thumbnailer.arx <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; to the startup suite or the acad.rx file, and do not load <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; it via the LoadArx() method or the LISP equivalent).<BR>&nbsp; <BR>&nbsp; Methods:&nbsp; PreserveThumbnail<BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; obj.PreserveThumbnail(IAcadDatabase Database)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Call this method and pass it the value of the<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Database property of an AxDbDocument, before<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; calling the AxDbDocument's SaveAs() method, and<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the existing thumbnail preview (if there is one)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; will be preserved<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp; AutoLISP wrapper/example:</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Pass an AxDbDocument to the following LISP function<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; to save it to a DWG file, with its existing thumbnail <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; preview retained:</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (defun SaveAsEx (dbxDoc filename / app)</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq app <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (vla-GetInterfaceObject <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (vlax-get-acad-object)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "Thumbnailer.Application"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (vlax-invoke-method app 'PreserveThumbnail<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (vlax-get-property dbxDoc 'Database)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (vlax-release-object app)</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (vlax-invoke-method dbxDoc 'SaveAs filename)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>Source:</P>
<P>&nbsp;&nbsp; The implementation of this method is fairly simple:</P>
<P>&nbsp;&nbsp; STDMETHODIMP CApplication::PreserveThumbnail(IAcadDatabase* Database)<BR>&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HRESULT hr = S_OK;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CComQIPtr&lt;IAcadBaseDatabase&gt; pBase(Database);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if( pBase != NULL )<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AcDbDatabase* pDb = NULL;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hr = pBase-&gt;GetDatabase(&amp;pDb);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if( FAILED( hr ) )<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return hr;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pDb-&gt;setRetainOriginalThumbnailBitmap(true);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return hr;<BR>&nbsp;&nbsp; }<BR></P>
<P></P>

tukuitk 发表于 2005-12-5 13:32:00

谢谢龙兄!请你有for R15的吗?我在那个网没有找到。

龙龙仔 发表于 2005-12-8 17:04:00

<P>注意:Requirements:&nbsp; AutoCAD 2004-2006</P>
<P>它for r15!&nbsp;&nbsp; 我在r2005~r2006测试通过! r2004未试!</P>

jiang3980 发表于 2006-12-6 08:22:00

怎么测试?

龙龙仔 发表于 2007-1-18 09:17:00

<p>例子:</p><p><a href="http://bbs.mjtd.com/forum.php?mod=viewthread&tid=57315">http://bbs.mjtd.com/forum.php?mod=viewthread&tid=57315</a></p>
页: [1]
查看完整版本: [推荐]Thumbnailer.arx for objectdbx