The script I created in an older version of Dynamo works well, but when I use the new version of Dynamo in Revit 2024, the script do not work as before.
Dose anyone know how to fix this problem?
The orange preview in Revit indicate the location of the Section Box, but as you can see in the image above, the Section Box is positioned elsewhere.
You probably have different coordinates setup in this model. You’ll have to find the translation of the coordinate system to determine the “offset” needed to correct the placement.
1 Like
Hi @A.C ,
try to set a new Revit BoundingBox
using MinPoint
and MaxPoint
(converted coordinates
import clr
import sys
import System
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
uidoc = uiapp.ActiveUIDocument
def create_3dSection(bbox, _3dView):
TransactionManager.Instance.ForceCloseTransaction()
# uidoc.RequestViewChange(_3dView)
TransactionManager.Instance.EnsureInTransaction(doc)
_3dView.SetSectionBox(bbox)
TransactionManager.Instance.TransactionTaskDone()
ds_bbx = IN[0]
current_view = doc.ActiveView
rvt_box = BoundingBoxXYZ()
rvt_box.Min = ds_bbx.MinPoint.ToXyz()
rvt_box.Max = ds_bbx.MaxPoint.ToXyz()
create_3dSection(rvt_box, current_view)
1 Like
I attempted to create a new project without any settings, but it just have an offset, I don’t know why.
I have already installed it, but it still doesn’t work.
It works,thank you.