Interface IConverter

DWG2ImageX

DWG2ImageX is a Component let you convert DWG/DXF file into GIF, JPEG, BMP, PNG directly, without need of AutoCAD.

Object Members | Sample

Version Support:

From AutoCAD R9 files to current version AutoCAD 2004 files;

Support Languages:

Any programming languages that supports COM, such as Visual C++, VB, Delphi, FoxPro, VBScript,JavaScript and etc.

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

How to buy?

If you are interest in the Component, or need more functions, please email us:

info@autodwg.com

http://www.autodwg.com


Interface IConverter

Converter members

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.


IConverter::AddFontPath

Converter::AddFontPath

Sub AddFontPath(szPath As String)

Add AutoCAD font path. The converter will search font file in these paths.

Parameters

szPath

Where AutoCAD font file located.

(C) 2004 AutoDWG  All rights reserved


IConverter::Background

Property Let Background As Long

Set background 1~255, same as AutoCAD color index.

255 -- White
...


IConverter::ViewCount

Converter::ColorMode

Property Set ColorMode As Long

Set output image's color,

  • 0-- color;
  • 1-- white and black


IConverter::Convert

Converter::Convert

Sub Convert(szOutputFileName As String, view)

Convert the drawing file to image.

Parameters

szOutputFileName

Specify the output file name.

view

There are one or more views in a dwg file, specify view name or view index to be convert.

Examples

...

For I = 0 to objImage.ViewCount
objImage.Convert "c:\House.gif", objImage.ViewName(I)
...
Next

OR

For I = 0 to objImage.ViewCount
objImage.Convert "c:\House.gif", I
...
Next


IConverter::ViewName

Converter::PenWidth

Property Get/Set PenWidthy(colorIndex As Long) As Long

Set/Get pen width ( line width) in pixels, default value is 1.

Parameters

colorIndex

AutoCAD color index, 0~255, 0-black, 7-white


IConverter::Height

Converter::Height

Property Let Height As Long

Set height of output image file.


IConverter::ImageFormat

Converter::ImageFormat

Property Let ImageFormat As Integer

Set output image format.

0-- BMP
1-- JPEG
2-- GIF
3-- PNG
4-- TIFF


IConverter::InputFile

Converter::InputFile

Property Let InputFile As String

Set input file name.


IConverter::Version

property Version

Property Get Version As String

Get the version, possible return value: R9, R10, R11/12, R13, R14, R2000, R2002, R2004, Unknown:


IConverter::ViewCount

Converter::ViewCount

Property Get ViewCount As Long

Get the view counts in the dwg file.


IConverter::ViewHeight

Converter::ViewHeight

Property Get ViewHeight(view) As Double

Get View Height

Parameters

view

View name or view index.


IConverter::ViewName

Converter::ViewName

Property Get ViewName(nIndex As Long) As String

Get view name by index.

Parameters

nIndex

index of view.


IConverter::ViewWidth

Converter::ViewWidth

Property Get ViewWidth(view) As Double

Get width of view.

Parameters

view

View name or view index.


IConverter::Width

Converter::Width

Property Let Width As Long

Set width of output image file.


IConverter::ZoomType

Converter::ZoomType

Property Let ZoomType As Integer

Set Zoom Type

1-- Zoom All
2-- Zoom Extend


IConverter::Units

property Units

Property Get Units As String

No parameters