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