For a while now the COINS Auto-section Box app has been one of the most downloaded apps on Autodesk Exchange. It's a app for aligning a section box with selected elements in a 3d-view with or without an offset and I know many people think it's awesome. As do I.
Look it up here: Autodesk Exchange - COINS auto-section box
If you however, like me, would be interested in a less user friendly version in dynamo, read on..
The only real reason for doing this in dynamo is that: you can!
And I'm not going to bother you for too long before showing you the goodies, but I would just like to point out one thing:
I'm not a programmer!
And I think therein is the deepest beauty of Dynamo!
The people actually designing stuff, the engineers, architects etc. can get an idea for some sort of tool or automated task, and then be able to create their own tools for obtaining that. How liberating isn't that for the industry? And it's free too!
However, for the following example it's not an original idea, nor is it doable without programming. But the people on the dynamo forum is really helpful. And many times one can copy things directly from examples etc. Do it a couple of times and you get the idea!
That said I would like to especially thank Dimitar Venkov for helping me out with the Python side of this definition.
Here is the .dyf file with the python script:
The basic workflow ,before the Python script, is that dynamo obtains the bounding boxes from the elements we've selected and we sort out the min/max values to get the cornerpoints. In addition I've included a offset input.
(The nodes Cuboid.ByCorners and BoundingBox.Bygeometry can be replaced in the 0.7.3 version with the node BoundingBox.ByCorners, but I had to roll back my version to 0.7.2 due to some issues with 0.7.3.)
I'm not sure I can fully explain the python script and I would probably be bullied by the real programmers. But the basics are that everything above the middle is required to use the Revit API, and the actual code is setting a bounding box by the cornerpoints of the dynamo bounding box and setting the view spesific sectionbox equal to this bounding box. That was a lot of bounding box...
In revit before and during selection:
The -dyf file is already released in the package manager, be sure to take a look. And if anyone of you reading this is a programmer, be sure to let me know if this can be done easier! :)