0026605: Possible array out of bounds read in Extrema_GExtPC.gxx
[occt.git] / samples / tcl / VisualizationDemo.tcl
CommitLineData
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 18proc 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
37if { [winfo exists .h ] } {
38 destroy .h
39}
40
03392dd2 41pload MODELING VISUALIZATION
42
7fd59977 43sage " Creating the V3D Viewer"
44sage " vinit"
45sage " "
46vinit
47vclear
48clear
49
50sage " Creating the Topological Viewer"
51sage " smallview"
52sage " "
53smallview
54sage " Creating a box"
55sage " box b -10 -10 -10 20 20 20"
56sage " "
57box b -10 -10 -10 20 20 20
58fit
59sage " Display the box in the V3D Viewer"
60sage " vdisplay b"
61sage " "
62vdisplay b
63vfit
64nexplode b f
65erase b
66sage " Draft of two lateral faces "
67sage " nexplode b f"
68sage " depouille r b 0 0 -1 b_6 -15 10 -10 10 0 0 -1 "
69sage " nexplode r f"
70sage " depouille rr r 0 0 -1 r_1 -15 -10 -10 10 0 0 -1 "
71sage " "
72depouille r b 0 0 -1 b_6 -15 10 -10 10 0 0 -1
73clear
74nexplode r f
75depouille rr r 0 0 -1 r_1 -15 -10 -10 10 0 0 -1
76clear
77nexplode rr e
78verase b
79vdisplay rr
80vfit
81sage " Fillet on four lateral edges, then on the top and bottom edges "
82sage " nexplode rr e"
83sage " blend result rr 3 rr_2 3 rr_3 3 rr_10 3 rr_11"
84sage " nexplode result e"
85sage " blend result result 2 result_11 3 result_12"
86sage " "
87blend result rr 3 rr_2 3 rr_3 3 rr_10 3 rr_11
88erase rr
89erase result
90nexplode result e
91blend result result 2 result_11 3 result_12
92clear
93nexplode result f
94verase rr
95vdisplay result
96vfit
97sage " Creating a profile on the top face "
98sage " nexplode result f"
99sage " 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"
101sage " "
102profile 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
103sage " Creating a prism"
104sage " prism rr p 0 0 20"
105sage " "
106prism rr p 0 0 20
107sage " Change some attributs : MATERIAL , TRANSPARENCY"
108sage " vsetmaterial rr PLASTIC"
109sage " vsetcolor rr RED"
110sage " vsettransparency result 0.5"
111sage " vsetdispmode 1"
112sage " "
113vdisplay rr
114vsetmaterial rr PLASTIC
115vsettransparency rr 0.5
116vsetcolor rr RED
117vsettransparency result 0.5
118vsetdispmode 1
119vfit
120fit
121sage " Fusion of this prism with the original part "
122sage " fuse result rr result"
123sage " "
124fuse result rr result
125donl result
126vdisplay result
127vdonly result
128vfit
129nexplode result f
130erase result
131fit
132
133sage " Opening the top face"
134sage " offsetshape r result -1 0.0001 result_17"
135sage " "
136nexplode result f
137
138offsetshape r result -1 0.0001 result_17
139vdisplay r
140vdonly r
141vfit
142vsetcolor r MATRABLUE
143vsettransparency r 0
144
145sage " Creating a cylinder and positionning it"
146sage " pcylinder cyl 2 300"
147sage " trotate cyl cyl 0 0 0 1 0 0 45"
148sage " ttranslate cyl cyl 0 7.5 0"
149sage " "
150pcylinder cyl 2 30
151vdisplay cyl
152vsetcolor cyl RED
153vfit
154trotate cyl cyl 0 0 0 1 0 0 45
155ttranslate cyl cyl 0 7.5 0
156vdisplay cyl
157vsetcolor cyl RED
158vfit
159vdisplay cyl
160vsetcolor cyl RED
161vfit
162sage "Demo completed"