puts "TODO OCC24025 ALL: Two opened shells intersection"
puts "TODO OCC24025 ALL: Two shells intersection \\(one opened\\)"
puts "TODO OCC24025 ALL: ERROR OCCURS DURING TEST - FAULTY"

set Test "Boolean operations naming test"
set IsDone 1
set TestError ""

if {[catch {set TestLab}] == 1} {
	NewDocument D
	set TestLab 0:1
}

set myLab [set TestLab]:1
set myNameLab [set TestLab]:105

#################### four boxes:  fuse, cut, common, intersection ####################
NameBox D $myLab 20 30 25
GetShape D $myLab b1
set Box1Lab $myLab
NextLabel myLab
box b2 10 15 10 15 20 25
BuildNamedShape D $myLab PRIMITIVE b2
set Box2Lab $myLab
set bf [explode b2 F]
for {set i 0} {[lindex $bf $i]!=""} {incr i} {
  BuildNamedShape D [set myLab]:[expr $i+1] PRIMITIVE [lindex $bf $i]
}
NextLabel myLab
box b3 20 25 30 20 20 20
BuildNamedShape D $myLab PRIMITIVE b3
set Box3Lab $myLab
set bf [explode b3 F]
for {set i 0} {[lindex $bf $i]!=""} {incr i} {
  BuildNamedShape D [set myLab]:[expr $i+1] PRIMITIVE [lindex $bf $i]
}
NextLabel myLab
box b4 15 10 20 20 20 20
#box b4 5 5 5 20 20 20
BuildNamedShape D $myLab PRIMITIVE b4
set Box4Lab $myLab
set bf [explode b4 F]
for {set i 0} {[lindex $bf $i]!=""} {incr i} {
  BuildNamedShape D [set myLab]:[expr $i+1] PRIMITIVE [lindex $bf $i]
}
NextLabel myLab

NameFuse D $myLab b1 b2
set FuseLab $myLab
Checking "Two boxes fuse"
GetShape D $FuseLab FuseShape
GetShape D $Box3Lab b3
NameCut D $myLab FuseShape b3
set CutLab $myLab
Checking "Fuse result and box cut"
GetShape D $CutLab CutShape
GetShape D $Box4Lab b4
NameCommon D $myLab b4 CutShape
set CommonLab $myLab
Checking "Fuse cut result and box common"
GetShape D $CommonLab CommonShape
GetShape D $Box2Lab b2
#NameIntersection D $myLab CommonShape b2
#Checking "Fuse cut common result and box intersection"

#################### limit operation ####################
NameBox D $myLab 20 10 30
GetShape D $myLab b1
NextLabel myLab
NextLabel myNameLab
vertex v1 -10 -10 15
vertex v2 -10 100 15
vertex v3 100 -10 15
line l1 -10 -10 15 0 1 0
line l2 -10 100 15 1 -1 0
line l3 100 -10 15 -1 0 0
mkedge e1 l1 v1 v2
mkedge e2 l2 v2 v3
mkedge e3 l3 v3 v1
wire w e1 e2 e3
plane pl 0 0 15 0 0 15
mkface f pl w
NameImportShape D $myLab f
NextLabel myLab
NextLabel myNameLab
NameLimit D $myLab b1 f
Checking "Limit naming (box and planar face)"

#################### Intersection operation ####################
restore [locate_data_file Int_Sh1_3.brep] Obj1
NameImportShape D $myLab Obj1
NextLabel myLab
NextLabel myNameLab

restore [locate_data_file Int_Sh2_3.brep] Tool1
NameImportShape D $myLab Tool1
NextLabel myLab
NextLabel myNameLab

NameIntersection D $myLab Obj1 Tool1
Checking "Two opened shells intersection"

restore [locate_data_file Int_shell1.brep] Obj2
NameImportShape D $myLab Obj2
NextLabel myLab
NextLabel myNameLab

restore [locate_data_file Int_Sh1_3.brep] Tool2
NameImportShape D $myLab Tool2
NextLabel myLab
NextLabel myNameLab

NameIntersection D $myLab Obj2 Tool2
Checking "Two shells intersection (one opened)"


restore [locate_data_file Int_shell.brep] Obj3
NameImportShape D $myLab Obj3
NextLabel myLab
NextLabel myNameLab

restore [locate_data_file Int_wire.brep] Tool3
NameImportShape D $myLab Tool3
NextLabel myLab
NextLabel myNameLab

NameIntersection D $myLab Obj3 Tool3
Checking "Shell and wire intersection"

#################### bug with premature "IDENTIFY" naming: one cylinder cut another in the middle  ####################
NameCylinder D $myLab 20 100 0 1
GetShape D $myLab c1
NextLabel myLab
NextLabel myNameLab
pcylinder c2 20 30
ttranslate c2 0 0 30
BuildNamedShape D $myLab PRIMITIVE c2
set cf [explode c2 F]
for {set i 0} {[lindex $cf $i]!=""} {incr i} {
  BuildNamedShape D [set myLab]:[expr $i+1] PRIMITIVE [lindex $cf $i]
}
NextLabel myLab
NextLabel myNameLab
NameCut D $myLab c1 c2
Checking "Cut of two cylinders ( = = )"

#################### bug with MODIFUNTIL conceit: three cutted cylinders ####################
NameCylinder D $myLab 20 100 0 1
GetShape D $myLab c1
NextLabel myLab
NextLabel myNameLab
NameCylinder D $myLab 10 100 0 1
GetShape D $myLab c2
NextLabel myLab
NextLabel myNameLab
pcylinder c3 20 30
ttranslate c3 0 0 30
BuildNamedShape D $myLab PRIMITIVE c3
set cf [explode c3 F]
for {set i 0} {[lindex $cf $i]!=""} {incr i} {
  BuildNamedShape D [set myLab]:[expr $i+1] PRIMITIVE [lindex $cf $i]
}
NextLabel myLab
NextLabel myNameLab
NameCut D $myLab c1 c2
GetShape D $myLab CutShape
NextLabel myLab
NextLabel myNameLab
NameCut D $myLab CutShape c3
#Checking "Cut of three cylinders ( 0=) 0=) )"

# mpv: BRepNaming_Fillet is not ready now for this test
#################### bug with FILTERBYNEIGHBOURGS confusion: cylinder, cutted by shpere + fillet ####################
#NameCylinder D $myLab 20 100 0 1
#GetShape D $myLab c1
#NextLabel myLab
#NextLabel myNameLab
#psphere s 20
#ttranslate s 30 20 50
#BuildNamedShape D $myLab PRIMITIVE s
#explode s F
##name only face of sphere: it's enoth for this example
#BuildNamedShape D [set myLab]:1 PRIMITIVE s_1
#NextLabel myLab
#NextLabel myNameLab
#NameCut D $myLab c1 s
#set CutLab $myLab
#GetShape D $myLab CutShape
#NextLabel myLab
#NextLabel myNameLab
#set se [explode CutShape E]
#set CutEdge CutShape_1
#set minX [lindex [CenterOfShape CutShape_1] 0]
#for {set i 1} {[lindex $se $i]!=""} {incr i} {
#  set minC [lindex [CenterOfShape [lindex $se $i]] 0]
#  if {$minC < $minX} {
#    set minX $minC
#    set CutEdge [lindex $se $i]
#  }
#}
#SelectShape D $myLab $CutEdge CutShape
#set EdgeLab $myLab
#NextLabel myLab
#NextLabel myNameLab
#NameFillet D $myLab $CutLab $EdgeLab 10
#Checking "Fillet at cut cylinder by sphere ( \[( )"
