@Konrad_K_Sobon Can you please let us know what could be the reason? Thanks!
Code that I posted above uses a new DwgExportOptions()
for every export. If you want to use the saved export options from your model you need to select them and use that in the definition.
@Konrad_K_Sobon Thanks for that. I am still having same issue
import clr
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
import System
from System.Collections.Generic import *
import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)
#The inputs to this node will be stored as a list in the IN variable.
dataEnteringNode = IN
def ProcessList(_func, _list):
return map( lambda x: ProcessList(_func, x) if type(x)==list else _func(x), _list )
def ProcessParallelLists(_func, *lists):
return map( lambda *xs: ProcessParallelLists(_func, *xs) if all(type(x) is list for x in xs) else _func(*xs), *lists )
def Unwrap(item):
return UnwrapElement(item)
folderPath = IN[0]
if isinstance(IN[1], list):
views = ProcessList(Unwrap, IN[1])
else:
views = list(Unwrap(IN[1]))
if isinstance(IN[2], list):
names = IN[2]
else:
names = list(IN[2])
RunIt = IN[3]
options = None
settings = FilteredElementCollector(doc).WherePasses(ElementClassFilter(ExportDWGSettings))
for element in settings:
if element.Name == dwg_opt:
options = element.GetDWGExportOptions()
break
if options is None:
options = DWGExportOptions()
def ExportDwg(name, view, folder = folderPath):
options = DWGExportOptions()
views = List[ElementId]()
views.Add(view.Id)
result = doc.Export(folder, name, views, options)
return result
if RunIt:
try:
errorReport = None
# run export
ProcessParallelLists(ExportDwg, names, views)
except:
# if error accurs anywhere in the process catch it
import traceback
errorReport = traceback.format_exc()
else:
errorReport = "Please set the RunIt to True!"
#Assign your output to the OUT variable
if errorReport == None:
OUT = 0
else:
OUT = errorReport
1 Like
Yes, turning off the Export Views on sheets setting worked for me
Thanks @Scott_Crichton could you please share your dyn script.
Here you go. All the heavy lifting is done by Konrad’s script, I have just adjusted the nodes preceding it to get the output I am after.
Sheets to DWG.dyn (8.6 KB)
4 Likes
a bit late, but thank you for the help, removing the type was the key to success!