# WARNING: Code could crash Revit session
import clr
import math
from collections import OrderedDict
from System.Collections.Generic import List
clr.AddReference('RevitAPI')
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.UI import *
app = __revit__.Application
doc = __revit__.ActiveUIDocument.Document
# path for export file
folder = doc.PathName[0:doc.PathName.rfind('\\')]+'\\'
# fetch first sheet
sheet = list(FilteredElementCollector(doc).OfClass(ViewSheet))[0]
# create collection for doc.Export command
sheetWrap = []
sheetWrap.Add(sheet.Id)
collection = List[ElementId](sheetWrap)
dwgOption = DWGExportOptions.GetPredefinedOptions(doc, BaseExportOptions.GetPredefinedSetupNames(doc)[0])
try:
doc.Export(folder, str(sheet.Name), collection, dwgOption)
except Exception as e:
print e
# BOOM
dwgOption = DWGExportOptions()
import clr
clr.AddReference('RevitAPI')
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.UI import *
app = __revit__.Application
ui = __revit__.ActiveUIDocument
doc = __revit__.ActiveUIDocument.Document
printManager = doc.PrintManager
printManager.SelectNewPrintDriver('PDFCreator')
printManager.PrintToFileName = 'C:\Addin - PDFs\Why hello there.pdf'
doc.PrintManager.CombinedFile = True
printManager.PrintRange = PrintRange.Select
viewSheetSetting = printManager.ViewSheetSetting
printManager.SubmitPrint()
--
You received this message because you are subscribed to the Google Groups "RevitPythonShell" group.
To unsubscribe from this group and stop receiving emails from it, send an email to revitpythonshe...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to revitpythonshell+unsubscribe@googlegroups.com.
def export (sender, event):
doc.Export(folder, str(sheet.Name), collection, dwgOption)
__revit__.Idling -= export
__revit__.Idling += export--
You received this message because you are subscribed to the Google Groups "RevitPythonShell" group.
To unsubscribe from this group and stop receiving emails from it, send an email to revitpythonshe...@googlegroups.com.