mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-03 14:10:33 +03:00
0030145: Modeling Algorithms - Boolean Operations on open solids
Provide possibility to perform Boolean operations on open solids. Implementation of the new method *BOPAlgo_Builder::BuildBOP* performing the construction of the result shape for the given type of Boolean operation. This approach does not rely on the splits of solid to be correct and looks for the faces with necessary state relatively opposite solids to build the result solid. The call to this method is performed from BOP algorithm in case there were open solids in the arguments. Implementation of the draw command *buildbop* performing a call to the method above.
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
puts "TODO #22911 ALL: Error : The area of result shape is"
|
||||
puts "TODO OCC25735 ALL: Faulty shapes in variables faulty_1 to"
|
||||
puts "REQUIRED All: Faulty shapes in variables faulty_1 to faulty_2"
|
||||
|
||||
restore [locate_data_file CTO908_topo101-o1.brep] obj1
|
||||
restore [locate_data_file CTO908_topo101-t1.brep] tool1
|
||||
|
||||
bcut result obj1 tool1
|
||||
checkprops result -s 0
|
||||
checkprops result -s 18467.3
|
||||
checkview -display result -2d -s -otherwise { obj1 tool1 } -path ${imagedir}/${test_image}.png
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
puts "TODO #22911 ALL: Error : The area of result shape is"
|
||||
puts "TODO OCC25735 ALL: Faulty shapes in variables faulty_1 to"
|
||||
puts "REQUIRED All: Faulty shapes in variables faulty_1 to faulty_2"
|
||||
|
||||
restore [locate_data_file CTO908_topo101-o2.brep] obj2
|
||||
restore [locate_data_file CTO908_topo101-t2.brep] tool2
|
||||
bcut result obj2 tool2
|
||||
checkprops result -s 0
|
||||
checkprops result -s 15696.8
|
||||
checkview -display result -2d -s -otherwise { obj2 tool2 } -path ${imagedir}/${test_image}.png
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
puts "TODO #22911 ALL: Error : The area of result shape is"
|
||||
puts "TODO OCC25735 ALL: Faulty shapes in variables faulty_1 to"
|
||||
puts "REQUIRED All: Faulty shapes in variables faulty_1 to faulty_2"
|
||||
|
||||
restore [locate_data_file CTO908_topo102-o.brep] obj
|
||||
restore [locate_data_file CTO908_topo102-t.brep] tool
|
||||
|
||||
bcut result obj tool
|
||||
checkprops result -s 0
|
||||
checkprops result -s 44135.8
|
||||
checkview -display result -2d -s -otherwise { obj tool } -path ${imagedir}/${test_image}.png
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
puts "TODO #22911 ALL: Error : The area of result shape is"
|
||||
puts "TODO OCC25735 ALL: Faulty shapes in variables faulty_1 to"
|
||||
puts "REQUIRED All: Faulty shapes in variables faulty_1 to faulty_2"
|
||||
|
||||
restore [locate_data_file CTO908_topo103-o.brep] obj
|
||||
restore [locate_data_file CTO908_topo103-t.brep] tool
|
||||
|
||||
bcut result obj tool
|
||||
checkprops result -s 0
|
||||
checkprops result -s 133676
|
||||
checkview -display result -2d -s -otherwise { obj tool } -path ${imagedir}/${test_image}.png
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
puts "TODO OCC25735 ALL: Faulty shapes in variables faulty_1 to"
|
||||
puts "REQUIRED All: Faulty shapes in variables faulty_1 to faulty_2"
|
||||
|
||||
restore [locate_data_file CTO908_topo104-o1.brep] wheel
|
||||
restore [locate_data_file CTO908_topo104-o2.brep] jante
|
||||
|
||||
bfuse result wheel jante
|
||||
|
||||
checkprops result -s 40059.9
|
||||
checkprops result -s 28962.2
|
||||
checkview -display result -2d -otherwise { wheel jante } -s -path ${imagedir}/${test_image}.png
|
||||
@@ -29,4 +29,5 @@
|
||||
029 splitter
|
||||
030 history
|
||||
031 removefeatures
|
||||
032 simplify
|
||||
032 simplify
|
||||
033 opensolid
|
||||
41
tests/boolean/opensolid/A1
Normal file
41
tests/boolean/opensolid/A1
Normal file
@@ -0,0 +1,41 @@
|
||||
puts "REQUIRED All: Faulty shapes in variables faulty_1 to faulty_2"
|
||||
|
||||
box b1 10 10 10
|
||||
box b2 5 0 0 10 10 10
|
||||
|
||||
shape s1 So
|
||||
shape s2 So
|
||||
shape sh1 Sh
|
||||
shape sh2 Sh
|
||||
|
||||
foreach f [lrange [explode b1 f] 0 4] { add $f sh1 }
|
||||
foreach f [lrange [explode b2 f] 0 4] { add $f sh2 }
|
||||
|
||||
add sh1 s1
|
||||
add sh2 s2
|
||||
|
||||
bclearobjects
|
||||
bcleartools
|
||||
baddobjects s1
|
||||
baddtools s2
|
||||
bfillds
|
||||
|
||||
bbop r0 0
|
||||
bbop r1 1
|
||||
bbop r2 2
|
||||
bbop r3 3
|
||||
|
||||
foreach r {r0 r1 r2 r3} {
|
||||
checkshape $r
|
||||
if {![regexp "OK" [bopcheck $r]]} {
|
||||
puts "Error: shape is self-interfered"
|
||||
}
|
||||
}
|
||||
|
||||
checknbshapes r1 -vertex 16 -edge 26 -wire 11 -face 11 -shell 1 -solid 1
|
||||
checkprops r1 -s 650
|
||||
|
||||
foreach r {r0 r2 r3} {
|
||||
checknbshapes $r -vertex 8 -edge 12 -wire 5 -face 5 -shell 1 -solid 1
|
||||
checkprops $r -s 350
|
||||
}
|
||||
45
tests/boolean/opensolid/A2
Normal file
45
tests/boolean/opensolid/A2
Normal file
@@ -0,0 +1,45 @@
|
||||
puts "REQUIRED All: Faulty shapes in variables faulty_1 to faulty_2"
|
||||
|
||||
box b1 10 10 10
|
||||
box b2 2.5 0 0 5 10 5
|
||||
|
||||
shape s1 So
|
||||
shape s2 So
|
||||
shape sh1 Sh
|
||||
shape sh2 Sh
|
||||
|
||||
foreach f [lrange [explode b1 f] 0 4] { add $f sh1 }
|
||||
foreach f [lrange [explode b2 f] 0 4] { add $f sh2 }
|
||||
|
||||
add sh1 s1
|
||||
add sh2 s2
|
||||
|
||||
bclearobjects
|
||||
bcleartools
|
||||
baddobjects s1
|
||||
baddtools s2
|
||||
bfillds
|
||||
|
||||
bbop r0 0
|
||||
bbop r1 1
|
||||
bbop r2 2
|
||||
bbop r3 3
|
||||
|
||||
foreach r {r0 r1 r2 r3} {
|
||||
checkshape $r
|
||||
if {![regexp "OK" [bopcheck $r]]} {
|
||||
puts "Error: shape is self-interfered"
|
||||
}
|
||||
}
|
||||
|
||||
checknbshapes r0 -vertex 8 -edge 12 -wire 5 -face 5 -shell 1 -solid 1
|
||||
checkprops r0 -s 200
|
||||
|
||||
checknbshapes r1 -vertex 16 -edge 24 -wire 9 -face 9 -shell 1 -solid 1
|
||||
checkprops r1 -s 500
|
||||
|
||||
checknbshapes r2 -vertex 16 -edge 24 -wire 8 -face 8 -shell 1 -solid 1
|
||||
checkprops r2 -s 500
|
||||
|
||||
checknbshapes r3 -vertex 0 -edge 0 -wire 0 -face 0 -shell 0 -solid 0
|
||||
checkprops r3 -s empty
|
||||
44
tests/boolean/opensolid/A3
Normal file
44
tests/boolean/opensolid/A3
Normal file
@@ -0,0 +1,44 @@
|
||||
puts "REQUIRED All: Faulty shapes in variables faulty_1 to faulty_2"
|
||||
|
||||
box b1 -15 0 0 20 5 5
|
||||
box b2 5 5 20
|
||||
|
||||
shape s1 So
|
||||
shape s2 So
|
||||
shape sh1 Sh
|
||||
shape sh2 Sh
|
||||
|
||||
foreach f [lrange [explode b1 f] 1 5] { add $f sh1 }
|
||||
foreach f [lrange [explode b2 f] 0 4] { add $f sh2 }
|
||||
|
||||
add sh1 s1
|
||||
add sh2 s2
|
||||
|
||||
bclearobjects
|
||||
bcleartools
|
||||
baddobjects s1
|
||||
baddtools s2
|
||||
bfillds
|
||||
|
||||
bbop r0 0
|
||||
bbop r1 1
|
||||
bbop r2 2
|
||||
bbop r3 3
|
||||
|
||||
foreach r {r0 r1 r2 r3} {
|
||||
checkshape $r
|
||||
if {![regexp "OK" [bopcheck $r]]} {
|
||||
puts "Error: shape is self-interfered"
|
||||
}
|
||||
}
|
||||
|
||||
checknbshapes r0 -vertex 8 -edge 12 -wire 6 -face 6 -shell 1 -solid 1
|
||||
checkprops r0 -s 150
|
||||
|
||||
checknbshapes r1 -vertex 16 -edge 28 -wire 12 -face 12 -shell 1 -solid 1
|
||||
checkprops r1 -s 700
|
||||
|
||||
foreach r {r2 r3} {
|
||||
checknbshapes $r -vertex 8 -edge 12 -wire 5 -face 5 -shell 1 -solid 1
|
||||
checkprops $r -s 325
|
||||
}
|
||||
60
tests/boolean/opensolid/A4
Normal file
60
tests/boolean/opensolid/A4
Normal file
@@ -0,0 +1,60 @@
|
||||
box b1 40 10 10
|
||||
box b2 0 0 30 40 10 10
|
||||
box b3 10 10 40
|
||||
box b4 30 0 0 10 10 40
|
||||
|
||||
bclearobjects
|
||||
bcleartools
|
||||
baddobjects b1 b2 b3 b4
|
||||
bfillds
|
||||
bbuild r
|
||||
|
||||
# fuse of all
|
||||
buildbop r1 -o b1 b2 b3 b4 -op fuse
|
||||
buildbop r2 -o b1 b2 b3 -t b4 -op fuse
|
||||
buildbop r3 -o b1 b2 -t b3 b4 -op fuse
|
||||
buildbop r4 -o b1 -t b2 b3 b4 -op fuse
|
||||
buildbop r5 -t b1 b2 b3 b4 -op fuse
|
||||
|
||||
foreach r {r1 r2 r3 r4 r5} {
|
||||
checkshape $r
|
||||
checknbshapes $r -vertex 32 -edge 64 -wire 32 -face 32 -shell 1 -solid 1
|
||||
checkprops $r -s 4800 -v 12000
|
||||
}
|
||||
|
||||
# Cut
|
||||
buildbop r1 -o b1 b2 -t b3 b4 -op cut
|
||||
buildbop r2 -o b1 b2 -t b3 b4 -op tuc
|
||||
|
||||
foreach r {r1 r2} {
|
||||
checkshape $r
|
||||
checknbshapes $r -vertex 16 -edge 24 -wire 12 -face 12 -shell 2 -solid 2
|
||||
checkprops $r -s 2000 -v 4000
|
||||
}
|
||||
|
||||
buildbop r1 -o b1 -t b3 b4 -op cut
|
||||
buildbop r2 -o b2 -t b3 b4 -op cut
|
||||
|
||||
foreach r {r1 r2} {
|
||||
checkshape $r
|
||||
checknbshapes $r -vertex 8 -edge 12 -wire 6 -face 6 -shell 1 -solid 1
|
||||
checkprops $r -s 1000 -v 2000
|
||||
}
|
||||
|
||||
# Common
|
||||
buildbop r1 -o b1 b2 -t b3 b4 -op common
|
||||
checkshape r1
|
||||
checknbshapes r1 -vertex 32 -edge 48 -wire 24 -face 24 -shell 4 -solid 4
|
||||
checkprops r1 -s 2400 -v 4000
|
||||
|
||||
buildbop r1 -o b1 -t b3 b4 -op common
|
||||
buildbop r2 -o b2 -t b3 b4 -op common
|
||||
|
||||
checkshape r1
|
||||
checkshape r2
|
||||
|
||||
foreach r {r1 r2} {
|
||||
checkshape $r
|
||||
checknbshapes $r -vertex 16 -edge 24 -wire 12 -face 12 -shell 2 -solid 2
|
||||
checkprops $r -s 1200 -v 2000
|
||||
}
|
||||
32
tests/boolean/opensolid/A5
Normal file
32
tests/boolean/opensolid/A5
Normal file
@@ -0,0 +1,32 @@
|
||||
box b1 10 2 2
|
||||
box b2 2 0.5 -3 1 1 8
|
||||
box b3 7 0.5 -3 1 1 8
|
||||
invert b3
|
||||
|
||||
bclearobjects
|
||||
bcleartools
|
||||
baddobjects b1
|
||||
baddtools b2 b3
|
||||
bfillds
|
||||
bbuild r
|
||||
|
||||
buildbop r0 -o b1 -t b2 b3 -op common
|
||||
buildbop r1 -o b1 -t b2 b3 -op fuse
|
||||
buildbop r2 -o b1 -t b2 b3 -op cut
|
||||
buildbop r3 -o b1 -t b2 b3 -op tuc
|
||||
|
||||
checkshape r0
|
||||
checkprops r0 -s 110 -v 38
|
||||
checknbshapes r0 -vertex 24 -edge 36 -wire 20 -face 16 -shell 2 -solid 2
|
||||
|
||||
checkshape r1
|
||||
checkprops r1 -s 28 -v -6
|
||||
checknbshapes r1 -vertex 16 -edge 24 -wire 12 -face 12 -shell 2 -solid 2
|
||||
|
||||
checkshape r2
|
||||
checkprops r2 -s 10 -v 2
|
||||
checknbshapes r2 -vertex 8 -edge 12 -wire 6 -face 6 -shell 1 -solid 1
|
||||
|
||||
checkshape r3
|
||||
checkprops r3 -s 164 -v -46
|
||||
checknbshapes r3 -vertex 40 -edge 60 -wire 32 -face 28 -shell 3 -solid 3
|
||||
34
tests/boolean/opensolid/A6
Normal file
34
tests/boolean/opensolid/A6
Normal file
@@ -0,0 +1,34 @@
|
||||
box b1 10 2 2
|
||||
box b2 5 0 0 5 5 5
|
||||
box b3 6 0 0 1 1 1
|
||||
|
||||
bclearobjects
|
||||
bcleartools
|
||||
baddobjects b1
|
||||
baddtools b2 b3
|
||||
bfillds
|
||||
bbuild r
|
||||
|
||||
buildbop r0 -o b1 -t b2 b3 -op common
|
||||
buildbop r1 -o b1 -t b2 b3 -op fuse
|
||||
buildbop r2 -o b1 -t b2 b3 -op cut
|
||||
buildbop r3 -o b1 -t b2 b3 -op tuc
|
||||
|
||||
foreach r {r0 r1 r2 r3} {
|
||||
checkshape $r
|
||||
if {![regexp "OK" [bopcheck $r]]} {
|
||||
puts "Error: shape is self-interfered"
|
||||
}
|
||||
}
|
||||
|
||||
checkprops r0 -s 56 -v 20
|
||||
checknbshapes r0 -vertex 16 -edge 25 -wire 12 -face 12 -shell 2 -solid 2
|
||||
|
||||
checkprops r1 -s 190 -v 145
|
||||
checknbshapes r1 -vertex 24 -edge 38 -wire 16 -face 16 -shell 1 -solid 1
|
||||
|
||||
checkprops r2 -s 48 -v 20
|
||||
checknbshapes r2 -vertex 8 -edge 12 -wire 6 -face 6 -shell 1 -solid 1
|
||||
|
||||
checkprops r3 -s 142 -v 105
|
||||
checknbshapes r3 -vertex 12 -edge 18 -wire 8 -face 8 -shell 1 -solid 1
|
||||
59
tests/boolean/opensolid/A7
Normal file
59
tests/boolean/opensolid/A7
Normal file
@@ -0,0 +1,59 @@
|
||||
box b1 10 10 10
|
||||
box b2 1 1 1 8 8 8
|
||||
box b3 -2 3 3 14 4 4
|
||||
|
||||
bclearobjects
|
||||
bcleartools
|
||||
baddobjects b1 b2 b3
|
||||
bfillds
|
||||
bbuild r
|
||||
|
||||
buildbop r0 -o b3 -t b1 b2 -op common
|
||||
buildbop r1 -o b3 -t b1 b2 -op fuse
|
||||
buildbop r2 -o b3 -t b1 b2 -op cut
|
||||
buildbop r3 -o b3 -t b1 b2 -op tuc
|
||||
|
||||
foreach r {r0 r1 r2 r3} {
|
||||
checkshape $r
|
||||
if {![regexp "OK" [bopcheck $r]]} {
|
||||
puts "Error: shape is self-interfered"
|
||||
}
|
||||
}
|
||||
|
||||
checkprops r0 -s 256 -v 160
|
||||
checknbshapes r0 -vertex 16 -edge 28 -wire 16 -face 16 -shell 3 -solid 3
|
||||
|
||||
checkprops r1 -s 664 -v 1064
|
||||
checknbshapes r1 -vertex 24 -edge 36 -wire 18 -face 16 -shell 1 -solid 1
|
||||
|
||||
checkprops r2 -s 128 -v 64
|
||||
checknbshapes r2 -vertex 16 -edge 24 -wire 12 -face 12 -shell 2 -solid 2
|
||||
|
||||
checkprops r3 -s 1432 -v 840
|
||||
checknbshapes r3 -vertex 32 -edge 52 -wire 28 -face 24 -shell 2 -solid 2
|
||||
|
||||
|
||||
|
||||
buildbop r0 -o b2 -t b1 b3 -op common
|
||||
buildbop r1 -o b2 -t b1 b3 -op fuse
|
||||
buildbop r2 -o b2 -t b1 b3 -op cut
|
||||
buildbop r3 -o b2 -t b1 b3 -op tuc
|
||||
|
||||
foreach r {r0 r1 r2 r3} {
|
||||
checkshape $r
|
||||
if {![regexp "OK" [bopcheck $r]]} {
|
||||
puts "Error: shape is self-interfered"
|
||||
}
|
||||
}
|
||||
|
||||
checkprops r0 -s 640 -v 512
|
||||
checknbshapes r0 -vertex 16 -edge 24 -wire 14 -face 12 -shell 2 -solid 2
|
||||
|
||||
checkprops r1 -s 664 -v 1064
|
||||
checknbshapes r1 -vertex 24 -edge 36 -wire 18 -face 16 -shell 1 -solid 1
|
||||
|
||||
checkprops r2 -s empty -v empty
|
||||
checknbshapes r2 -vertex 0 -edge 0 -wire 0 -face 0 -shell 0 -solid 0
|
||||
|
||||
checkprops r3 -s 1176 -v 552
|
||||
checknbshapes r3 -vertex 40 -edge 64 -wire 38 -face 34 -shell 5 -solid 5
|
||||
33
tests/boolean/opensolid/A8
Normal file
33
tests/boolean/opensolid/A8
Normal file
@@ -0,0 +1,33 @@
|
||||
box b1 10 10 10
|
||||
box b2 -2 -2 2 7 14 6
|
||||
box b3 5 -2 2 7 14 6
|
||||
bclearobjects
|
||||
bcleartools
|
||||
baddobjects b1
|
||||
baddtools b2 b3
|
||||
bfillds
|
||||
bbuild r
|
||||
|
||||
buildbop r0 -o b1 -t b3 b2 -op common
|
||||
buildbop r1 -o b1 -t b3 b2 -op fuse
|
||||
buildbop r2 -o b1 -t b3 b2 -op cut
|
||||
buildbop r3 -o b1 -t b3 b2 -op tuc
|
||||
|
||||
foreach r {r0 r1 r2 r3} {
|
||||
checkshape $r
|
||||
if {![regexp "OK" [bopcheck $r]]} {
|
||||
puts "Error: shape is self-interfered"
|
||||
}
|
||||
}
|
||||
|
||||
checkprops r0 -s 560 -v 600
|
||||
checknbshapes r0 -vertex 12 -edge 20 -wire 11 -face 11 -shell 2 -solid 2
|
||||
|
||||
checkprops r1 -s 888 -v 1576
|
||||
checknbshapes r1 -vertex 32 -edge 50 -wire 20 -face 20 -shell 1 -solid 1
|
||||
|
||||
checkprops r2 -s 560 -v 400
|
||||
checknbshapes r2 -vertex 20 -edge 30 -wire 14 -face 14 -shell 2 -solid 2
|
||||
|
||||
checkprops r3 -s 816 -v 576
|
||||
checknbshapes r3 -vertex 24 -edge 40 -wire 18 -face 18 -shell 2 -solid 2
|
||||
56
tests/boolean/opensolid/A9
Normal file
56
tests/boolean/opensolid/A9
Normal file
@@ -0,0 +1,56 @@
|
||||
puts "REQUIRED All: Faulty shapes in variables faulty_1 to faulty_2"
|
||||
|
||||
box b1 10 10 10
|
||||
box b2 5 0 0 10 10 10
|
||||
|
||||
shape s1 So
|
||||
shape s2 So
|
||||
shape sh1 Sh
|
||||
shape sh2 Sh
|
||||
|
||||
foreach f [lrange [explode b1 f] 0 4] { add $f sh1 }
|
||||
foreach f [lrange [explode b2 f] 0 4] { add $f sh2 }
|
||||
|
||||
add sh1 s1
|
||||
add sh2 s2
|
||||
|
||||
polyline p 1 1 1 1 9 1 1 9 9 1 1 9 1 1 1
|
||||
mkplane f p
|
||||
orientation f I
|
||||
shape shell_int1 Sh
|
||||
add f shell_int1
|
||||
add shell_int1 s1
|
||||
|
||||
copy shell_int1 shell_int2
|
||||
ttranslate shell_int2 13 0 0
|
||||
add shell_int2 s2
|
||||
|
||||
bclearobjects
|
||||
bcleartools
|
||||
baddobjects s1
|
||||
baddtools s2
|
||||
bfillds
|
||||
|
||||
bbop r0 0
|
||||
bbop r1 1
|
||||
bbop r2 2
|
||||
bbop r3 3
|
||||
|
||||
foreach r {r0 r1 r2 r3} {
|
||||
checkshape $r
|
||||
if {![regexp "OK" [bopcheck $r]]} {
|
||||
puts "Error: shape is self-interfered"
|
||||
}
|
||||
}
|
||||
|
||||
checknbshapes r0 -vertex 8 -edge 12 -wire 5 -face 5 -shell 1 -solid 1
|
||||
checkprops r0 -s 350
|
||||
|
||||
checknbshapes r1 -vertex 16 -edge 26 -wire 11 -face 11 -shell 1 -solid 1
|
||||
checkprops r1 -s 650
|
||||
|
||||
# results of CUT operations should contain an extra shell
|
||||
foreach r {r2 r3} {
|
||||
checknbshapes $r -vertex 12 -edge 16 -wire 6 -face 6 -shell 2 -solid 1
|
||||
checkprops $r -s 414
|
||||
}
|
||||
Reference in New Issue
Block a user