
set status [ SclFunction "EXIT GRAPHICS" {
  frm00108={
    {
      exit_mode="E"
    }
  }
}]

set status [ SclFunction "TOOL MODE TRADITIONAL" {} ]

set status [ SclFunction "BM EXIT" {
  frm20103={
    {
      exit_mode="E"
    }
  }
}]

set status [ SclFunction "BLOCK MODEL OPEN" {
  frm00906={
    {
      modname="ik_demo.mdl"
      use_const="Y"
      const_mod_name="ik_1x1x1"
    }
  }
  frm00907={
    {
      attrib_list={
        {
          l_bound=""
          u_bound=""
          import="YES"
        }
      }
    }
  }
  frm00910={
    {
      constraints=table { not op contype location id rnga rngb ext } {
        { "" "INSIDE" "CONSTRAINT" "ik1" "" "" "" "" }
        { "" "" "" "" "" "" "" "" }
        { "" "" "" "" "" "" "" "" }
        { "" "" "" "" "" "" "" "" }
        { "" "" "" "" "" "" "" "" }
        { "" "" "" "" "" "" "" "" }
        { "" "" "" "" "" "" "" "" }
        { "" "" "" "" "" "" "" "" }
        { "" "" "" "" "" "" "" "" }
        { "" "" "" "" "" "" "" "" }
        { "" "" "" "" "" "" "" "" }
        { "" "" "" "" "" "" "" "" }
        { "" "" "" "" "" "" "" "" }
        { "" "" "" "" "" "" "" "" }
        { "" "" "" "" "" "" "" "" }
        { "" "" "" "" "" "" "" "" }
        { "" "" "" "" "" "" "" "" }
        { "" "" "" "" "" "" "" "" }
        { "" "" "" "" "" "" "" "" }
        { "" "" "" "" "" "" "" "" }
        { "" "" "" "" "" "" "" "" }
        { "" "" "" "" "" "" "" "" }
        { "" "" "" "" "" "" "" "" }
        { "" "" "" "" "" "" "" "" }
        { "" "" "" "" "" "" "" "" }
        { "" "" "" "" "" "" "" "" }
      }
      conexp=""
      confile=""
    }
  }
}]


set status [ SclFunction "BM GRAPHICS DRAW" {
  frm20503={
    {
      display="normal"
      constraint="N"
      slice="N"
      rescale="Y"
      all_blocks="N"
      cloud_marker="."
      cloud_size="4"
    }
  }
}]

set status [ SclFunction "RECALL ANY FILE" {
  file="ik_demo.str"
  mode="openInNewLayer"
}]

set status [ SclFunction "ERASE STRINGS" {
  frm00089={
    {
      range1=""
      range2=""
      range3=""
      textalignment="<"
      layer_name="ik_demo.str"
    }
  }
}]

set status [ SclFunction "DRAW MARKERS" {
  frm00089={
    {
      range1=""
      range2=""
      range3=""
      ifld_num="d1"
      textalignment="<"
      position="All points"
      layer_name="ik_demo.str"
    }
  }
}]

set status [ SclFunction "DRAW DESC" {
  frm00089={
    {
      range1=""
      range2=""
      range3=""
      ifld_num="d1"
      textalignment="<"
      position="All points"
      layer_name="ik_demo.str"
    }
  }
}]

set status [ SclFunction "ZOOM OUT" {} ]

set status [ SclFunction "BM ADD ATTRIBUTE" {
  frm20150={
    {
      _action=display
      attributes=table { name type decimals bgv description } {
        { "cutoff1" "float" "2" "1" "first cutoff = 1.0" }
        { "cutoff2" "float" "2" "3" "second cutoff = 3.0" }
        { "cutoff3" "float" "2" "5" "third cutoff = 5.0" }
        { "cutoff4" "float" "2" "10" "fourth cutoff = 10.0" }
      }
    }
  }
}]

set status [ SclFunction "BM ADD ATTRIBUTE" {                
  frm20150={
    {
      _action=display
      attributes=table { name type decimals bgv description } {
        { "percent_below_cutoff1" "float" "2" "-1" "percent of the block below cutoff1 1" }
        { "percent_below_cutoff2" "float" "2" "-1" "percent of the block below cutoff2 3" }
        { "percent_below_cutoff3" "float" "2" "-1" "percent of the block below cutoff3 5" }
        { "percent_below_cutoff4" "float" "2" "-1" "percent of the block below cutoff4 10" }
      }
    }
  }
}]

set status [ SclFunction "BM ADD ATTRIBUTE" {
  frm20150={
    {
      _action=display
      attributes=table { name type decimals bgv description } {
        { "average01" "calculated" "2" "-1" "(0+cutoff1)/2" }
        { "average12" "calculated" "2" "-1" "(cutoff1+cutoff2)/2" }
        { "average23" "calculated" "2" "-1" "(cutoff2+cutoff3)/2" }
        { "average34" "calculated" "2" "-1" "(cutoff3+cutoff4)/2" }
      }
    }
  }
}]

set status [ SclFunction "BM ADD ATTRIBUTE" {
  frm20150={
    {
      _action=display
      attributes=table { name type decimals bgv description } {
        { "percent01" "calculated" "2" "-1" "percent_below_cutoff1-0" }
        { "percent12" "calculated" "2" "-1" "percent_below_cutoff2-percent_below_cutoff1" }
        { "percent23" "calculated" "2" "-1" "percent_below_cutoff3-percent_below_cutoff2" }
        { "percent34" "calculated" "2" "-1" "percent_below_cutoff4-percent_below_cutoff3" }
      }
    }
  }
}]

set status [ SclFunction "BM ADD ATTRIBUTE" {
  frm20150={
    {
      _action=display
      attributes=table { name type decimals bgv description } {
        { "ik_block_estimate" "calculated" "2" "-1" "percent01*average01+percent12*average12+percent23*average23+percent34*average34" }
      }
    }
  }
}]

set status [ SclFunction "BM SAVE MODEL" {
  frm00121={
    {
      _action="apply"
    }
  }
}]

set status [ SclFunction "BM GRAPHICS DRAW" {
  frm20503={
    {
      display="normal"
      constraint="N"
      slice="N"
      rescale="Y"
      all_blocks="N"
      cloud_marker="."
      cloud_size="4"
    }
  }
}]

set status [ SclFunction "STR MATHS" {
  frm00700={
    {
      file_loc="ik_demo.str"
      file_id=""
      result_loc="ik_transform"
      main=table { str_range constraint field expr } {
        { "" "" "d2" "iif(d1>1,0,1)" }
        { "" "" "d3" "iif(d1>3,0,1)" }
        { "" "" "d4" "iif(d1>5,0,1)" }
        { "" "" "d5" "iif(d1>10,0,1)" }
        { "" "" "" "" }
        { "" "" "" "" }
        { "" "" "" "" }
        { "" "" "" "" }
        { "" "" "" "" }
        { "" "" "" "" }
        { "" "" "" "" }
      }
    }
  }
}]

set status [ SclFunction "BM FILL OK" {
  frm20030={
    {
      attname="percent_below_cutoff1"
    }
  }
  frm20601={
    {
      dist_att=""
      avgdist_att=""
      numsam_att=""
      kgvar_att=""
    }
  }
  frm20040={
    {
      datasrc="STRING FILE"
      location="ik_transform.str"
      id=""
      range="1"
      field="2"
      constrain="N"
    }
  }
  frm20080={
    {
      search="ELLIPSOID"
      minsamples="3"
      maxsamples="15"
      majordist="999"
      vertdist="999"
      const_by_id="N"
      axis_1="0"
      axis_2="0"
      axis_3="0"
      semimajfact="1"
      minorfact="1"
      string_file_source="true"
      rotationTypes="Surpac ZXY LRL"
      first_axis_rotation="L"
      sec_axis_rotation="R"
      third_axis_rotation="L"
      sec_axis="X"
      third_axis="Y"
      majorbrg=""
      dip=""
      tilt=""
    }
  }
  frm20101={
    {
      vg_model_file_name=""
      model="SPHERICAL"
      co="0"
      c1="1"
      a1="10"
      azimuth1="0"
      plunge1="0"
      dip1="0"
      semi_ratio1="1"
      minor_ratio1="1"
      dpt0="1"
      dpt1="1"
      dpt2="1"
      outfile="ik_demo"
      report_format=".not - Surpac Note File"
      debug="N"
      constrain="N"
    }
  }
  frm00121={
    {
      _action="apply"
    }
  }
}]

set status [ SclFunction "BM FILL OK" {
  frm20030={
    {
      attname="percent_below_cutoff2"
    }
  }
  frm20601={
    {
      dist_att=""
      avgdist_att=""
      numsam_att=""
      kgvar_att=""
    }
  }
  frm20040={
    {
      datasrc="STRING FILE"
      location="ik_transform.str"
      id=""
      range="1"
      field="3"
      constrain="N"
    }
  }
  frm20080={
    {
      search="ELLIPSOID"
      minsamples="3"
      maxsamples="15"
      majordist="999"
      vertdist="999"
      const_by_id="N"
      axis_1="0"
      axis_2="0"
      axis_3="0"
      semimajfact="1"
      minorfact="1"
      string_file_source="true"
      rotationTypes="Surpac ZXY LRL"
      first_axis_rotation="L"
      sec_axis_rotation="R"
      third_axis_rotation="L"
      sec_axis="X"
      third_axis="Y"
      majorbrg=""
      dip=""
      tilt=""
    }
  }
  frm20101={
    {
      vg_model_file_name=""
      model="SPHERICAL"
      co="0"
      c1="1"
      a1="10"
      azimuth1="0"
      plunge1="0"
      dip1="0"
      semi_ratio1="1"
      minor_ratio1="1"
      dpt0="1"
      dpt1="1"
      dpt2="1"
      outfile="ik_demo"
      report_format=".not - Surpac Note File"
      debug="N"
      constrain="N"
    }
  }
  frm00121={
    {
      _action="apply"
    }
  }
}]

set status [ SclFunction "BM FILL OK" {
  frm20030={
    {
      attname="percent_below_cutoff3"
    }
  }
  frm20601={
    {
      dist_att=""
      avgdist_att=""
      numsam_att=""
      kgvar_att=""
    }
  }
  frm20040={
    {
      datasrc="STRING FILE"
      location="ik_transform.str"
      id=""
      range="1"
      field="4"
      constrain="N"
    }
  }
  frm20080={
    {
      search="ELLIPSOID"
      minsamples="3"
      maxsamples="15"
      majordist="999"
      vertdist="999"
      const_by_id="N"
      axis_1="0"
      axis_2="0"
      axis_3="0"
      semimajfact="1"
      minorfact="1"
      string_file_source="true"
      rotationTypes="Surpac ZXY LRL"
      first_axis_rotation="L"
      sec_axis_rotation="R"
      third_axis_rotation="L"
      sec_axis="X"
      third_axis="Y"
      majorbrg=""
      dip=""
      tilt=""
    }
  }
  frm20101={
    {
      vg_model_file_name=""
      model="SPHERICAL"
      co="0"
      c1="1"
      a1="10"
      azimuth1="0"
      plunge1="0"
      dip1="0"
      semi_ratio1="1"
      minor_ratio1="1"
      dpt0="1"
      dpt1="1"
      dpt2="1"
      outfile="ik_demo"
      report_format=".not - Surpac Note File"
      debug="N"
      constrain="N"
    }
  }
  frm00121={
    {
      _action="apply"
    }
  }
}]

set status [ SclFunction "BM FILL OK" {
  frm20030={
    {
      attname="percent_below_cutoff4"
    }
  }
  frm20601={
    {
      dist_att=""
      avgdist_att=""
      numsam_att=""
      kgvar_att=""
    }
  }
  frm20040={
    {
      datasrc="STRING FILE"
      location="ik_transform.str"
      id=""
      range="1"
      field="5"
      constrain="N"
    }
  }
  frm20080={
    {
      search="ELLIPSOID"
      minsamples="3"
      maxsamples="15"
      majordist="999"
      vertdist="999"
      const_by_id="N"
      axis_1="0"
      axis_2="0"
      axis_3="0"
      semimajfact="1"
      minorfact="1"
      string_file_source="true"
      rotationTypes="Surpac ZXY LRL"
      first_axis_rotation="L"
      sec_axis_rotation="R"
      third_axis_rotation="L"
      sec_axis="X"
      third_axis="Y"
      majorbrg=""
      dip=""
      tilt=""
    }
  }
  frm20101={
    {
      vg_model_file_name=""
      model="SPHERICAL"
      co="0"
      c1="1"
      a1="10"
      azimuth1="0"
      plunge1="0"
      dip1="0"
      semi_ratio1="1"
      minor_ratio1="1"
      dpt0="1"
      dpt1="1"
      dpt2="1"
      outfile="ik_demo"
      report_format=".not - Surpac Note File"
      debug="N"
      constrain="N"
    }
  }
  frm00121={
    {
      _action="apply"
    }
  }
}]


set status [ SclFunction "CHECK BM CONNECTED" {
  functionName="BM REORDER ATTRIBUTES"
}]

set status [ SclFunction "BM REORDER ATTRIBUTES" {
  orderType="User Defined"
  numAttNames="17"
  att={
    "cutoff1"
    "cutoff2"
    "cutoff3"
    "cutoff4"
    "average01"
    "average12"
    "average23"
    "average34"
    "percent_below_cutoff1"
    "percent_below_cutoff2"
    "percent_below_cutoff3"
    "percent_below_cutoff4"
    "percent01"
    "percent12"
    "percent23"
    "percent34"
    "ik_block_estimate"
  }
}]

set status [ SclFunction "BM SAVE MODEL" {
  frm00121={
    {
      _action="apply"
    }
  }
}]

set status [ SclFunction "BM GRAPHICS BLOCK ID" {
  select_block={
    {
      objectx="0"
      objecty="0"
    }
  }
  frm20505={
    {
      _action="display"
    }
  }
}]

set status [ SclFunction "TOOL MODE TRADITIONAL" {} ]

set status [ SclFunction "TOOL CANCEL CURRENT" {} ]

puts ""
puts ""
puts "macro 2d_11b_ik_block_calculations.tcl completed"
puts ""