# Library functions for the scripting library (scrib)
#
# File: scrib/lib/bsm.tcl
#
# $Revision: 389238 $ on $Date: 2004-01-08 20:44:05 -0500 (Thu, 08 Jan 2004) $
# 
# Copyright (c) 1993-2003 ICEM CFD Engineering
#
#--------------------------------------------------------------------

## mesh the cad part(s)

proc scrib_lib_bsm_cad_generate_mesh {} {
    #
    # call the export cad function in the scripting library
    #
    return [scrib_lib_export_cad_bydir]
}

## offset the meshed part(s)

proc scrib_lib_bsm_offset_mesh {working_dir} {
    #
    # call the offset mesh function in the scripting library
    #
    global proc_scrib_data
    scrib_lib_uns_remove_tempfiles $proc_scrib_data(wdir)
    return [scrib_lib_offset_mesh_bydir]
}

## assemble the meshed part(s)

proc scrib_lib_bsm_assemble_mesh {} {
    #
    # assemble all parts and weld if weld file specified
    #
    return [scrib_lib_assembly_assemble_weld_script]
}

## mesh, offset, assemble and weld the meshed part(s)

proc scrib_lib_bsm_justdoit {} {
    set stat 0
    if {0 != [catch {scrib_lib_bsm_cad_generate_mesh} res]} {
	stdout "There may have been problems in generating the mesh:\n$res\n" red
	incr stat
    }
    if {0 != [catch {scrib_lib_bsm_offset_mesh} res]}  {
	stdout "There may have been problems in offsetting the mesh:\n$res\n" red
	incr stat
    }
    if {0 != [catch {scrib_lib_bsm_assemble_mesh} res]}  {
	stdout "There may have been problems in assembling the mesh:\n$res\n"
	incr stat
    }
    return $stat    
}

