How to save view as image in a project?

Hi, help create a node with function SaveToProjectAsImage command, for saving selected view.
http://www.revitapidocs.com/2018/0bc4b117-ffd3-616f-d378-bfcbb1fdae2f.htm
Thank you.

Try something with the View.ExportAsImage node in the Revit dropdown. That should get you where you want to go.

Thank you, I tried. But it did not help me (

Can you post an image of your script?

I would do something like this:

image

# Copyright(c) 2018, Konrad K Sobon
# @arch_laboratory, http://archi-lab.net

import clr
clr.AddReference("RevitNodes")
import Revit

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *

import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)

try:
    errorReport = None
    
    TransactionManager.Instance.EnsureInTransaction(doc)
    options = ImageExportOptions()
    options.ExportRange = ExportRange.CurrentView
    options.ViewName = "Image_" + doc.ActiveView.Name
    result = doc.SaveToProjectAsImage(options)
    TransactionManager.Instance.TransactionTaskDone()
except:
    # if error occurs anywhere in the process catch it
    import traceback

    errorReport = traceback.format_exc()

# Assign your output to the OUT variable
if None == errorReport:
    OUT = result
else:
    OUT = errorReport

So the ImageExportOptions is where you can control image size and resolution. You can find all possibilities here: http://www.revitapidocs.com/2018/0f83e370-338f-b3a0-d5e5-b126bb31b49e.htm

1 Like

Thank you very much!