Create Elevation Grid using Python

Hello everyone,

I'm trying to create an elevation grid from a point cloud using Python in Global Mapper. I want to limit the grid to a specific polygon area feature named "BDY". In the UI, there’s an option to "Crop to selected area feature(s)", which works as expected. However, I can’t figure out how to replicate this behavior in the Python script.

The script generator always produces the same code and doesn’t include anything about using a specific area feature to crop the grid.

Could someone please advise how to specify the layer and feature (by name or attribute) to use as a boundary for creating the elevation grid?

Here’s a sample of the generated script:

elevation_grid_param = gm.GM_GridGenSetup_t()

elevation_grid_param.mBandType = gm.GM_VAL_F32

elevation_grid_param.mDesc = "Cleaned.las (DTM Elevation Values)"

elevation_grid_param.mElevUnits = gm.GM_PRJ_UNIT_METERS

elevation_grid_param.mFlags = 262242 # see GM_GridGenFlags_t32 for flag list

elevation_grid_param.mGridAlg = gm.GM_GridAlg_BinMinimum

elevation_grid_param.mGridBinMult = 5

elevation_grid_param.mLidarBreaklineBinMult = True

elevation_grid_param.mLidarField = gm.GM_LidarGrid_Elevation

elevation_grid_param.mTaperValue = 0

elevation_grid_param.mTightnessMult = 0

elevation_grid_param.mXRes = 0.5

elevation_grid_param.mYRes = 0.5

layer_arr = []

layer_arr.append( gm.FindLoadedLayer("Cleaned.las") )

err, elev_grid_layer = gm.GenerateElevationGrid2(layer_arr, elevation_grid_param)