3D View to DWG, Pre-Defined Export Settings


I’ve been searching through the forum but couldn’t find anything that relates to this. I want to export a 3D view with pre-defined dwg export settings so that solids export as ACIS solids rather than a Polymesh, which is the default.

Would anyone know if this is possible? I know Dynamo can get the current settings from the project but i don’t want to have to be setting up dwg options every time.


Use Genius Loci’s package / Archilab and add export as ACIS option
options.ExportOfSolids = SolidGeometry.ACIS

full code
# Copyright© 2016, Konrad K Sobon
# @arch_laboratory, http://archi-lab.net

# Import Element wrapper extension methods
import clr
import Revit

# Import DocumentManager and TransactionManager
import RevitServices
from RevitServices.Persistence import DocumentManager

# Import 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'

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)

if isinstance(IN[0], list) : inputdoc = ProcessList(Unwrap, IN[0])
else : inputdoc = [Unwrap(IN[0])]
#Inputdoc : Part of script by Andreas Dieckmann
if inputdoc[0] == None:
	doc = DocumentManager.Instance.CurrentDBDocument
elif inputdoc[0].GetType().ToString() == "Autodesk.Revit.DB.Document":
	doc = inputdoc[0]
elif inputdoc[0].GetType().ToString() == "Autodesk.Revit.DB.RevitLinkInstance":
	doc = inputdoc[0].GetLinkDocument()
else: doc = DocumentManager.Instance.CurrentDBDocument

folderPath = IN[1]

if isinstance(IN[2], list) : views = ProcessList(Unwrap, IN[2])
else : views = [Unwrap(IN[2])]

if isinstance(IN[3], list) : names = IN[3]
else : names = [IN[3]]

if isinstance(IN[4], list) : Predef = IN[4]
else : Predef = [IN[4]]

RunIt = IN[7]

def ExportDwg(name, view, folder = folderPath):
	options = DWGExportOptions()
	if Predef[0] == None:
		options = options.GetPredefinedOptions(doc, Predef[0])
	options.SharedCoords = IN[5]
	options.MergedViews = IN[6]
	options.ExportOfSolids = SolidGeometry.ACIS
	views = List[ElementId]()
	result = doc.Export(folder, name, views, options)
	return result

if RunIt:
		errorReport = None
		# run export
		ProcessParallelLists(ExportDwg, names, views)
		# if error accurs anywhere in the process catch it
		import traceback
		errorReport = traceback.format_exc()
	errorReport = "Please set the RunIt to True!"

#Assign your output to the OUT variable
if errorReport == None:
	OUT = "Success"
	OUT = errorReport

Thank you for that, would IN[6] happen to refer to this part of the export settings?

Was able to get some time for testing and answered my own question, thanks again for your help, export worked perfectly when brought into Rhino.