DWG2ImageX
DWG2ImageXはDWG/DXF/DWFファイルを画像ファイル(GIF, JPEG, BMP, PNG)へ変換ができるようにするActiveXコントロールです。 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 '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
プロパティ
InputFile 変換するファイル名
Width 出力画像の幅
Height 出力画像高さ
Background 出力画像のバックグラウンド
ImageFormat 出力画像フォーマットを設定
ZoomType ズームタイプを設定
ViewCount DWGファイルのビューカウントを読み取る
ViewName インデックスでビューの名前を読み取る
ViewWidth インデックスで、ビューの幅を読み取る
ViewHeight インデックスで、ビューの高さを読み取る
Version ファイルのバージョンを読み取る
メソッド
Convert ドローイングファイルを画像ファイルへ変換
AddFontPath AutoCADフォントサポートパスを追加
バージョンサポート
AutoCAD R9ファイルから、現在のAutoCAD 2010ファイルへ;
サポートされている言語
COMをサポートする全ての言語は使えます。
例えば、Visual C++, VB, Delphi, FoxPro, VBScript,JavaScript and etc.