0023136: Increase visibility of DRAW samples
[occt.git] / samples / tcl / VisualizationDemo.tcl
1 # Copyright (c) 1999-2012 OPEN CASCADE SAS
2 #
3 # The content of this file is subject to the Open CASCADE Technology Public
4 # License Version 6.5 (the "License"). You may not use the content of this file
5 # except in compliance with the License. Please obtain a copy of the License
6 # at http://www.opencascade.org and read it completely before using this file.
7 #
8 # The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
9 # main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
10 #
11 # The Original Code and all software distributed under the License is
12 # distributed on an "AS IS" basis, without warranty of any kind, and the
13 # Initial Developer hereby disclaims all such warranties, including without
14 # limitation, any warranties of merchantability, fitness for a particular
15 # purpose or non-infringement. Please see the License for the specific terms
16 # and conditions governing the rights and limitations under the License.
17
18 # Command to log a message to both command-line and dialog window
19 proc sage { a} {
20     if { ![winfo exists .h ] } {
21         toplevel .h -bg azure3
22         wm title .h "INFO TEST HARNESS"
23         wm geometry .h +320+20
24     } 
25     if { [winfo exists .h.m ] } {
26         set astring [.h.m cget  -text]
27         set newstring "${astring} \n $a"
28         .h.m configure -text $newstring 
29         puts $a
30     } else {
31         message .h.m -justify left -bg azure2 -width 13c -relief ridge -bd 4 -text $a
32         puts $a
33     } 
34     pack .h.m
35     update
36 }
37
38 if { [winfo exists .h ] } {
39     destroy .h
40 }
41
42 pload MODELING VISUALIZATION
43
44 sage " Creating the V3D Viewer"
45 sage "    vinit"
46 sage " " 
47 vinit
48 vclear
49 clear
50
51 sage " Creating the Topological Viewer"
52 sage "    smallview"
53 sage " " 
54 smallview
55 sage " Creating a box"
56 sage "    box  b -10 -10 -10 20 20 20"
57 sage " "
58 box b -10 -10 -10 20 20 20
59 fit
60 sage " Display the box in the V3D Viewer"
61 sage "    vdisplay b"
62 sage " "
63 vdisplay b
64 vfit
65 nexplode b f
66 erase b
67 sage " Draft of two lateral faces "
68 sage "    nexplode b f"
69 sage "    depouille r b  0 0  -1 b_6 -15 10 -10 10  0 0 -1 "
70 sage "    nexplode r f"
71 sage "    depouille rr r  0 0 -1   r_1 -15 -10 -10 10  0 0 -1 "
72 sage " "
73 depouille r b  0 0  -1 b_6 -15 10 -10 10  0 0 -1 
74 clear
75 nexplode r f
76 depouille rr r  0 0 -1   r_1 -15 -10 -10 10  0 0 -1 
77 clear
78 nexplode rr e
79 verase b
80 vdisplay rr
81 vfit
82 sage " Fillet on four lateral edges, then on the top and bottom edges  "
83 sage "    nexplode rr e"
84 sage "    blend result rr 3 rr_2 3 rr_3 3 rr_10 3 rr_11"
85 sage "    nexplode result e"
86 sage "    blend result result 2 result_11 3 result_12"
87 sage " "
88 blend result rr 3 rr_2 3 rr_3 3 rr_10 3 rr_11
89 erase rr
90 erase result
91 nexplode result e
92 blend result result 2 result_11 3 result_12 
93 clear
94 nexplode result f
95 verase rr
96 vdisplay result
97 vfit
98 sage " Creating a profile on the top face "
99 sage "    nexplode result f"
100 sage "    profile p  S result_16 F 10 4 D 1 0 C 2 90. Y 8 C 2 90. X -2 C 2 90. Y -8 C 2 90. X 2
101 "
102 sage " "
103 profile p  S result_16 F 10 4 D 1 0 C 2 90. Y 8 C 2 90. X -2 C 2 90. Y -8 C 2 90. X 2
104 sage " Creating a prism"
105 sage "    prism rr p 0 0 20"
106 sage " "
107 prism rr p 0 0 20
108 sage " Change some attributs : MATERIAL , TRANSPARENCY"
109 sage "    vsetmaterial rr PLASTIC"
110 sage "    vsetcolor rr RED"
111 sage "    vsettransparency result 0.5"
112 sage "    vsetdispmode 1"
113 sage " "
114 vdisplay rr
115 vsetmaterial rr PLASTIC
116 vsettransparency rr 0.5
117 vsetcolor rr RED
118 vsettransparency result 0.5
119 vsetdispmode 1
120 vfit
121 fit
122 sage " Fusion of this prism with the original part "
123 sage "    fuse result rr result"
124 sage " "
125 fuse result rr result
126 donl result
127 vdisplay result
128 vdonly result
129 vfit
130 nexplode result f
131 erase result
132 fit
133
134 sage " Opening the top face"
135 sage "    offsetshape r result -1 0.0001 result_17"
136 sage " "
137 nexplode result f
138
139 offsetshape r result -1 0.0001 result_17
140 vdisplay r
141 vdonly r
142 vfit
143 vsetcolor r MATRABLUE
144 vsettransparency r 0
145
146 sage " Creating a cylinder and positionning it"
147 sage "    pcylinder cyl 2 300"
148 sage "    trotate cyl cyl 0 0 0  1 0 0 45"
149 sage "    ttranslate cyl cyl 0 7.5 0"
150 sage " "
151 pcylinder cyl 2 30
152 vdisplay cyl 
153 vsetcolor cyl RED
154 vfit
155 trotate cyl cyl 0 0 0  1 0 0 45
156 ttranslate cyl cyl 0 7.5 0
157 vdisplay cyl 
158 vsetcolor cyl RED
159 vfit
160 vdisplay cyl 
161 vsetcolor cyl RED
162 vfit
163 sage "Demo completed"