When I first started using Dynamo a few months ago, one of the first definitions I attempted was one that was shared by Jostein Olsen almost exactly a year ago, showing how you could place trees randomly within a polygon area.
This is an excellent concept for placing any sort of plantings in a naturalized way.
But I wanted to improve and add a bit more functionality to this concept, so I created two custom nodes:
- Point.RandomAmount will create the specified amount of points and allows for a minimum distance between points.
- FamilyInstance.Percentage allows you to place multiple types based on a list of types and percentages.
And combined into a definition…
There are three inputs:
- lines of a closed polygon (Select Model Elements)
- list of family Types
- list of percentages
And the list of percentages will work with or without the final percent (if it is not entered, the node will calculate the remainder).
And to make the plantings appear more natural, you can also use the RandomRotation and RandomizeParameter nodes.
This definition just places the Plantings at the same elevation as the model lines. You can place them at the correct z elevation using Point.Project, but they will not be hosted to the Toposurface.
Since there is no way to change the host via the API, I prefer to just rehost Plantings via the Pick New Host in the UI.
In order to host the Plantings to a Topo, I will typically close Dynamo. This severs any link between Dynamo and the elements. Then use Pick New Host to rehost twice: first to a Level and then to the Surface (for some reason, they do not properly host to the Surface if you try it first).
These two nodes, along with some additional nodes and fixes are available in the latest Landform build.