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