EDIT: I've edited this post to reflect some changes done to my original script and that units handling in Dynamo has changed (for the better.) The script is way easier now. Among other things I recommend using the topography handling provided in the spring nodes package.
Here is the light version of the script. Selecting the piles in question is a matter of choice. I went for the simplest in the example.
For quite a few years we've had an ongoing discussion (among structural engineers) about how to best get the top and bottom of openings for windows, doors etc. out on a floor plan in Revit. I think the common ground has been to just enter text, or do a workaround with a spot elevation.
This is time consuming and bound for mishaps when we coordinate a project in 3d, but produce 2d drawings for the contractor where we override the information in the 3d model with text or maybe also a misplaced spot elevation.
The following workflow probably is one of many solutions, and probably not the best either. I know that there are many ways to put a hole in a wall, each method with its own perks and flaws.
I'm going to use an "empty" window family to produce my openings, but I'm guessing the dynamo definition could be used for other openings as well.
Here is the definition:
(The GetTypeParameter.FrmFamilyInstance is a package found on the package manager and I think it's made by Peter Kompolschek.)
Before using this definition I have made two shared parameters called "Top window" and "Bottom window" which I imported into both the project parameters and the window tag.
If someone have a better idea for this, then let me know!
Here's a screencast video for the above. (and you have to excuse my overly affectionate mouse waving.. Jeezz..)
And it involves not one definition, but two!! So that's a letdown, I know.. But on the bright side I used a staggering 2 minutes with the following workflow to get all the piles in my project extended to a topo... So if you have many straight piles and want to use dynamo, read on.
It is however a kind of a workaround so I included a video in the end to show the workflow, as it is not simple as click-tada!
I must admit that my mind has pondered this problem for some time now. Not being able to solve it (effectively) by any standard means, it was one of the reasons I got interested in dynamo.
I've come to learn that a lot of people have solved this before, by using a class in the Revit API called ReferenceIntersector and it is probably still the best way to solve it. Partly because I think it would use less resources and partly because it is vector driven and therefore able to handle angeled piles with slope.
But since I'm still not a programmer I leave it up to one of you clever readers with programming experience to solve that. What I do is workarounds, and I love it when it works!
First I tried fiddling around in dynamo with the Point.Project node, but as I said in an earlier post, that fell to the ground quickly as the node couldn't read a mesh derived from a topo. (Colin McCrone said they're looking into mesh handling as we speak, though! Nice!)
Then I tried the Intersector way, but that involved heavy programming, so that fell through..
So I thought long about this and it kept getting back to the same question: How do I get the Z-value from a topo when I have the X and Y coords defined?
But then it struck me. What is the easiest way to place something on a topo??
A site component, of course!!
What if I make a small site component, place it with XY-coords and it just automatically snaps to topo? then I could just get the location of top pile and top site component, a simple subtraction and then voila?
Once again it involved programming, and I thought I got very far. But I couldn't get it to work, so I gave up and asked on the forum. And I'll be damned if the forum didn't deliver! Or Andreas Dieckmann to be exact. He didn't just point me in the right direction, he didn't just give me the modified python script on a copy/paste basis but he even annotated it so I could learn what the different parts was for. I'm nearly speechless! Huge thanks, Andreas!
The workflow goes like this:
1. Use the first graph to place site elements by level.
2. Pick all the site elements and pick topo as new host and set offset to 0 in Revit.
3. Open second graph and select both piles and site components
4. Press run, and delete the site objects if you don't want them
How you select elements can of course be edited, I just like the manual way! ;)
So that works while I wait for someone posting a more beatiful solution for this problem with angeled piles and all! And I guess you could use it for placing things on a topo as well. Trees and what not..
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.
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:
In revit after, with the dynamo definition:
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! :)
Soooo, this problem have circulated for some time, and most probably somebody have solved it. But I haven't seen anyone solve it elegantly yet. Alas, neither shall I..
- I have a pile family, in this case an adaptive one set with a standard length.
- I have a topo that represents the bedrock based on contractors data
- I want the piles to magically attach to topo.
Is this really to much too ask?
Well, it seems to be. The issue is in the Point.Project node in dynamo which won't take a topography for a geometry. Stupid node.. (Or stupid me for not understanding what to put in the node..)
This is basically how i wanted the definition to look like:
And this is what I ended up with:
And here you can clearly see, as my teacher used to say when one couldn't see nothing clearly, that the definition only works when the topography consists of nothing but closable polycurves.. not good enough.
So this post is really a plea for getting topography or a mesh derived from topography to work in the Point.Project node. Pretty please, almighty programmers?
However, when the topo does consists of closable polycurves it works pretty good. I've tried with 115 piles and you can see the response time here: