Hi!
I just used GetSectionBox() but the Min and Max parameters are not the same as in 3d. What could be the problem? It used to work fine before.
I used this in my script:
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
viewA = doc.ActiveView
sBoxXYZ = viewA.GetSectionBox()
TransactionManager.Instance.EnsureInTransaction(doc)
i = sBoxXYZ.Max.Z
minZ = sBoxXYZ.Min.Z
while (i >= minZ):
box = app.Create.NewBoundingBoxXYZ()
box.Min = sBoxXYZ.Min
box.Max = XYZ(sBoxXYZ.Max.X,sBoxXYZ.Max.Y,i)
options = ImageExportOptions()
options.ExportRange = ExportRange.CurrentView
options.FitDirection = FitDirectionType.Vertical
options.PixelSize = 600
options.ViewName = str(i)
result = doc.SaveToProjectAsImage(options)
View3D.SetSectionBox(viewA,box)
doc.Regenerate();
i -= 1
TransactionManager.Instance.TransactionTaskDone()
OUT = [sBoxXYZ.Max.Z,sBoxXYZ.Min.Z,i]
It changes the Max.Z coordinate until it reaches Min.Z and creates images at each step. But it seems GetSectionBox accepts a sectionbox with different coordinates. As a result, the boundaries of the 3D view appear in a different place. It is not clear why this is happening. It all worked before.