<pre style=“color: #000000;”>#Copyright© 2014, Konrad Sobon
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 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
#The inputs to this node will be stored as a list in the IN variable.
dataEnteringNode = IN
linkElements = []
for i in IN[0]:
linkElements.append(UnwrapElement(i))
rvtLink = UnwrapElement(IN[1])
transform = rvtLink.GetTotalTransform()
elements = []
for i in IN[2]:
elements.append(UnwrapElement(i))
viewName = IN[3]
#get ViewFamilyType for a 3D View
collector = FilteredElementCollector(doc)
viewTypeColl = collector.OfClass(ViewFamilyType)
for i in viewTypeColl:
if i.ViewFamily == ViewFamily.ThreeDimensional:
viewType = i
else:
continue
“Start” the transaction
TransactionManager.Instance.EnsureInTransaction(doc)
#define bounding box enclosing all elements
bboxMin, bboxMax = [], []
for i in linkElements:
bboxMin.append(transform.OfPoint(i.get_BoundingBox(doc.ActiveView).Min))
bboxMax.append(transform.OfPoint(i.get_BoundingBox(doc.ActiveView).Max))
for i in elements:
bboxMin.append(i.get_BoundingBox(doc.ActiveView).Min)
bboxMax.append(i.get_BoundingBox(doc.ActiveView).Max)
minX, minY, minZ, maxX, maxY, maxZ = [], [], [], [], [], []
for i, j in zip(bboxMin, bboxMax):
minX.append(i.X)
minY.append(i.Y)
minZ.append(i.Z)
maxX.append(j.X)
maxY.append(j.Y)
maxZ.append(j.Z)
bboxMinX = min(minX)
bboxMinY = min(minY)
bboxMinZ = min(minZ)
bboxMaxX = max(maxX)
bboxMaxY = max(maxY)
bboxMaxZ = max(maxZ)
#create a bounding box
bbox = BoundingBoxXYZ()
bbox.Min = XYZ((bboxMinX - 0.1), (bboxMinY - 0.1), (bboxMinZ - 0.1))
bbox.Max = XYZ((bboxMaxX + 0.1), (bboxMaxY + 0.1), (bboxMaxZ + 0.1))
#create 3d View
view = View3D.CreateIsometric(doc, viewType.Id)
view.Name = viewName
view.SectionBox = bbox
“End” the transaction
TransactionManager.Instance.TransactionTaskDone()
#Assign your output to the OUT variable
OUT = 0
Try this: I think inputs are the geometry. It deals with setting the crop box and it will create a new 3d view I think so you would have to add that view target etc.