Set Section Box of 3D View


#1

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.


Section Box in 3D view to match Levels
#2

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


#3

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


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

#5

@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


#6

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?


#7
#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

#8

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 .


#9

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


#10

Thanks a lot its working very well now