
# Stuff to deal with IGES and DXF files for autohex.  Some of these names
# shouldn't be iges_ since they are shared, probably.
#
#
# Copyright (c) 1993 ICEM Systems.
# Author:  Wayne A. Christopher, wayne@pmac.com
#          Pacific Marketing and Consulting, Berkeley, California

proc iges_minmax {x y z} {
    foreach i {x y z} {
	global iges_${i}s iges_${i}e
	if {![info exists iges_${i}s] || ([set iges_${i}s] > [set $i])} {
	    set iges_${i}s [set $i]
	}
	if {![info exists iges_${i}e] || ([set iges_${i}e] < [set $i])} {
	    set iges_${i}e [set $i]
	}
    }
}

proc iges_handle_one_entity {w et pl} {
}

proc iges_handle_110 {w p1 p2 label level {mkpts 1}} {
    global tdv_default
    global type_visible iges_nlines graph_color graph_width

    set cl "cad line"
    set cp "cad point"
    set a [construction_line -p1 $p1 -p2 $p2 -color $graph_color($cl) \
	    -width $graph_width($cl) -visible $type_visible(cad_line)]
    $tdv_default add_image $a
    eval iges_minmax $p1
    eval iges_minmax $p2
    $tdv_default add_tag $a cad_line
    
    if $mkpts {
	set a [construction_point -p1 $p1 -visible $type_visible(cad_point) \
		   -color $graph_color($cp) -width $graph_width($cp)]
	$tdv_default add_image $a
	$tdv_default add_tag $a cad_point
	set a [construction_point -p1 $p2 -visible $type_visible(cad_point) \
		   -color $graph_color($cp) -width $graph_width($cp)]
	$tdv_default add_image $a
	$tdv_default add_tag $a cad_point
    }
    if $w { $tdv_default redraw }
    incr iges_nlines
}

proc iges_handle_116 {w p1 label level} {
    global tdv_default
    global type_visible iges_npoints graph_color graph_width
    
    set cp "cad point"
    set a [construction_point -p1 $p1 -visible $type_visible(cad_point) \
	       -color $graph_color($cp) -width $graph_width($cp)]
    $tdv_default add_image $a
    eval iges_minmax $p1
    $tdv_default add_tag $a cad_point
    if $w { $tdv_default redraw }
    incr iges_npoints
}

proc iges_handle_126 {w polynomial k m uknot_list weight_list \
			  control_list label level} {
    # nothing yet
}

proc iges_handle_128 {w polynomial k1 m1 k2 m2 uknot_list vknot_list \
			  weight_list control_list label level} {
    # nothing yet
}
