Set Section Box of 3D View

I’ve tried View3D.SetSectionBox and it doesn’t work.
My approach is to use a Scope box for overall boundingbox corners.

Result:

Testing with boundingbox of an element doesn’t work either:

Nor does built-in node AxonometricView.ByEyePointTargetAndBoundingBox:

I’m using Revit 2017.2 and Dynamo 1.2.1.3083.

It seems something deep has changed. Maybe the Revit API?
I’ve posted an issue on dynamo github site no response yet.

@Antony_Mcphee you need to feed the node, “View3D.SetSectionBox” an actual view. Currently, you are feeding it a string.

1 Like

Thanks - got it working.
Although what I am really after is a node that creates a 3D view from a bounding box.

  1. Duplicate default 3D View = number of binding boxes
  2. Set section box of new views.

@Antony_Mcphee

Not a Dynamo solution- but I use the the Coins Section Box addin (free on the app store)
You can use scope box or element geometry as the bounding.

Somewhere on my very long list of “things in Revit that don’t make any sense” is that you can’t apply a scope box to a 3D view.

Andrew

I’ve had a bit of success. I’ve edited steamnodes Element.Create 3D Cropped view.dyf so that it takes a bounding box instead of an element.

steamnodes Element.Create 3D Cropped view.dyf doesn’t give you the option to name the 3D views it creates (it names them 3D View 1, 3D View 2…). I tried tweaking the python code but just couldn’t get it to work. So I added nodes to rename the created views instead.

What is weird is it can only be run once. Try running it again - even after deleting all views it created - and it either just doesn’t work (null comes out of python code) or it comes up with an error saying views already exist. You have to exit Dynamo, exit Revit and start over. Makes debugging a nightmare.

Does anyone know why python would do this?

#python nodes in dynamo 1.0
#proposed by Julien Benoit @jbenoit44 
#http://aecuandme.wordpress.com/
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Import ToDSType(bool) extension method
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
# Import geometry conversion extension methods
clr.ImportExtensions(Revit.GeometryConversion)
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

Min=[]
Max=[]
viewlist=[]
bbox=[]
for i in IN[0]:
	Min.append(UnwrapElement(i.ToXyz(True)))
for i in IN[1]:
	Max.append(UnwrapElement(i.ToXyz(True)))



# Start Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
activeview=doc.ActiveView
typeid=View.GetTypeId(activeview)

count = 0
while (count < len(Min)):
	b=View3D.CreateIsometric(doc, typeid)
	viewlist.append(b)
	box = app.Create.NewBoundingBoxXYZ()
	box.Min = Min[count]
	box.Max = Max[count]
	bbox.append(box)
	a=View3D.SetSectionBox(b,box)
	count = count + 1
	

# End Transaction
TransactionManager.Instance.TransactionTaskDone()
OUT=bbox,viewlist

HI all ; Im trying to use the View3D.setSectionBox at a multiple elements and views in the same time .
as shown in the attachment .
i did it for two elements by adding two nodes but i want it connected by the number of elements are exist in the model or view .
How to edit the python script inside it to work without using the Get item at index .

The new version should support this. Update your Rhythm to a version later than 2017.11.6

4 Likes

Thanks a lot its working very well now

1 Like

Does these nodes still exist I need this process ???

yes. it is in Rhythm :grin:

hey John still cant find it even with the package am I doing something wrong /?

It’s the second one in your search on the screenshot. :grin: The name is truncated in the search window so it isn’t easy to catch

I have also tried to create a list join all my bounding box’s and see if it would crop around my 4 pillars but its only allowing me to do one at a time … is there any recommendation you can helps me with please

Of course! You would have to construct your own Bounding Box given your element’s current Bounding Boxes.

2 Likes

Thank you so much am so happy you could help me achieve this

1 Like

On more thing are they section boxes or scope boxes ???

In a 3d view, it is referred to as a section box, which is a property of View3D in the Revit API :slight_smile:

https://apidocs.co/apps/revit/2020/e21471cd-63a4-c452-8c29-fad41362a59b.htm

1 Like

Thank you john one last thing can you assign a level to them so one is at GF to FF other is at GF to Third floor etc ? Thank you so much