Getting a file size from detached revit file

Ok, if your batch processor closes the Revit file, you only need to save it in a temp folder, for example and delete it later. So here goes the saving function:

image

# Enable Python support and load DesignScript library
import clr
# Import DocumentManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager

# The inputs to this node will be stored as a list in the IN variables.
pathSave = IN[0]

# Place your code below this line
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

IsSaved = False
# Save active document
try:
	doc.SaveAs(pathSave)
	IsSaved = True
except:
	pass

# Return
OUT = IsSaved

To make sure the file is saved before attempt to get file size, use Passthrough from Clockwork and connect anything you want to perform first in passThrough:

1 Like