Update the Terrain Locator Connected to Population Tools

As of August 5th, 2025, Golaem will no longer provide direct support.

All support for Autodesk Golaem will now be handled exclusively through Autodesk support channels and this website will be deactivated.

Please bookmark the Autodesk Golaem Support section for any future support needs related to Autodesk Golaem packages.

When the layout is updated in the scene where a Golaem simulation exists, you sometimes want to update the Terrain which is used by the Population Tool Locators. Here's a utility script which takes a Terrain Locator name and connects it to all the Population Tool Locators of your scene:

global proc updatePopToolLocatorTerrain(string $terrainName)
{
    // check if the input name is a Terrain Locator
    if (`nodeType $terrainName` != "TerrainLocator")
    {
        error ($terrainName + " is not a TerrainLocator");
        return;
    }

    // update the connection
    string $popTools[] = getObjectsOfType("PopulationToolLocator");
    for ($popTool in $popTools)
    {
        string $previousTerrain = glmGetMapNode($popTool + ".inTerrain");
        if ($previousTerrain != "")
        {
            glmUnmapNode($previousTerrain, "message", ($popTool + ".inTerrain"));
            refresh;
            glmMapNode($terrainName, "message", ($popTool + ".inTerrain"));
            refresh;
        }
    }
}

This function can be called this way:

updatePopToolLocatorTerrain("terrainShape1");