revitron.export

The export submodule hosts all classes related to sheet export such as DWG and PDF. For example sending the currently active sheet to a PDF printer in the network works as follows:

exporter = revitron.PDFExporter(printerAddress, printerPath)
exporter.printSheet(revitron.ACTIVE_VIEW,
                                   'A0',
                                   'Landscape',
                                   'C:/pdf',
                                   '{Sheet Number}-{Sheet Title}')

Please check out the export tool of the Revitron UI extension to learn how to export a selection of sheets with a felxible configuration stored in a document.

Classes:

CSVExporter()

Export a schedule as CSV named by a file naming template.

DWGExporter(setupName)

Export sheets as DWG named by a file naming template.

PDFExporter(printer, output)

Export sheets as PDF named by a file naming template.

class CSVExporter[source]

Bases: object

Export a schedule as CSV named by a file naming template.

Methods:

__init__()

Inits a new CSVExporter instance.

exportSchedule(schedule, directory[, ...])

Exports a schedule.

__init__()[source]

Inits a new CSVExporter instance.

exportSchedule(schedule, directory, template=False, delimiter=';', hasTitle=False)[source]

Exports a schedule.

Parameters
  • schedule (object) – A Revit schedule

  • directory (string) – A custom output directory. Defaults to False.

  • template (string, optional) – A name template. Defaults to ‘{View Name}’.

  • delimiter (string, optional) – A csv delimiter. Defaults to ‘;’.

  • hasTitle (bool, optional) – Set True to export schedule title. Defaults to False.

Returns

The path of the exported CSV. False on error.

Return type

string

class DWGExporter(setupName)[source]

Bases: object

Export sheets as DWG named by a file naming template.

Methods:

__init__(setupName)

Inits a new DWGExporter instance.

exportSheet(sheet, directory, unit[, template])

Exports a sheet.

__init__(setupName)[source]

Inits a new DWGExporter instance.

Parameters

setupName (string) – The name of a stored export setup

exportSheet(sheet, directory, unit, template=False)[source]

Exports a sheet.

Parameters
  • sheet (object) – A Revit sheet

  • directory (string) – The export directory

  • unit (object) – The export unit

  • template (string, optional) – A name template. Defaults to ‘{Sheet Number}-{Sheet Name}’.

Returns

The path of the exported PDF. False on error.

Return type

string

class PDFExporter(printer, output)[source]

Bases: object

Export sheets as PDF named by a file naming template.

Methods:

__init__(printer, output)

Inits a new PDFExporter instance.

printSheet(sheet, size[, orientation, ...])

Prints a sheet.

tempOutputPattern(sheet)

Create a glob pattern to identify a printed PDF in the system output directory to be able to move it to its correct location and rename it according to the given template.

__init__(printer, output)[source]

Inits a new PDFExporter instance.

Parameters
  • printer (string) – The printer network adress

  • output (string) – The printer output directory

printSheet(sheet, size, orientation='Landscape', colorMode='Color', directory=False, template=False)[source]

Prints a sheet.

Parameters
  • sheet (object) – A Revit sheet

  • size (string) – A size name like A0 or A4

  • orientation (string, optional) – The orientation, ‘Landscape’ or ‘Portrait’. Defaults to ‘Landscape’.

  • colorMode (string, optional) – The color setting for the printed sheets. Defaults to ‘Color’.

  • directory (string, optional) – A custom output directory. Defaults to False.

  • template (string, optional) – A name template. Defaults to ‘{Sheet Number}-{Sheet Name}’.

Returns

The path of the exported PDF. False on error.

Return type

string

tempOutputPattern(sheet)[source]

Create a glob pattern to identify a printed PDF in the system output directory to be able to move it to its correct location and rename it according to the given template.

Please note that the PDF network printer has to be configured to save PDFs following the below naming scheme:

[Revit File] - Sheet - [Sheet Number] - [Sheet Name].pdf

For example:

Project1 - Sheet - A101 - Unnamed.pdf
Parameters

sheet (object) – A Revit sheet objetc

Returns

The generated glob pattern

Return type

string