0029604: Uniform mechanism providing History of shape's modifications for OCCT algori...
[occt.git] / tests / heal / unify_same_domain / end
1 if {[isdraw result]} {
2   # check history information
3
4   # get resulting edges
5   eval compound [explode result v] res_verts
6   eval compound [explode result e] res_edges
7
8   # get all vertices and edges of the input shape
9   eval compound [explode a v] input_verts
10   eval compound [explode a e] input_edges
11
12   # get usd history
13   savehistory usd_hist
14
15   # check deleted
16
17   # get removed vertices through the history
18   compound rem_verts
19   foreach v [explode input_verts] {
20     if {[regexp "Deleted." [isdeleted usd_hist $v]]} {
21       add $v rem_verts;
22     }
23   }
24
25   # get removed edges through the history
26   compound rem_edges
27   foreach e [explode input_edges] {
28     if {[regexp "Deleted." [isdeleted usd_hist $e]]} {
29       add $e rem_edges;
30     }
31   }
32
33   # check that all removed shapes are not present in the result
34   bsection sec_v res_verts rem_verts
35   if {[llength [explode sec_v v]]} {
36     puts "Error: the history of the removed vertices is incorrect."
37   }
38
39   bsection sec_e res_edges rem_edges
40   if {[llength [explode sec_e e]]} {
41     puts "Error: the history of the removed edges is incorrect."
42   }
43
44   # faces should not be removed at all
45   foreach f [explode a f] {
46     if {[regexp "Deleted." [isdeleted usd_hist $f]]} {
47       puts "Error: the faces should not be removed during unification."
48       break;
49     }
50   }
51
52
53   # check modifications
54
55   # get all modified and not removed shapes into compound and
56   # compare the contents of the compound with the result shape
57   eval compound [explode a f] input_faces
58
59   compound all_hist_shapes
60   foreach comp {input_verts input_edges input_faces} {
61     foreach s [explode $comp] {
62       if {[regexp "Deleted." [isdeleted usd_hist $s]]} {
63         continue;
64       }
65       if {[regexp "The shape has not been modified." [modified s_mod usd_hist $s]]} {
66         add $s all_hist_shapes;
67         continue;
68       }
69       
70       if {[regexp "COMPOUND" [whatis s_mod]]} {
71         foreach sm [explode s_mod] { add $sm all_hist_shapes }
72       } else {
73         add s_mod all_hist_shapes;
74       }
75     }
76   }
77
78   eval compound [explode result f] res_faces
79   compound all_res_shapes
80   foreach comp {res_verts res_edges res_faces} {
81     foreach s [explode $comp] { add $s all_res_shapes }
82   }
83
84   checknbshapes all_hist_shapes -ref [nbshapes all_res_shapes]
85   checkprops all_hist_shapes -s [lindex [sprops result -skip] 2] -l [lindex [lprops result -skip] 2] -skip
86 }