Skip to content

Startup script

Zoltan Siki edited this page Jul 17, 2020 · 7 revisions

From version 3.1.1 besides GeoEasy data sets, tcl scripts can be specified from the command line. These scripts are executed after initialization in the order you define them. This may be a smart alternative to customize geo_easy.msk.

If you customize geo_easy.msk file, your changes are lost after the installation of a new version. While your startup script can be in any folder on your machine and easier to preserve.

For example if you would like two decimals in the Calculation results window create the following script and add it to the command line.

# startup.tcl file for GeoEasy

global decimals
set decimals 2

And start GeoEasy on Linux (depending on your installation style):

./geo_easy.tcl startup.tcl or

GeoEasy startup.tcl or

geoeasy startup.tcl

In case of Windows customize the desktop icon of GeoEasy and add your start up script.

You can also use startup script with --nogui command line switch to use GeoEasy for special non-interactive tasks (version 3.1.3+). For example use GeoEasy to convert test1.geo demo data set to csv/dmp files. First a short tcl script is created (dump.tcl in procs folder) to dump all loaded geo data sets to csv/dmp files:

global geoLoaded geoLoadedDir

foreach name $geoLoaded dir $geoLoadedDir {
    SaveTxt $name [file dirname ${dir}]/${name}.csv
    TxtOut $name [file dirname ${dir}]/${name}.dmp
}

To convert test1.geo to csv/dmp files use the following command on Windows (actual folder is the GeoEasy installation folder):

GeoEasy64.exe --nogui demodata/test1.geo ../procs/dump.tcl

Note the order of the files are significant, first load data then the script.

Another example to create a DXF file from loadad data sets (geo2dxf.tcl):

# GeoEasy script to create a dxf output 
# the file name is the same as the first loaded data set
global geoLoaded geoLoadedDir
global rp dxpn dypn dxz dyz spn sz pon zon slay pnlay zlay p3d zdec \
    pcodelayer xzplane useblock addlines
global contourInterval contourDxf contourLayer contour3Dface

if {[llength $geoLoaded] > 0} {
    # settings to update
    set p3d {0}         ;# 3D output
    set pd {0}          ;# detail points only
    set pon {1}         ;# add point IDs
    set zon {1}         ;# add elevation as text
    set slay {PT}       ;# layer name for point markers
    set pnlay {PN}      ;# layer name for point ID text
    set zlay {ZN}       ;# layer name for elevation text
    set rp {1.0}        ;# point markes size
    set dxpn {0.8}      ;# offset for point ID text
    set dypn {1.0}      ;# offset for point ID text
    set dxz {0.8}       ;# offset for elevation text
    set dyz {-1.0}      ;# offset for elevation text
    set spn {1.8}       ;# point ID text size
    set sz {1.5}        ;# elevation text size
    set zdec {2}        ;# number of decimals in elevation text
    set pcodelayer {0}  ;# add point code to layer name
    set xzplane {0}     ;# draw in xz plane
    set useblock {0}    ;# do not use blocks
    set addlines {0}    ;# no line work enabled
    set contourInterval {0} ;# no contours (DTM must be loaded)

    DXFout "[file dirname [lindex $geoLoadedDir 0]]/[lindex $geoLoaded 0].dxf"
}

Use it from the command line:

./geo_easy.tcl --nogui demodata/test1.geo ../procs/geo2dxf.tcl

Clone this wiki locally