0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / tests / bugs / iges / bug26047
1 puts "============"
2 puts "0026047: Data Exchange - Lost colors for IGES export"
3 puts "============"
4
5 pload MODELING VISUALIZATION OCAF XDE
6
7 Close D D_Cope -silent
8
9 # create original
10 box b 0 -20 -10 100 40 20
11 compound b b b a
12 explode a
13 trotate a_1 0 0 0 1 0 0 60
14 trotate a_2 0 0 0 1 0 0 -60
15 bcommon b a a_1
16 bcommon b b a_2
17
18 pcylinder c 4 100
19 trotate c 0 0 0 0 1 0 90
20
21 psphere s 1.4
22 ttranslate s 99.2 0 0
23 bfuse cx c s
24
25 pcone e 60 0.5 101
26 trotate e 0 0 0 0 1 0 90
27
28 bcommon body b e
29 bcut body body c
30 bcommon core cx e
31
32 text2brep text "CAD Assistant" -font Times -height 10
33 ttranslate text 10 -4 10
34 prism tr text 0 0 -1
35 bfuse body body tr
36
37 donly body core
38
39 #vdisplay body core
40 #vsetcolor body yellow
41 #vsetcolor core red
42
43 explode body so
44 explode body_1 f
45 explode core so
46
47 NewDocument D
48 XAddShape D body_1
49 XAddShape D core_1
50
51 for {set i 1} {$i <= 26} {incr i} {XSetColor D body_1_$i BLUE}
52 XSetColor D body_1_1 E68066
53 XSetColor D body_1_9 E68066
54 for {set i 10} {$i <= 22} {incr i} {XSetColor D body_1_$i 99B300}
55 XSetColor D core_1 1A1AFF
56 foreach ff [explode core_1 f] { XSetColor D $ff 1A1AFF ; puts "set color $ff" }
57
58 vinit
59 vclear 
60 XDisplay D -dispMode 1
61 vfit
62 vdump "$::imagedir/${::casename}_orig.png"
63 set aColorOrig [vreadpixel 360 290 rgb name]
64
65 # export a copy
66 set anIgesCopy "$::imagedir/${::casename}_exported.igs"
67 WriteIges D $anIgesCopy
68
69 # display an exported model
70 ReadIges D_Copy $anIgesCopy
71 file delete $anIgesCopy
72
73 vinit
74 vclear 
75 XDisplay D_Copy -dispMode 1
76 vfit
77 vdump "$::imagedir/${::casename}_exported.png"
78
79 # check color
80 set aColorNew [vreadpixel 360 290 rgb name]
81 if { "$aColorOrig" == "$aColorNew" } {
82   puts "OK: Image of exported model matches original"
83 } else {
84   puts "Error: Image of exported model is wrong!"
85 }
86
87 set xst [ XStat D_Copy 1] 
88 regexp {Number +of +labels +with +color +link += +([-0-9.+eE]+)} $xst full nbshcolor_Copy
89
90 if {$nbshcolor_Copy != 31} {
91   puts "Error: incorrect count of color links to shapes"
92 }