HgTrans Config File Example with Tcl Logic

set filename "[pwd]/column_text.dat"
set abffilename "[pwd]/column_text.abf"

## Files
hgtrans control SetFile $filename
hgtrans control SetOutputFile $abffilename

## Query file contents
set subcases [hgtrans result GetSubcaseList]
## All subcases
foreach subcase $subcases {
  set datatypes [hgtrans result GetDataTypeList $subcase]
  ## All datatypes
  foreach datatype $datatypes {
    set requests [hgtrans result GetRequestList $subcase $datatype]
    set components [hgtrans result GetComponentList $subcase $datatype]
    ## All requests
    foreach request $requests {
      ## All components
      foreach component $components {

        ## Add the vector to the abf file
        hgtrans config SetChannelSelected $subcase $datatype $request $component true

        ## Filter only Accleration vectors that are not a time vector
        if {[regexp -nocase -- {accel} $request] && ![regexp -nocase -- {time} $component] && ![regexp -nocase -- {frequency} $component] && ![regexp -nocase -- {Column 1} $component]} {
          hgtrans config SetChannelOverride $subcase $datatype $request $component "batch(t,v,0,60)"
        }

      }
    }
  
    ## Rename Requests within the datatype
    hgtrans control AddLabelAliasRule "*Point" "Node" "$subcase" "$datatype" "request"
    ## Rename the Data Types.
    hgtrans control AddLabelAliasRule "Unknown" "Nodal Results" "$subcase" "" "datatype"
  }
}


hgtrans control SetCompressionLevel high
hgtrans control SetTimeScaleFactor 0.001
hgtrans control StartTranslation