Macro to place random cells on DTM


AskInga logo

Original Article Date: August 11, 2005

With thanks to Yrjo Ala-Heikkila for contributing these macros that can be used to mass populate landscape design schemes with trees and shrubs. They are also quite handy for placing other 3D items (wind turbines, stones, lampposts cars, etc.) on non-planar terrain models. Very Cool!!!

Download 255.zip and extract CellsOnSurface.mvba from the zip file.
Place the mvba in the folder pointed to by MS_VBASEARCHDIRECTORIES.
Keyin vba load cellsonsurface to load the project, or...
Configure MS_VBAAUTOLOADPROJECTS to automatically load the mvba project upon startup.
The mvba contains two macros as described below.
Full instructions are included in the zip file.

Forest Mix Planter
This macro allows you to mass populate the fence contents using a cell or selection of cells. Cells will be placed in a random pattern meaning that theit locations, scales and number will vary. TreeMixPlanter can not call RPC-cells directly. However, if you create an ordinary cell library from your RPC content, it works fine as seen in the image above.

Cells On Terrain
This companion macro is designed to move selected cells vertically until they hit a 3D terrain.

Yrjo writes: "I have used these macros for various visualization schemes with a great success. Take a look at the following image where I have placed more than 1000 RPC trees!! Placing them on DTM took only a few moments with TreeMixPlanter while the cars were placed on DTM with help of CellsOnTerrain."

An an interesting side note...Yrjo was inspired by an old V7 application that did much the same thing. Having virtually no programming experience, he waited desperatly for someone to re-compile the application to V8. Not being able to wait indefinitly, Yrjo took it upon himself to write a new application. So, having spent countless hours pouring in manuals and progressing with trial and error, the end result are the macros he has so graciously shared on AskInga. Good job Yrjo for a job well done!!

This program is supplied as is. AskInga, Bentley Systems Inc., and the author of the program assumes no liability for damages direct, indirect, or consequential, which may result from the use of this program. Use this program at your own risk.

AskInga Article #255