I’m trying to create images of family types placed in the project. When I run this the images show up blank. I’ve placed some detail lines to make sure I’m capturing the correct area. I also commented out the delete method and they still do not print despite being able to see them in the image area after the script runs.
t.Start()
# desktopPath = os.path.join(os.path.join(os.environ['USERPROFILE']), 'Desktop')
testPath = "L:/Revit/Development/Issues/3 - Examples/2024-11-06 - Elec - Electrical Legend Tests/Family Images"
imgOption = ImageExportOptions()
imgOption.ZoomType = ZoomFitType.Zoom
imgOption.Zoom = 100
imgOption.PixelSize = 300
imgOption.SetViewsAndSheets([views[0].Id])
imgOption.ExportRange = ExportRange.SetOfViews
imgOption.HLRandWFViewsFileType = ImageFileType.JPEGMedium
types = []
for eT in eTypes:
types.append(family.Document.GetElement(eT))
for eT in types:
typeName = DB.Element.Name.__get__(eT)
filePath = testPath + "/" + typeName
imgOption.FilePath = filePath
eT.Activate()
y = 0
z = 0
x = 0
coor = XYZ(x, y, z)
l = doc.Create.NewFamilyInstance(coor, eT, level[0], StructuralType.NonStructural)
doc.ExportImage(imgOption)
doc.Delete(l.Id)
dprint("Script Complete")
t.Commit()
I’m wondering if I need to do the export after the transaction or as a separate transaction.