
puts "========"
puts "OCC745"
puts "========"
puts ""
#######################################################
## There are several cases where the offset algo works wrong for various reasons
## for wires containing only linear segments and arcs of circle.
#######################################################

restore [locate_data_file OCC745_1.brep] a 
checkshape a

if { [catch { mkoffset result a 1 -10 } status] } {
  puts "Faulty : an exception was caught"
} else {
    renamevar result_1 result
    set nb_info [nbshapes result]
    regexp {VERTEX +: +([-0-9.+eE]+)} $nb_info full ve
    puts [format "Result shape result contains %s vertexes" $ve]
    if { $ve == 0 } {
        puts [format "Faulty : Result shape is NULL shape"]
    } else {
        regexp {WIRE +: +([-0-9.+eE]+)} $nb_info full wi
        if {$wi > 1 } {
            set ll [explode result w]
            set num [llength $ll]
            puts [format "Faulty : Result shape result is COMPOUND and contains %s wires" $num]
            foreach {k} $ll {
                checkshape $k
                regexp {nb alone Vertices : ([-0-9.+eE]+)} [checksection $k] full cs
                if { $cs != 0 } {
                    puts [format "Faulty : Result shape is UNclosed wire !!! " $k]
                } else {
                    puts [format "OK: Result shape is CLOSED wire !!! "]
                }
            }
        }
    }
}

checkprops result -l 932.825 
checkshape result 
checksection result
checkview -display result -2d -path ${imagedir}/${test_image}.png

