revitpythonshell: revit crashes from REPL but not from

Dear @daren-thomas ,

the following script - to export a sheet set as dwfs - runs fine when defined as external script but crashes every time when executed from RPS-REPL. (on RVT Arch2015 and 2016) Any idea why? I usually prototype in the (awesome) REPL and would hope to get the same effects as when code was run from button/journal.

Best, Frederic

import os
from datetime import datetime
from Autodesk.Revit.DB import FilteredElementCollector as Fec
from Autodesk.Revit.DB import DWFExportOptions, ViewSheetSet, ViewSet
from rpw.transaction import Transaction as rpw_Transaction
from rpw import doc

export_path = "N:\\pr_dir\\pr_sub_dir\\auto_print_dwf\\"
fileType = "_DWF\\"
today = datetime.now().strftime("%y%m%d")
path_today = export_path + today + fileType

if not os.path.exists(path_today):
    os.makedirs(path_today)

view_sheet_sets = Fec(doc).OfClass(ViewSheetSet)

with rpw_Transaction("export_dwfs"):
    for view_sheet_set in view_sheet_sets:
            if view_sheet_set.Name == "Auto_PDF_DWF":
                view_set = ViewSet()
                for view in view_sheet_set.Views:
                    view_set.Insert(view)
                dwf_opt = DWFExportOptions()
                dwf_opt.ExportingAreas = True
                doc.Export(path_today, view.Name, view_set, dwf_opt)

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Comments: 17 (7 by maintainers)

Most upvoted comments

side note: @hdm-dt-fb happy to see I am the only person in the world using rpw! 😄