puts "========"
puts "OCC24954"
puts "========"
puts ""
################################################################
# BRepBuilderAPI_MakeFace adds wire with arbitrary orientation
################################################################

polyline p -1.15 3.42 1.95 4.54 3.13 1.36 2.97 -3.14 2.08 -1.15 3.42 1.95
wire w p
mkplane f w

# Verify orientation of shapes
set bug_info [whatis p]
if {[lindex $bug_info 5] != "FORWARD"} {
  puts "ERROR: Input data is incorrect."
}
set bug_info [whatis w]
if {[lindex $bug_info 5] != "FORWARD"} {
  puts "ERROR: Input data is incorrect."
}
set bug_info [whatis f]
if {[lindex $bug_info 5] != "FORWARD"} {
  puts "ERROR: Input data is incorrect."
}

# Explode face (f) and verify wire orientation
puts "Checks wires:"
set wire_name_list [explode f w]
set while_count 0
while {$while_count < [llength $wire_name_list]} {
  set bug_info [whatis [lindex $wire_name_list $while_count]]
  if {[lindex $bug_info 5] != "FORWARD"} {
    puts "ERROR: OCC24954 is reproduced. Wire [lindex $wire_name_list $while_count] has REVERSED orientation."
  } else {
    puts "     [lindex $wire_name_list $while_count] has FORWARD orientation."
  }
  set while_count [expr {$while_count + 1}]
}

# Explode face (f) and verify edge orientation
puts "Checks edges:"
set edge_name_list [explode f e]
set while_count 0
while {$while_count < [llength $edge_name_list]} {
  set bug_info [whatis [lindex $edge_name_list $while_count]]
  if {[lindex $bug_info 5] != "FORWARD"} {
    puts "ERROR: OCC24954 is reproduced. Edge [lindex $edge_name_list $while_count] has REVERSED orientation."
  } else {
    puts "     [lindex $edge_name_list $while_count] has FORWARD orientation."
  }
  set while_count [expr {$while_count + 1}]
}
