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.
6 thoughts on “Create a Forest with Dynamo”
I attempted the same thing a year ago with no real success. This is great. Thanks for sharing!
How and where you do 2 type parameters (min and max) and an instance parameter. If you had to share either a family or a project in which they would be ready.
I actually tried to do it but I have not succeeded. Otherwise, for example, sheet works well.
As you said, the min and max are both Type parameters, while the actual Height of the RPC Planting family is associated with the Instance (height) parameter. This allows the height to be changed by the Instance parameter.
Now I got everything to work
What is the largest area for which the program to place plants?
I use millimeters and the largest area I had 45000×45000 mm.
The larger the area remained empty. Model lines changed to blue.
It might not work as well in larger areas, but 4500mm does not seem very large. I would double check and make sure the lines are connected and closed.
When change the project units to meters, so it all works.