TABLE OF CONTENTS


::pwtk::xcd::makeFigs

SYNOPSIS

proc ::pwtk::xcd::makeFigs {fileList scriptList type {reduce 3}} {

PURPOSE

Make figures with xcrysden.

ARGUMENTS

SOURCE

    variable scriptFID
    variable runScript
    variable scriptOption
    
    set emptyScript 0

    if { $scriptList == {} } {
        # user didn't supply a script, make an empty script
        set emptyScript 1
        set scriptList [file join [::fileutil::tempdir] dummy.xcrysden]
        ::pwtk::writeFile $scriptList ""
    }

    # write and run xcrysden scripts and make figures ...
    
    foreach file $fileList {
        set head [file rootname [file tail $file]]

        set figGroup {}

        foreach script $scriptList {
            
            set scriptHead [file rootname [file tail $script]]
            if { $emptyScript } {
                set prefix ${head}_${type}
            } else {
                set prefix ${head}_${type}_$scriptHead
            }
            set scriptName $prefix.xcrysden
            set printFile  $prefix.png
            
            lappend figGroup $printFile

            set scriptFID  [open $scriptName "w"]                   
            make_script_ $script $file $printFile $reduce
            close $scriptFID        

            if { $runScript == 1 } {
                catch {exec xcrysden $scriptOption $scriptName}
            } elseif { $runScript == 2 } {
                if { ! [file exists $printFile] } {
                    catch {exec xcrysden $scriptOption $scriptName}
                }
            }
        }
        lappend figList $figGroup
    }

    return $figList
}