Crop box

i try to create a crop box for an axonometric view.

right now i am failing to create the correct bounding box!

what i did so far:

i created a solid from panels

for the solid i created a axonometric view eyepoint targetpoint. where targetpoint is the locationpoint of the panel.

with that i went into python.

i imported the bounding box of the panel

and the panel.

from the panel i extracted the location point (mid)

from the bounding box i took height and width.

then i assigned the (in my opinion) correct values to the cropbox.

but nope, sometimes the cropbox fits, most times not!

any clue?

pics are: what i expect, what i get, the python


right wrongpython

<pre style=“color: #000000;”>#Copyright© 2014, Konrad Sobon


import clr
from Autodesk.DesignScript.Geometry import *

Import ToDSType(bool) extension method

import Revit

Import DocumentManager and TransactionManager

import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

from System.Collections.Generic import *

Import 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]:

rvtLink = UnwrapElement(IN[1])
transform = rvtLink.GetTotalTransform()

elements = []
for i in IN[2]:

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

“Start” the transaction


#define bounding box enclosing all elements
bboxMin, bboxMax = [], []
for i in linkElements:
for i in elements:
minX, minY, minZ, maxX, maxY, maxZ = [], [], [], [], [], []
for i, j in zip(bboxMin, bboxMax):
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


#Assign your output to the OUT variable
OUT = 0
Try this: I think inputs are the geometry. :slight_smile: 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.

Hi guys,

Just to add to the discussion, there are a few default nodes for axonometric view creation - “AxonometricView.ByEyePointTargetAndElement” and “AxonometricView.ByEyePointTargetAndBoundingBox”.

I did a quick test on how they perform and it seems that the one taking an element input functions well but unfortunately has no options for controlling the crop box size.

The second one that takes a bounding box adjusts the crop box( wrongly) and fails to apply the crop to the view or isolate the elements.


view by element:


view by BBox:


This is on R15, Dynamo 0.8 stable. I’m not sure if the two problems are connected.

Just a small addition to this discussion:

A while back I needed to make slight adjustments to a large number of view cropboxes for a fabrication workflow. The node (View.ResizeCropbox) is available in package Clockwork.

just to contribute too.

my solution went like: create an axonometric view.

revit will automatically create a copbox sized 100x100x100 (in metric units)

the cropbox will be centered to the elements in the view

create a viewfilter.

after that create a bounding box for the active elements in the view.

resize the crop box to width and height from the boundingbox.

after that you can export to img and get perfect results

@dimitar: i guess that the ootb cropbox has an error in unit conversions???

same problem persists for the creation of sections. there the cropbox is misplaced too.


I don’t think its unit conversions because I always do mine manually and I would still have problems with this workflow. I think its because Dynamo defines origin differently than Revit. Just a wild guess, but I was testing reporting coordinates relative to Project Origin and/or Survey Point and none of them aligns with what is being shown in Dynamo. :frowning: I am a little bummed out. Maybe I should stop converting my units because now, Dynamo is unitless, but I just don’t know how that works. :frowning:

konrad, the unitless dznamo 8 is failing too.

my first approaches in changing cropboxes whre in 0x7xxx

when i tried 0x8xxx i got other but wrong results.

i think there is a conversion bug in one of the dynamo functions pertaining views in general.