0028599: Replacement of old Boolean operations with new ones in BRepProj_Projection...
[occt.git] / samples / tcl / bottle.tcl
CommitLineData
40093367 1# Script reproducing creation of bottle model as described in OCCT Tutorial
ab91ab6f 2#Category: Modeling
3#Title: OCCT Tutorial bottle shape
40093367 4
5pload MODELING VISUALIZATION
6
821edd22 7puts "Constructing bottle body..."
40093367 8
9# set basic dimensions
10dset height 70
11dset width 50
12dset thickness 30
13
14# construct base profile (half)
15vertex v1 -width/2 0 0
16vertex v2 -width/2 -thickness/4 0
17edge e1 v1 v2
18
19point p2 -width/2 -thickness/4 0
20point p3 0 -thickness/2 0
21point p4 width/2 -thickness/4 0
22catch {gcarc arc cir p2 p3 p4}
23mkedge e2 arc
24
25vertex v4 width/2 -thickness/4 0
26vertex v5 width/2 0 0
27edge e3 v4 v5
28
29wire w1 e1 e2 e3
30
31# complete profile by mirror and make a prism
32copy w1 w2
33tmirror w2 0 0 0 0 1 0
34
35wire w3 w1 w2
36mkplane f w3
37
38prism p f 0 0 height
39
40# fillet all edges
41explode p e
42blend b p thickness/12 p_1 thickness/12 p_2 thickness/12 p_3 thickness/12 p_4 thickness/12 p_5 thickness/12 p_6 thickness/12 p_7 thickness/12 p_8 thickness/12 p_9 thickness/12 p_10 thickness/12 p_11 thickness/12 p_12 thickness/12 p_13 thickness/12 p_14 thickness/12 p_15 thickness/12 p_16 thickness/12 p_17 thickness/12 p_18
43
44# neck dimensions
45dset neckradius thickness/4
46dset neckheight height/10
47
48# add neck
49pcylinder c neckradius neckheight
50ttranslate c 0 0 height
51
52bfuse f b c
53
54# make body hollow
55explode c f
56offsetshape body f -thickness/50 1.e-3 c_2
57
821edd22 58puts "Constructing threading..."
40093367 59
60# make two cylinders
61cylinder c1 0 0 height 0 0 1 neckradius*0.99
62cylinder c2 0 0 height 0 0 1 neckradius*1.05
63
64# define threading dimensions in parametric space
65dset major 2*pi
66dset minor neckheight/10
67
68# make parametric curves for threading
69ellipse el1 2*pi neckheight/2 2*pi neckheight/4 major minor
70ellipse el2 2*pi neckheight/2 2*pi neckheight/4 major minor/4
71
72trim arc1 el1 0 pi
73trim arc2 el2 0 pi
74
752dcvalue el1 0 x1 y1
762dcvalue el1 pi x2 y2
77
78line l x1 y1 x2-x1 y2-y1
79parameters l x2 y2 1.e-9 U
80trim s l 0 U
81
82# construct 3d edges and wires
83mkedge E1OnS1 arc1 c1 0 pi
84mkedge E2OnS1 s c1 0 U
85mkedge E1OnS2 arc2 c2 0 pi
86mkedge E2OnS2 s c2 0 U
87
88wire tw1 E1OnS1 E2OnS1
89wire tw2 E1OnS2 E2OnS2
90mkedgecurve tw1 1.e-5
91mkedgecurve tw2 1.e-5
92
93# build threading as solid
94thrusections -N thread 1 0 tw1 tw2
95
821edd22 96puts "Putting together and writing \"Open CASCADE\"..."
97
b514beda 98# define text
ac84fcf6 99text2brep text2d OpenCASCADE -font Times-Roman -height 8 -aspect bold -composite off
b514beda 100prism text text2d 0 0 2
101trotate text 0 0 0 0 1 0 90
102ttranslate text 24.75 -2 65
103
104# cut operation
821edd22 105bcut bodytext body text
7cb89917 106bop bodytext thread
107bopfuse bottle
821edd22 108
109puts "Showing result..."
40093367 110
111# display result
112vdisplay bottle
113vfit
114vsetdispmode 1
63fad07e 115vaspects -isoontriangulation 1