Example Macro Scripts
Example 1
This example is of a script that performs an area reshape in a given, user defined, section and strip.
The first routine in this script is:
$result=Dragline::get_section_and_strip(\$section,\$strip);
It displays a panel that asks the user for the section and strip to run over.
Using the line:
if($result==0) {exit(0);}
will ensure that execution of the script ends if there is an error in the previous operation.
Example 1 script:
use Lava;
use Dragline;
$result=Dragline::get_section_and_strip(\$section,\$strip);
if($result==0) {exit(0);}
#OPERATION_BEGIN
$horizon=1;
$block=Dragline::new_block($strip,$horizon,"");
$horizon=1;
$position=Dragline::new_insitu_position($strip,$horizon,"next","crest");
$rehandle="true";
$equipment="Cast Blast";
$template=Dragline::new_template("BLAST",17);
$result=Dragline::area_reshape($section,$block,$rehandle,$equipment,$template,$position);
if($result==0) {exit(0);}
Example 2
This example demonstrates how to write a macro with loops. Using loops will allow you to perform the same operation across multiple sections, strips, or horizons. Other variables could also be iterated over, such as block equipment, or position.
In this case, a remove block operation is performed on strips 1 to 3 in section 1 for the insitu blocks in horizons 2 and 4.
The script also demonstrates how to display a message.
Example 2 script:
use Lava;
use Dragline;
$section=1;
foreach $strip (1..3)
{
foreach $horizon (2,4)
{
$block=Dragline::new_block($strip,$horizon,"");
$equipment="excavator";
$result=Dragline::remove_block($section,$block,$equipment);
if($result==0) {exit(0);}
Lava::Message("Block removed");
}
}