Place Trees at Their Exact Location in InfraWorks

2025-05-19_14-30-50.png

Ever wanted to show trees in their exact location in InfraWorks? It's easy! Let's take a look how to automate this procedure. Most of the time when we receive a survey, the trees are blocks. There is a lisp routine I have attached named Blocks2Points. This will create an AutoCAD point where the blocks are. This is what I have currently...

 

ToddRogersWPM_0-1747681489188.png

 

These trees are blocks and I am going to convert them to an AutoCAD point by using the above mentioned lisp routine. You have the option to delete the blocks, or keep them. I'm going to keep them. This lisp routine created the points at the insertion point of the tree blocks. Below you can see the points. I isolated them for clarity and easier selection...

 

ToddRogersWPM_1-1747681672848.png

 

You can change the style and size of these points, if you wish, by typing in PTYPE.

 

Next, type in MAPEXPORT. Change the file type to ESRI Shapefile (*.shp), give it name and a file save location. The export dialog box will appear. For the Object Type, toggle the radio button for Point. Now toggle the radio button for Select Manually and pick the select button...

 

ToddRogersWPM_2-1747681889629.png

 

Window select all the points. You should see at the bottom of the dialog box how many you selected and how many (if any) were filtered out...

 

ToddRogersWPM_3-1747681968378.png

 

Now we move into InfraWorks. Open the Data Connections asset card. Choose SHP from the list.

 

ToddRogersWPM_4-1747682066699.png

 

Browse to the file you exported out of Civil 3D. Now it will show up in the list. We now can double click on it to configure it. For the Type, choose Trees...

 

ToddRogersWPM_5-1747682201736.png

 

Click the Source tab and under Draping Options, set to Drape.  I have written a script which I will paste below to randomize the trees. Click on the Script tab, then click the Edit button, and copy and paste the below code in over the existing text that shown in that tab...

 

function Process(SOURCE, TREES) {

TREES.EXTERNAL_ID = SOURCE.FeatId;
var scaleFactor = 0.3;
var scaleVariationMax = 0.15;

if (Math.random() > 0.5) {

TREES.RULE_STYLE = "3D Model/Vegetation/Populus Nigra";

//Set baseline scale and randomize by variation
scaleFactor = 2;
scaleVariationMax = 1;
var variation = scaleVariationMax * Math.random() * 2 - scaleVariationMax;
TREES.MODEL_SCALE_X = scaleFactor + variation;
TREES.MODEL_SCALE_Y = scaleFactor + variation;
TREES.MODEL_SCALE_Z = scaleFactor + variation;

} else {

TREES.RULE_STYLE = "3D Model/Vegetation/Adaptive Trees/Beech Tree";

//Set baseline scale and randomize by variation
scaleFactor = 0.8;
scaleVariationMax = 0.3;
var variation = scaleVariationMax * Math.random() * 2 - scaleVariationMax;
TREES.MODEL_SCALE_X = scaleFactor + variation;
TREES.MODEL_SCALE_Y = scaleFactor + variation;
TREES.MODEL_SCALE_Z = scaleFactor + variation;

}
return true;
}

 

ToddRogersWPM_6-1747682559847.png

 

Now click Close and Refresh. If you're using a newer version of InfraWorks, you will get a warning about scripts. Go ahead and click Continue with Refresh. That's it. Your trees will be located in the correct location. If you would like to use different trees, replace the name of the tree you would like to use in the script for the TREES.RULE_STYLE.

 

ToddRogersWPM_7-1747682869119.png