DWG2ImageX 是一個(gè) ActiveX 控件,你無須使用 AutoCAD也能直接轉(zhuǎn)換 DWG/DXF 文件為 GIF,JPEG,BMP,PNG。
DWG2ImageX is an ActiveX control let you convert DWG/DXF file into GIF, JPEG, BMP, PNG directly, without need of AutoCAD.
示例代碼:
Dim objImage On Error Resume Next Set objImage= CreateObject("DWG2ImageX.Converter")
objImage.Width = 1024 objImage.Height = 768 objImage.ImageFormat = 2 '1--jpeg, 2--gif objImage.InputFile = "c:/My Drawings/8th floor furniture.dwg" MsgBox objImage.Version '得到繪圖文件版本。
MsgBox "Total "& objImage.ViewCount &" Views" For I=1 to objImage.ViewCount strViewName = objImage.ViewName(I) MsgBox "Converting view: "& strViewName& "..." nWidth = objImage.ViewWidth(I) nHeight= objImage.ViewHeight(I) MsgBox "Width="&nWidth&" Height="&nHeight strOutput = "c:/Output/"&strViewName objImage.Convert strOutput, strViewName Next If Err.Number < 0 Then MsgBox Err.Description End If |
功能
輸入文件 | 需轉(zhuǎn)換的文件。 |
寬度 | 在 pixels 中設(shè)置輸出圖片寬度。 |
高度 | 在 pixels 中設(shè)置輸出圖片高度。 |
背景 | 設(shè)置輸出圖片背景。 |
圖片格式 | 設(shè)置輸出圖片格式。 |
縮放類型 | 設(shè)置縮放類型。 |
視圖數(shù)目 | 在繪圖文件中取得視圖數(shù)目。 |
視圖名稱 | 通過索引取得視圖名稱。 |
視圖寬度 | 通過索引取得視圖寬度。 |
視圖高度 | 通過索引取得視圖高度。 |
版本 | 取得文件版本。 |
方法
轉(zhuǎn)換 | 把繪圖文件轉(zhuǎn)換為 Image 文件。 |
AddFontPath | 添加 AutoCAD 字體支持路徑。 |
支持版本:
支持從 AutoCAD R9 文件到當(dāng)前版本 AutoCAD 2008 文件。
支持語言:
支持任何支持 COM 的編程語言,如 Visual C++, VB, Delphi, FoxPro, VBScript, JavaScript 等等。
Sample Code
Dim objImage On Error Resume Next Set objImage= CreateObject("DWG2ImageX.Converter")
objImage.Width = 1024 objImage.Height = 768 objImage.ImageFormat = 2 '1--jpeg, 2--gif objImage.InputFile = "c:/My Drawings/8th floor furniture.dwg" MsgBox objImage.Version 'Get the drawing file version.
MsgBox "Total "& objImage.ViewCount &" Views" For I=1 to objImage.ViewCount strViewName = objImage.ViewName(I) MsgBox "Converting view: "& strViewName& "..." nWidth = objImage.ViewWidth(I) nHeight= objImage.ViewHeight(I) MsgBox "Width="&nWidth&" Height="&nHeight strOutput = "c:/Output/"&strViewName objImage.Convert strOutput, strViewName Next If Err.Number < 0 Then MsgBox Err.Description End If |
Properties
InputFile | Specify the file to be converted. |
Width | Set output image width in pixels. |
Height | Set output image height in pixels. |
Background | Set background of output image. |
ImageFormat | Set output image format. |
ZoomType | Set zoom type. |
| |
ViewCount | Get the views count in the drawing file. |
ViewName | Get the view name by index. |
ViewWidth | Get the view width by index. |
ViewHeight | Get the view height by index. |
Version | Get version of the file. |
Methods
Convert | Convert the drawing file to a Image file. |
AddFontPath | Add AutoCAD font support path. |
Version Support:
From AutoCAD R9 files to current version AutoCAD 2008 files;
Support Languages:
Any programming languages that supports COM, such as Visual C++, VB, Delphi, FoxPro, VBScript,JavaScript and etc.