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