Hi I am trying to export a family of revit to dwg like singular object files, I have like 30 variance and I need everyone of this in a singular DWG file.
In another forum they helped me to create some nodes but I need that the objects stay on the origin and without this green lines. someone can help me?
familyDWGexport.dyn (36.9 KB)
Hi Leonardo, welcome ![]()
To change how the elements are exported can be controlled by visibility, so once you have created the views for export, change their settings.
So we can place all the elements at the origin, hide all others in each view. I’m assuming the green lines are the section box - so hide that category as well.
Python example code
import clr
from System.Collections.Generic import List
clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import BuiltInCategory, ElementId
elements = UnwrapElement(IN[0])
views = UnwrapElement(IN[1])
doc = DocumentManager.Instance.CurrentDBDocument
OUT = []
element_ids = [e.Id for e in elements]
sec_box_id = ElementId(BuiltInCategory.OST_SectionBox)
TransactionManager.Instance.EnsureInTransaction(doc)
for i, view in enumerate(views):
ids = element_ids.copy()
ids.pop(i)
view.HideElements(List[ElementId](ids))
view.SetCategoryHidden(sec_box_id, True)
OUT.append(view)
TransactionManager.Instance.TransactionTaskDone()
If you click on the plus sign, IN[1] will show up.
Thanks, it was easier than I thought.
I have another problem with the visualization. I don’t want the layers of the project to be seen but when I set on the project the visibility and then I export with dynamo the views created have a different visibility type.
Is there a way to set on dynamo the view setting to disable the annotation? or do you have some other suggestion?
To turn off all annotations in the view change the following line
view.SetCategoryHidden(sec_box_id, True)
to
view.AreAnnotationCategoriesHidden = True
amazing, thank you.
Last thing I promise: is there a way to set on code the color of exportation of the dwg model? now when I export the lines are red
Add a DWGExportOptions to the export node via the ExportSettings port.
You can change it with layers or linestyles
If you have a DWG export setting saved you could use something like this:
Please note I am not at my workstation so I haven’t tested the code and there is probably already package nodes available
The IN[0] is the name of your settings as a string and join the output to the ExportSettings
import clr
clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *
doc = DocumentManager.Instance.CurrentDBDocument
# Edited
options = ExportDWGSettings.FindByName(doc, IN[0])
# ignore: options.GetPredefinedOptions(doc, IN[0])
OUT = options
Review this section of the Revit support site on export setups - create the export settings that you want and load them in. Genius Loci have a Create DWG Export Setup node
Ok, lets run through this
I am using a Furniture family and ISO standard layers - Layer colour is 30
Our export shows up in the DWG like this
Change the colour

Aaaand the Genius Loci Nodes do not work…
OK back to the drawing board
Swap to Crumple nodes Revit.ExportToDwg and Revit.ExportOptionsDwg. Use the settings name and…
It works!
I have also added the option to delete the families and views so you can do this in place. Dyn file and code below
from itertools import chain
from System.Collections.Generic import List
import clr
clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *
def id(element):
return element.Id
families = map(id, UnwrapElement(IN[1]))
views = map(id, UnwrapElement(IN[2]))
doc = DocumentManager.Instance.CurrentDBDocument
TransactionManager.Instance.EnsureInTransaction(doc)
if IN[0]:
deleted_ids = doc.Delete(List[ElementId](chain(families, views)))
TransactionManager.Instance.TransactionTaskDone()
OUT = deleted_ids
familyDWGexport.dyn (39.8 KB)
It’s hard to tell without knowing your inputs, can you pin the results of the nodes before the errors and export the full graph.
I would also start with a empty project file and only add the family you want to export, set up your preferred export settings and then run the script.
The first node expects the family instances of each type and its associated view - so I don’t know how it is getting a text value unless I see the nodes before. Does your family only have one type? The python nodes are coded to operate on lists
ok, for some reason everything works perfectly now, thank you very much for the great help you gave me, you were really kind, thanks again ![]()












