480bf81e |
1 | # Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
2 | # |
ab91ab6f |
3 | #Category: Demos |
4 | #Title: Displaying 3d viewer |
5 | # |
480bf81e |
6 | # This file is part of Open CASCADE Technology software library. |
b311480e |
7 | # |
480bf81e |
8 | # This library is free software; you can redistribute it and / or modify it |
9 | # under the terms of the GNU Lesser General Public version 2.1 as published |
10 | # by the Free Software Foundation, with special exception defined in the file |
11 | # OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | # distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
13 | # |
480bf81e |
14 | # Alternatively, this file may be used under the terms of Open CASCADE |
15 | # commercial license or contractual agreement. |
b311480e |
16 | |
03392dd2 |
17 | # Command to log a message to both command-line and dialog window |
7fd59977 |
18 | proc sage { a} { |
03392dd2 |
19 | if { ![winfo exists .h ] } { |
20 | toplevel .h -bg azure3 |
21 | wm title .h "INFO TEST HARNESS" |
22 | wm geometry .h +320+20 |
23 | } |
24 | if { [winfo exists .h.m ] } { |
25 | set astring [.h.m cget -text] |
26 | set newstring "${astring} \n $a" |
27 | .h.m configure -text $newstring |
28 | puts $a |
29 | } else { |
30 | message .h.m -justify left -bg azure2 -width 13c -relief ridge -bd 4 -text $a |
31 | puts $a |
32 | } |
33 | pack .h.m |
34 | update |
7fd59977 |
35 | } |
36 | |
37 | if { [winfo exists .h ] } { |
38 | destroy .h |
39 | } |
40 | |
03392dd2 |
41 | pload MODELING VISUALIZATION |
42 | |
7fd59977 |
43 | sage " Creating the V3D Viewer" |
44 | sage " vinit" |
45 | sage " " |
46 | vinit |
47 | vclear |
48 | clear |
49 | |
50 | sage " Creating the Topological Viewer" |
51 | sage " smallview" |
52 | sage " " |
53 | smallview |
54 | sage " Creating a box" |
55 | sage " box b -10 -10 -10 20 20 20" |
56 | sage " " |
57 | box b -10 -10 -10 20 20 20 |
58 | fit |
59 | sage " Display the box in the V3D Viewer" |
60 | sage " vdisplay b" |
61 | sage " " |
62 | vdisplay b |
63 | vfit |
64 | nexplode b f |
65 | erase b |
66 | sage " Draft of two lateral faces " |
67 | sage " nexplode b f" |
68 | sage " depouille r b 0 0 -1 b_6 -15 10 -10 10 0 0 -1 " |
69 | sage " nexplode r f" |
70 | sage " depouille rr r 0 0 -1 r_1 -15 -10 -10 10 0 0 -1 " |
71 | sage " " |
72 | depouille r b 0 0 -1 b_6 -15 10 -10 10 0 0 -1 |
73 | clear |
74 | nexplode r f |
75 | depouille rr r 0 0 -1 r_1 -15 -10 -10 10 0 0 -1 |
76 | clear |
77 | nexplode rr e |
78 | verase b |
79 | vdisplay rr |
80 | vfit |
81 | sage " Fillet on four lateral edges, then on the top and bottom edges " |
82 | sage " nexplode rr e" |
83 | sage " blend result rr 3 rr_2 3 rr_3 3 rr_10 3 rr_11" |
84 | sage " nexplode result e" |
85 | sage " blend result result 2 result_11 3 result_12" |
86 | sage " " |
87 | blend result rr 3 rr_2 3 rr_3 3 rr_10 3 rr_11 |
88 | erase rr |
89 | erase result |
90 | nexplode result e |
91 | blend result result 2 result_11 3 result_12 |
92 | clear |
93 | nexplode result f |
94 | verase rr |
95 | vdisplay result |
96 | vfit |
97 | sage " Creating a profile on the top face " |
98 | sage " nexplode result f" |
99 | 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 |
100 | " |
101 | sage " " |
102 | 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 |
103 | sage " Creating a prism" |
104 | sage " prism rr p 0 0 20" |
105 | sage " " |
106 | prism rr p 0 0 20 |
107 | sage " Change some attributs : MATERIAL , TRANSPARENCY" |
108 | sage " vsetmaterial rr PLASTIC" |
109 | sage " vsetcolor rr RED" |
110 | sage " vsettransparency result 0.5" |
111 | sage " vsetdispmode 1" |
112 | sage " " |
113 | vdisplay rr |
114 | vsetmaterial rr PLASTIC |
115 | vsettransparency rr 0.5 |
116 | vsetcolor rr RED |
117 | vsettransparency result 0.5 |
118 | vsetdispmode 1 |
119 | vfit |
120 | fit |
121 | sage " Fusion of this prism with the original part " |
122 | sage " fuse result rr result" |
123 | sage " " |
124 | fuse result rr result |
125 | donl result |
126 | vdisplay result |
127 | vdonly result |
128 | vfit |
129 | nexplode result f |
130 | erase result |
131 | fit |
132 | |
133 | sage " Opening the top face" |
134 | sage " offsetshape r result -1 0.0001 result_17" |
135 | sage " " |
136 | nexplode result f |
137 | |
138 | offsetshape r result -1 0.0001 result_17 |
139 | vdisplay r |
140 | vdonly r |
141 | vfit |
142 | vsetcolor r MATRABLUE |
143 | vsettransparency r 0 |
144 | |
145 | sage " Creating a cylinder and positionning it" |
146 | sage " pcylinder cyl 2 300" |
147 | sage " trotate cyl cyl 0 0 0 1 0 0 45" |
148 | sage " ttranslate cyl cyl 0 7.5 0" |
149 | sage " " |
150 | pcylinder cyl 2 30 |
151 | vdisplay cyl |
152 | vsetcolor cyl RED |
153 | vfit |
154 | trotate cyl cyl 0 0 0 1 0 0 45 |
155 | ttranslate cyl cyl 0 7.5 0 |
156 | vdisplay cyl |
157 | vsetcolor cyl RED |
158 | vfit |
159 | vdisplay cyl |
160 | vsetcolor cyl RED |
161 | vfit |
162 | sage "Demo completed" |