DiscussionsIssue archiveOCCT:Modeling Algorithms

Archived issue #0024706

Solids produced by BOP do not have flag Closed set in shells

Open CASCADEOCCT:Modeling Algorithmsclosed8 public notes

Search issues

Description

A finite solid is valid only if it is based on topologically closed shells. In OCCT shape (TopoDS_Shape) there is a flag Closed which allows to mark a shell as closed one. This flag can be used by algorithms that need to check closure of the shell, without running topological analysis. For instance, it is used in 3d viewer for activation of back-face culling on a solid objects, see #0024521.

OCCT algorithms that construct a new solid should set this flag properly. The algorithms like BRepPrimAPI_MakeBox do that:

Draw[83]> box b 10 10 10
Draw[84]> expl b sh
b_1
Draw[85]> whatis b_1
b_1 is a shape SHELL FORWARD Modified Orientable Closed

However, the Boolean operation algorithms do not set this flag properly:

Draw[86]> psph s 2
Draw[87]> bcut r b s
Draw[88]> expl r sh
r_1
Draw[89]> whatis r_1
r_1 is a shape SHELL FORWARD Modified Orientable

This should be fixed.

The observed effect of this is presence of visual artifacts at the back side of the sharp edges when faces are oriented mostly orthogonal to the screen, due to visibility of back faces which should be culled in a good solid. In the example above, display the shapes r and b in shaded mode and then rotate to see the difference:

Draw[]> ttranslate r 10 10 10
Draw[]> vsetdispmode 1
Draw[]> vdisplay b r
Draw[]> vfit

Note that old Boolean operations (e.g. command "cut") do set the Closed flag on shell properly. Moreover, command "sweep" even sets this flag on solid.

Perhaps BRepCheck should be improved to check this and other similar flags and either report or set them as appropriate.

Additional information

Flag CLOSED is set for closed shells created during perform of Boolean Operation.

Public activity

8 archived notes

Participants are labeled by their role within this record.

01Commenter 1
Git branch CR24706 is ready to be reviewed.
02Commenter 2
Reviewed.
03Commenter 3
Dear Commenter 1,

Branch CR24706 (and products from GIT master) was compiled on Linux and Windows platforms and tested.
[revision removed]

Number of compiler warnings:

occt component :
Linux: 30 (30 on master)
Windows: 0 (0 on master)

products component :
Linux: 12 (12 on master)
Windows: 2 (2 on master)

Regressions/Differences:
No regressions/differences

Testing cases:
http://occt-tests/CR24706-master-occt/Debian60-64/bugs/modalg_5/bug24706.html
http://occt-tests/CR24706-master-occt/Windows-32-VC9/bugs/modalg_5/bug24706.html
bugs modalg_5(010) bug24706: OK

Testing on Linux:
Total MEMORY difference: 386395792 / 386276008
Total CPU difference: 45278.14000000043 / 48827.5

Testing on Windows:
Total MEMORY difference: 431116624 / 430943812
Total CPU difference: 32909.640625 / 35761.78125

There are not differences in images found by testdiff.
http://occt-tests/CR24706-master-occt/Debian60-64/diff-Debian60-64.html
http://occt-tests/CR24706-master-occt/Windows-32-VC9/diff-Windows-32-VC9.html
IMAGE bugs modalg_2 bug578_2: bug578_2_Driver1_Viewer1_View1.png differs
IMAGE bugs modalg_2 bug23: bug23004_Driver1_Viewer1_View1.png differs
IMAGE bugs modalg_2 bug578_1: bug578_1_Driver1_Viewer1_View1.png differs
IMAGE bugs modalg_2 bug23004: bug23004_Driver1_Viewer1_View1.png differs
IMAGE bugs moddata_1 bug22761: bug22761_Driver1_Viewer1_View1.png differs
04Commenter 4
Mikhail, please comment on this fragment of test script -- why you check the same twice?

set info_1 [whatis r_1]
if { [regexp {Closed} ${info_1}] } {
    puts "OK : Flag CLOSED is set for closed shells created during perform of Boolean Operation"
} else {
    puts "Faulty : Flag CLOSED is not set for closed shells created during perform of Boolean Operation"
}

set info_2 [whatis r_1]
if { [regexp {Closed} ${info_2}] } {
    puts "OK : Flag CLOSED is set for closed shells created during perform of Boolean Operation"
} else {
    puts "Faulty : Flag CLOSED is not set for closed shells created during perform of Boolean Operation"
}

And please use word "Error" to indicate error, not "Faulty" -- being adjective, "faulty" needs a subject to make a meaningful phrase
05Commenter 5
Mikhail, please take care of what you write: what is the meaning of the phrase "There are not differences in images found by testdiff"? I would expect to see here "There are differences in images found by testdiff", as there ARE differences. When you want to say that there are NO differences, write "There are no differences in images found by testdiff" ("no" instead of "not").

The differences in shaded images are as expected (less artifacts near edges, more gaps on invalid shapes). Regarding differences on wireframe models, I guess these are instabilities -- please confirm.
06Commenter 6
Dear abv,
1. Test case bugs/modalg_5(010)/bug24706 was corrected.
2. Shaded image ot test case bugs/moddata_1(011)/bug22761 is no stable.
3. Shaded images ot test cases
bugs modalg_2(007) bug578_1, bug578_2, bug23004
are stable bad.
07Commenter 7
1. Message in first test is still incorrect: the shape being tested (b_1) is not result of Boolean Operation but made by "box" command
2. and 3. are as expected
08Commenter 8
Dear abv,
1. Test case bugs/modalg_5(010)/bug24706 was corrected.
2. OK, branch CR24706 is TESTED.

Related records