Problem Setting Crop boxes and Section Boxes in Revit 2022

Thank you for sharing this script.
So it’s not just me.

Right now I use the node from GeniusLoci node.
After that I set the Type to the one I want and set the viewtemplate.

1 Like

@jw.vanasselt please send me a sample file that reproduces this issue so I can debug. Screenshots unfortunately are not getting us anywhere with this issue. :disappointed:

If I can’t get it worked out, the node will be removed from Rhythm.

1 Like

I have send you a DM :slight_smile: hope this will help.

1 Like

Thanks for the sample files @jw.vanasselt .

Turns out there is some weird error in Dynamo where BoundingBoxes aren’t fully “there” at certain points within a graph and they report as null. This is causing the Rhythm node to trigger with a null value causing errors. I am making an update now that should help.

Please download this release and test it out, it seemed to work on the sample files you sent @jw.vanasselt
image

The code is here for reference:

Thank you for the quick update. I am still getting failure in r2022 when r2018 worked.


DYN showing the issue. Thank you for checking.
view set section box test - truevis - revit 2022.dyn (32.5 KB)

.dyn only doesn’t help. This node will be removed from rhythm.

sorry about that.

The summary is, there is some weird bug with the ByCorners node in Dynamo (in newer versions it seems) and I cannot fix it.

Do you think something changed in the 2022 API?

I modified my answer above to help. But in Revit, no, nothing changed regarding setting 3d view crop boxes.

BoundingBox.ByCornerPoints is a node in the Dynamo libraries. Something happened there with the geometry or with the ToRevitType converters here.

At this point the node will be removed from Rhythm and that is all the remaining comments I have at this time.

I am revising the title of this thread to better represent the future goal. Also, please feel free to start a new thread if that works better for you.

I wish you all the best of luck in making this work with other packages/nodes.

1 Like

Here is a workaround for making a View with a specific orientation and SectionBox in Revit 2022:


Result:

The Python from 3DView Set Orientation or 3DView by BoundingBox could be changed to not need the “Control View” and just make an orientation to make it slicker. Thanks to @jw.vanasselt for the GeniusLoci clue, and all y’all for looking at this issue.
view set section box workaround - truevis - revit 2022.dyn (41.7 KB)

2 Likes

Thank you for you’re support John.
Pity that this node will be removed but unfortunately it is no different.

@truevis thanks to you too :slight_smile:

I hope someone clever with Python can combine 3DView Set Orientation or 3DView by BoundingBox and make it work without having to make a View just to set the orientation.

2 Likes

AxonometricView.ByEyePointTargetAndboundingbox is also broken with what looks like the same error as the Rhythm node.

That’s weird, do you think this is a dynamo 2.12 problem?

I found a node/python that works! The code came from package Zhukoven.com node BoundingBox.ToSectionBox. I just changed its output a little.
view create set section box w orientation alternative solution - truevis - revit 2022.dyn (24.7 KB)

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

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
bbox = IN[0]
view = UnwrapElement(IN[1])
try:
    TransactionManager.Instance.EnsureInTransaction(doc)
    newmax = UnwrapElement(bbox.MaxPoint).ToRevitType()
    newmin = UnwrapElement(bbox.MinPoint).ToRevitType()
    newbox = BoundingBoxXYZ()
    newbox.Max = newmax
    newbox.Min = newmin

    z = view.SetSectionBox(newbox)

    OUT = view
except:
    OUT = "Error"
1 Like

That’s nice, does it work for all revit versions?

One would have to test it.

It works in R20 and higher :slight_smile: You need to make a custom node with lacing to longest.

Thanks for sharing!

1 Like

See ViewSectionBoxFromBoundingBox from truevis for new node.
image

2 Likes

I had the same problem, didn’t get it to work with the truevis node either - what worked, was creating a cuboid out of the section box and then converting back to a section box again. Might be worth a shot for someone, even if it’s a dumb solution.

3 Likes