Dynamo: dealing with geometry - 7 principles
So I put a video up about creating a part of a very famous building in Bulgaria. You can find more about the building here.
Here I want to break down the basic principles of using Dynamo to create this. These are valid principles that could be used in many other cases of course.
I am also giving away the Dynamo definition and rfa file, you can find them here.
1: Sometimes it's better to draw the initial geometry in Revit.
I've some people trying to create complex profiles with points and lines entirely in Dynamo. That is of course possible, but in my experience it was always more viable to draw such geometries in Revit and then use them in Dynamo.
In that particular case I used just lines in a component. But using parametric profiles, or even 3d families is sometimes better than creating everything from scratch computationally.
2: You can still modify and control it computationally.
As you can see in the video I extract the curves from a static Revit element, but then I modify it with sliders.
This is done basically by recreating the geometry in Dynamo. So why not create it there from the beginning? Because that way we can use drawn geometry, or cad file profiles or anything that already exists as geometry. And once again - some things are definitely easier to draw with lines, not with nodes.
3: Getting familiar with code blocks/design script the easy way
Node to Code is a function that convert selected group of nodes into a code block:
This is irreversible for the moment, but boy is it good. You can condense an amount of messy nodes into a single block and at the same time you can get familiar with the way code blocks work. It also improves performance a bit.
And since performance is brought up to the conversation:
4: Hiding the preview not only hides geometry, but it also improves performance.
This is due to the way Dynamo works - every node creates a copy of the input and then modifies it. So when dealing with geometry operations hiding unnecessary things is always a good idea.
5. Inheritance and dependencies for fully parametric models
This is very clearly visible in the given example. Everything starts with the profile in Revit. If you change it everything will follow that change.
The profile in Revit controls the profile in Dynamo. Additional control sliders are added there and then that profile defines several surfaces. Based on them solids are created. Also based on one of the surfaces' curves I created the polygon for the windows divisions. The windows are dependent on the the lengths of the sides of that polygon and the height of the surface. That chain leads to the final geometry in Revit. Everything should follow a similar chain of dependencies if we're aiming at fully parametric models.
6. We can take advantage of the solid boolean operations in Dynamo
In Revit we don't get the classic boolean geometry operations, but in Dynamo they work pretty well. That said, in my experience I tend to avoid them when possible since the definitions become slower with the implementation of operations on solids. Also I have experienced bugs in their behavior on larger models in previous versions of Dynamo, but that should be fixed with Dynamo's ability to set a range for the geometry that's available since v1,3:
7. Importing the geometry in Revit
In the video I showed different ways to import geometries in Revit and there are even more.
The best way depends on what do we want to do exactly.
For example the beams and trusses. In Dynamo they are only curves. It would be a lot of additonal work to create the trusses in Dynamo and it probably wouldn't pay off (at least not in this case). Also you can sweep beams in dynamo and import them as geometries in Revit, but it is much better for various reasons to use StructuralFraming.BeamByCurve. It's quicker, easier and better BIM. We get a proper analytical model that way.
The other node I used in the example is CurtainSystem.ByFace. Dynamo 1,3 is the first version to have it Out-Of-The-Box, but the same node was existing before in the Clockwork package.
Pay attention how it's used. We need faces from a Revit mass family (or in-place mass). We can't use it directly on Dynamo faces.
And here you can also see the node Springs.FamilyInstance.ByGeometry from Springs package.
In my opinion this is the best way to import geometry in Revit's project enviromnent.
It creates a family instance from a template and you can assign category, subcategory, name and material to that family. In Dynamo 1,2 we got the OOTB node FamilyType.ByGeometry which does kind of the same thing, but I still prefer the version from Springs.
DirectShape.ByGeometry is another node that imports geometry from Dynamo to both Revit Project and Family Environment. It also exists as OOTB and inside Springs, and the one in Springs works better in the way that the OOTB node creates faceted geometry. Now Direct Shape is a large topic on itself and I'm not going to dig up it here.
The most classic OOTB node for importing geometry in Revit exists in 2 versions - ImportInstance.ByGeometry and ImportInstance.ByGeometries. The difference between them is kinda self-explanatory, but the way they work is not.
They actually create .SAT files and import them.
That said I have to say there is a huge difference if we want to create geometry inside a project or inside a family.
In the project we can use the methods mentioned above and the results are families, Direct Shapes or .SAT files.
Inside families we can still use DirectShape methods and ImportInstance methods. But additionally we can use
Springs.Form.ByGeometry which creates native revit geometry inside the families. We can also use Form.ByLoftCrossSections to loft directly inside a revit mass/adaptive family.
And of course we can control parametric families' parameters from inside Dynamo and place adaptive components automatically with Dynamo.
This is just an overview of principles used in that example and they are neither dogmatic nor exhaustive. Experimentation is always a good way of learning so you can try and see for yourself if that helps or not. Any thoughts on this will be appreciated so don't hesitate to write comments.
Thanks for reading!