# Library functions for the scripting library (scrib)
#
# File: scrib/lib/unigraphics.tcl
#
# $Revision$ on $Date$
# 
# Copyright (c) 1993-2003 ICEM CFD Engineering
#
#--------------------------------------------------------------------
#
# --> if the name of the first proc already exists in interp, return
#
if {"" != [info commands scrib_lib_unigraphics_import]} { return }
#
# --> procs in this file depend on the following scrib/lib/ files--source them
#     I guess we could do this by proc, too, not sure waht's best
#
if 0 {
    # none required
    set required_files ""
    scrib_lib_setup_source_files $required_files
}

## import the unigraphics file <em>levels</em> of <em>model</em> to a
## tetin file <em>tetin</em>

# this arg list is not-yet-read-for-primetime!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
proc scrib_lib_unigraphics_import {model tetin {levels ""} {offset 0} {noshow 0} } {
    
    set usr_opts_arg ""
    if 0 {
	# this arg list is not-yet-read-for-primetime!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
	if !$offset {
	    append usr_opts_arg " --suppress-points --suppress-curves"
	} else {append usr_opts_arg " --suppress-points "}
	
	if $noshow {
	    append usr_opts_arg " --triangulation-tolerance=0.001  +show +noshow +pick +nopick \
	     $model"
	} else {
	    append usr_opts_arg " --triangulation-tolerance=0.001  +show -noshow +pick +nopick \
	     $model"
	}    
	if {$layers != ""} {append usr_opts_arg " --layer=$layers "}
    }
    
    set mode_arg "ug_default"
    set usr_script_arg ""
    if [catch {ic_trans_ug_tetin $model $tetin $mode_arg $usr_script_arg } res] {
	mess "Warning: $res\n"
    }
    
    set stat ![file exists $tetin]
    if $stat {
	mess "couldn't import unigraphics file $model"
    }
    
    return $stat
}
