-
Notifications
You must be signed in to change notification settings - Fork 12
/
exportImage.py
34 lines (27 loc) · 971 Bytes
/
exportImage.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
'''
exportImage.py
Export the currently visible view as a PNG image to a location specified by the
user.
'''
import clr
clr.AddReference('RevitAPI')
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.DB import *
doc = __revit__.ActiveUIDocument.Document
# collect file location from user
clr.AddReference('System.Windows.Forms')
from System.Windows.Forms import DialogResult, SaveFileDialog
dialog = SaveFileDialog()
dialog.Title = 'Export current view as PNG'
dialog.Filter = 'PNG files (*.PNG)|*.PNG'
if dialog.ShowDialog() == DialogResult.OK:
# set up the export options
options = ImageExportOptions()
options.ExportRange = ExportRange.VisibleRegionOfCurrentView
options.FilePath = dialog.FileName
options.HLRandWFViewsFileType = ImageFileType.PNG
options.ImageResolution = ImageResolution.DPI_72
options.ZoomType = ZoomFitType.Zoom
options.ShadowViewsFileType = ImageFileType.PNG
doc.ExportImage(options)
__window__.Close()