ar.lib.everydwg — Conversion between DWG and DXF drawings

This module allows converting between various types of DWG and DXF files.

Only the convertor class is normally imported:

from ar.lib.everydwg import Convertor
EveryDWG    = Convertor('/path/where/EveryDWG.exe/is/installed')
if EveryDWG.is_installed:
    EveryDWG.convert_file(...)
    EveryDWG.convert_dir(...)

For this module you need to download the Open DWG EveryDWG File Converter. You need to comply with its terms of use:

Open Design Alliance and its members have created the following 
free utilities, based on the Open DWG Libraries, for unrestricted, 
non-commercial use. Please note that inclusion of any utility 
in a commercial product does require commercial licensing, unless 
otherwise stated in the product description. ODA members are 
encouraged to create and share their own utilities with the 
CAD community.

In case you don’t agree with these terms, you are not allowed to use this module.

Warning

This module needs wine on non Windows platforms.

class ar.lib.everydwg.Convertor(dir)
convert_dir(dir_in, dir_out, version='ACAD2004', ext='DWG', audit=False, recursive=False)

Convert one drawing in another version and/or type.

Parameters:
  • dir_in (string) – the source directory
  • dir_out (string) – the target directory
  • version (string) – version of the drawing
  • ext (string) – the extension type of the drawing (DWG or DXF)
  • audit (boolean) – audit the file
  • recursive (boolean) – recurse directory
Returns:

the base names of the target files

Return type:

list of strings

convert_file(file_in, file_out, version='ACAD2004', ext='DWG', audit=False, clean_in=True, clean_out=True)

Convert one drawing in another version and/or type.

Parameters:
  • file_in (string) – the filename of the source file
  • file_out (string) – the filename of the target file
  • version (string) – version of the drawing
  • ext (string) – the extension type of the drawing (DWG or DXF)
  • audit (boolean) – audit the file
  • clean_in (boolean) – clean the temporary input folder
  • clean_out (boolean) – clean the temporary output folder
Returns:

the target filename if succesful, None otherwise

Return type:

string or None

mkdtemp(subdir)

Make a clean subdir in the system temporary directory. Delete it first if it exists already.

Parameters:
  • subdir (string) – name of the subfolder
Returns:

the absolute path of the new temporary folder

Return type:

string

mkstemp(base, subdir=None, ext=None)

Make a new temporary file.

Parameters:
  • base (string) – the full path of the base file
  • subdir (string or None) – name of a fixed subdir in the system temporary path
  • ext (string or None) – the extension of the temporary file, which will replace the original extension

This Page

Quick search