0024428: Implementation of LGPL license
[occt.git] / samples / tcl / ModelingDemo.tcl
CommitLineData
b311480e 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
03392dd2 18# Command to log a message to both command-line and dialog window
7fd59977 19proc sage { a} {
03392dd2 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
7fd59977 36}
37
03392dd2 38pload MODELING
7fd59977 39
40smallview
41if { [winfo exists .h ] } {
42 destroy .h
43}
44sage " Creating a box"
45sage " box b -10 -10 -10 20 20 20"
46sage " "
47box b -10 -10 -10 20 20 20
48fit
49nexplode b f
50erase b
51sage " Draft of two lateral faces "
52sage " depouille r b 0 0 -1 b_6 -15 10 -10 10 0 0 -1 "
53sage " nexplode r f"
54sage " depouille rr r 0 0 -1 r_1 -15 -10 -10 10 0 0 -1 "
55sage " "
56depouille r b 0 0 -1 b_6 -15 10 -10 10 0 0 -1
57clear
58nexplode r f
59depouille rr r 0 0 -1 r_1 -15 -10 -10 10 0 0 -1
60clear
61nexplode rr e
62sage " Fillet on four lateral edges, then on the top and bottom edges "
63sage " nexplode rr e"
64sage " blend result rr 3 rr_2 3 rr_3 3 rr_10 3 rr_11"
65sage " nexplode result e"
66sage " blend result result 2 result_11 3 result_12"
67sage " "
68blend result rr 3 rr_2 3 rr_3 3 rr_10 3 rr_11
69erase rr
70erase result
71nexplode result e
72blend result result 2 result_11 3 result_12
73clear
74nexplode result f
75sage " Creating a profile on the top face "
76sage " nexplode result f"
77sage " 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
78"
79sage " "
80profile 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
81sage " Creating a prism"
82sage " prism rr p 0 0 20"
83sage " "
84prism rr p 0 0 20
85fit
86sage " Fusion of this prism with the original part "
87sage " fuse result rr result"
88sage " "
89fuse result rr result
90donl result
91nexplode result f
92erase result
93fit
94
95sage " Opening the top face"
96sage " offsetshape r result -1 0.0001 result_17"
97sage " "
98
99nexplode result f
100offsetshape r result -1 0.0001 result_17
101sage " Creating a cylinder and positionning it"
102sage " pcylinder cyl 2 300"
103sage " trotate cyl cyl 0 0 0 1 0 0 45"
104sage " ttranslate cyl cyl 0 7.5 0"
105sage " "
106pcylinder cyl 2 30
107trotate cyl cyl 0 0 0 1 0 0 45
108ttranslate cyl cyl 0 7.5 0
109sage " Display the Shape on Hidden Line Mode "
110sage " hlr hid r"
111sage ""
112donl r
113hlr hid r
114sage " Display the Shape on HLR Mode "
115sage " hlr nohid r"
116sage " hlr hlr r"
117sage ""
118donl r
119hlr nohid r
120hlr hlr r
121sage "Demo completed"