Hi,
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.
Thanks
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
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
# 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)
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:
pass
else:
options = options.GetPredefinedOptions(doc, Predef[0])
options.SharedCoords = IN[5]
options.MergedViews = IN[6]
options.ExportOfSolids = SolidGeometry.ACIS
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 = "Success"
else:
OUT = errorReport
1 Like
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.
@myrwen.junterealSJC7
Would you be able to explain how to incorporate the “full code”? I am trying to export as acis solid and having no luck finding the node to set it as a solid geometry.
Thanks is advance!
@joeydoherty The code is placed inside of a Python Script node, mine looks something like this. Keep in mind i have renamed the python node to be “Export DWG” and i am using Data Shapes to pass through the input data.