importDWG Namespace Reference

DWG file importer & exporter. More...

Functions

def convertToDwg (dxffilename, dwgfilename)
 
def convertToDxf (dwgfilename)
 
def export (objectslist, filename)
 
def getTeighaConverter ()
 
def insert (filename, docname)
 
def open (filename)
 
def translate (context, txt)
 

Variables

 pythonopen = open
 

Detailed Description

DWG file importer & exporter.

Function Documentation

◆ convertToDwg()

def importDWG.convertToDwg (   dxffilename,
  dwgfilename 
)
Convert a DXF file to a DWG file.

If the converter is found it is used, otherwise the conversion fails.

Parameters
----------
dxffilename : str
    The input DXF file
dwgfilename : str
    The output DWG file

Returns
-------
str
    The same `dwgfilename` file path.

References getTeighaConverter().

Referenced by export().

◆ convertToDxf()

def importDWG.convertToDxf (   dwgfilename)
Convert a DWG file to a DXF file.

If the converter is found it is used, otherwise the conversion fails.

Parameters
----------
dwgfilename : str
    The input filename.

Returns
-------
str
    The new file produced.

References getTeighaConverter().

Referenced by insert(), and open().

◆ export()

def importDWG.export (   objectslist,
  filename 
)
Export the DWG file with a given list of objects.

The objects are exported with importDXF.export().
Then the result is converted to DWG.

Parameters
----------
exportList : list
    List of document objects to export.
filename : str
    Path to the new file.

Returns
-------
str
    The same `filename` input.

References convertToDwg(), and importDXF.export().

◆ getTeighaConverter()

def importDWG.getTeighaConverter ( )
Find the ODA (formerly Teigha) executable.

It searches the FreeCAD parameters database, then searches for common
paths in Linux and Windows systems.

Parameters
----------
None

Returns
-------
str
    The full path of the converter executable
    '/usr/bin/ODAFileConverter'

Referenced by convertToDwg(), and convertToDxf().

◆ insert()

def importDWG.insert (   filename,
  docname 
)
Imports a file using importDXF.insert().

If no document exist, it is created.

Parameters
----------
filename : str
    The path to the filename to be opened.
docname : str
    The name of the active App::Document if one exists, or
    of the new one created.

Returns
-------
App::Document
    The active FreeCAD document, or the document created if none exists,
    with the parsed information.

References convertToDxf(), and importDXF.insert().

◆ open()

def importDWG.open (   filename)
Open filename and parse using importDXF.open().

Parameters
----------
filename : str
    The path to the filename to be opened.

Returns
-------
App::Document
    The new FreeCAD document object created, with the parsed information.

References convertToDxf(), and importDXF.open().

◆ translate()

def importDWG.translate (   context,
  txt 
)

Variable Documentation

◆ pythonopen

importDWG.pythonopen = open