0% found this document useful (0 votes)
45 views4 pages

Introduction To Scripting

This document provides an introduction and overview of scripting languages TCL and SCL. It describes basic TCL commands like puts, comments, variables, expressions, loops, and conditions. It also covers SCL commands for graphical user interface design, identifying points, calculating bearing and distance, digitizing points, and dragging to create rectangles. The document serves as a tutorial for the scripting capabilities of TCL and SCL.

Uploaded by

Emmanuel Inkoom
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views4 pages

Introduction To Scripting

This document provides an introduction and overview of scripting languages TCL and SCL. It describes basic TCL commands like puts, comments, variables, expressions, loops, and conditions. It also covers SCL commands for graphical user interface design, identifying points, calculating bearing and distance, digitizing points, and dragging to create rectangles. The document serves as a tutorial for the scripting capabilities of TCL and SCL.

Uploaded by

Emmanuel Inkoom
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Introduction to scripting:

TCL: Tool Command Language


General:

puts puts “[message]”


Comment # [comment]
Variable and substitution set [variable name] [variable value]
$[vairiable name]
expr set [variable] [expr {[expression]}]
count Count [variable]
format set [variable [format “0.2f” [variable]

Loops:

count Count [vairiable]


while while {[condition]} {
[body]
}
foreach foreach [vairiable] {[list1] [list2] [list3]} {
[body]
}
proc proc [procedure name] {
[body]
}

[procedure name] [vair1] [vair2] [vair3]

Conditions:

if if {[condition]} {
elseif [body]
else } elseif {[condition]} {
[body]
} else {
[body]
}
switch switch $str {
"1" {set blk "WST-"}
"2" {set blk "MG-"}
"3" {set blk "LG-"}
"4" {set blk "HG-"}
}
SCL: Surpac Command Language

Guio: Graphical User Interface Design Object

Guido Form set Form {


GuidoForm Form {
-label "Vairable Selector"
-layout BoxLayout Y_AXIS
-default_buttons

GuidoPanel spnl {
-border etched true
-layout CentreLineLayout
###############################################################

###############################################################
}
}
}
SclCreateGuidoForm form $Form {}

$form SclRun { }

if { "$_status" != "apply" } {
return
}

Guido field GuidoField AZIMUTH {


-label "Enter Azimuth"
-default "180"
-display_length 20
-format range
#-format double / integer / string_field (x y z d1...) / decimal_angle / none
}
File Browser Field GuidoFileBrowserField GC_new {
-label "Enter Current Grade Control Drillhole Collar File for pit and level"
-display_length 30
-file_mask "*.str *.dtm"
-default "MPA2_220_1.str"
#-absolutePath true
#-browser_type directory
#-extension false
#-start_dir "c:/survey/pickups"
}
Combo Box GuidoComboBox PIT {
-label "Enter PIT"
-value_in "MPA2" "EPA2" "WPZ1" "WZ2S" "WZ2C" "WPZ3"
-default "MPA2"
}
Check box GuidoCheckBox PREV {
-label "File"
-height 1
-caption ""
-unselected_value "no"
-selected_value "yes"
}
Radio Buttons GuidoPanel Pannel {
-label "Radio Select"
-border etched true
-layout BoxLayout Y_AXIS
GuidoButtonGroupPanel method {
-layout GridLayout 2 2
GuidoRadioButton b1 {
-caption "Boundary dip"
-height 1
-selected_value "Boundary"
}
GuidoRadioButton b2 {
-caption "Fixed Dip"
-height 1
-selected_value "Fixed"
}
GuidoRadioButton b3 {
-caption "Slope strings"
-height 1
-selected_value "Slope"
}
GuidoRadioButton b4 {
-caption "Plane fit"
-height 1
-selected_value "Plane"
}
}
}
Graphics:

Identify Point # Select a point and print its values


set status [SclSelectPoint point "Select the point of interest" layer stringid \
segmentnum pointnum xp yp zp pointdesc]
if {$status == $SCL_OK} {
puts "Point selected OK"
puts "Layer=$layer, string=$stringid, segment=$segmentnum,
pointnum=$pointnum, \
X=$xp, Y=$yp, z=$zp"
} else {
puts "Error selecting a point - probably cancelled by the user"
}
Bearing and SclBearingDistance $x1 $y1 $x2 $y2 brg dist
Distance puts "The bearing from ($x1,$y1) to ($x2,$y2) = [SclExpr $brg / $SCL_PI * 180.0]
degrees, distance = $dist"

Corner to corner set prompt "Create a rectangle using the mouse to click and drag"
set status [SclDragRectCornerCorner $prompt x1 y1 z1 x2 y2 z2]
puts "status=$status, corner position 1 x, y, z= $x1 $y1 $z1, corner position 2 x, y,
\
z=$x2 $y2 $z2"
Digitize point SclDigitise "Setup Point" X1 Y1 Z1 "X"

set status [ SclFunction "CREATE POINT" {


frm00474={
{
istr="9999"
znew="$Z1"
ynew="$Y1"
xnew="$X1"
scroll={
{
attribute=""
}
}
}
{
_action="cancel"
}
}
}]

You might also like