Export to DXF

dynamo
revit

#1

Is there a node that allows you to export a view as a dxf?


#2

I never tried it but if you speak python you could look here to write your own:
http://www.revitapidocs.com/2018.1/fd65887a-3d13-3ff1-ec95-7c0379317c85.htm
http://www.revitapidocs.com/2018.1/00783eca-208f-cc58-d56f-b47814a6957a.htm
https://msdn.microsoft.com/en-us/library/92t2ye13

Also check this post for analogy


#3

If you download the package Chynamo, there is a node View.ExportDWG with a Python script within it; that Python script could be modified easily using the second API reference @GregX provided you… looks like you would only really need to change 2 lines for it to export DXF :slight_smile:

Here is the code within that node, I still recommend downloading that package anyway (lots of useful nodes, plus you can see how the View.ExportDWG nodes inputs work):

import clr
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
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)

def _ExportDwg(xfolder, xview):
	options = DWGExportOptions()
	views = List[ElementId]()
	id=ElementId(xview.Id)
	views.Add(id)
	xname="Export-" + xview.Name + ".DWG"
	try:
		rtn = DOC.Export(xfolder, xname, views, options)
	except: 
		rtn=None
	return rtn

XFOLDER = IN[1]
XVIEW = IN[2]
DOC = DocumentManager.Instance.CurrentDBDocument
rtn = "Export DWGs failed"

if IN[0] == True:
	for abc in XVIEW:
		try:
			rtn = _ExportDwg(XFOLDER, abc)
			rtn = "Export DWGs successful"
		except:
			rtn = "Export DWGs failed"

OUT=rtn