Exporting 3D Geometry

Can PyRevit be used to export 3D geometry?? :crossed_fingers:

The question should read:
Can Revit export to some kind of 3D formats?

Short answer: Yes

Longer answer: to IFC, SAT, FBX, … yes

a commented example from Data-shapes github repo to export to FBX, it is from a dynamo custom node in python https://github.com/MostafaElAyoubi/Data-shapes/blob/master/Nodes/Export%20to%20FBX.dyf

#Data-Shapes www.data-shapes.net`

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import*
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

t = Transaction(doc,'export')
t.Start() # could be handled differently with pyrevit module with Transaction('do something')

def tolist(input):
	if isinstance(input,list):
		return input
	else:
		return [input]

folder = IN[0] # to be change to grad the destination folder
prefix = IN[1] # no use in the code
views = tolist(IN[2]) # to be change to grad the list of views to export
result = []
vset = ViewSet()


for v in views: # meant to iterate on a list of views to be exported

    vset.Insert(UnwrapElement(v))
    result.append(doc.Export(folder,UnwrapElement(v).Name,vset,FBXExportOptions()))

t.Commit()
OUT = 'Success' # no use in pure python

or in C# from the building coder samples
pretty much the same structure