1 # Creation of 2d drawing
4 #Title: Snowflake - creation of 2d drawing
6 pload MODELING VISUALIZATION
8 puts "Generating sample drawing of snowflake..."
10 # make circular elements
17 trim c21 c21 pi/4 -pi/4
18 trim c22 c22 pi/4 -pi/4
19 trim c31 c31 pi/4 -pi/4
20 trim c32 c32 pi/4 -pi/4
22 line l22 18 7 0 1 -1 0
23 line l31 28.5 5 0 1 1 0
24 line l32 28.5 5 0 1 -1 0
29 line l1 -6 0 0 0.86602540378443864 0.5 0
53 wire b2 c21 l21 c22 l22
55 wire b3 c31 l31 c32 l32
57 prism f5 l1 -5 8.6602540378443864 0
63 tmirror r1 -6 0 0 0 1 0
68 # construct complete snowflake
74 trotate w1 -6 0 0 0 0 1 60
75 trotate w2 -6 0 0 0 0 1 120
76 trotate w3 -6 0 0 0 0 1 180
77 trotate w4 -6 0 0 0 0 1 240
78 trotate w5 -6 0 0 0 0 1 300
85 foreach f [explode w f] {add $f wsh}
89 # keep only wires in compound
90 eval compound [explode r w] snowflake
91 tscale snowflake -6 0 0 1.5
93 # draw frame loosely following GOST 2.104-68
94 polyline frame -100 -100 0 172 -100 0 172 100 0 -100 100 0 -100 -100 0
95 polyline t1 52 -100 0 52 -45 0 172 -45 0
96 polyline t2 52 -60 0 172 -60 0
97 polyline t3 52 -85 0 172 -85 0
98 polyline t4 122 -100 0 122 -60 0
99 polyline t5 122 -80 0 172 -80 0
100 polyline t6 122 -65 0 172 -65 0
101 polyline t7 142 -80 0 142 -85 0
102 polyline t8 137 -80 0 137 -60 0
103 polyline t9 154 -80 0 154 -60 0
104 compound frame t1 t2 t3 t4 t5 t6 t7 t8 t9 lines
107 text2brep sample "SAMPLE" -font Arial -height 10 -pos 90 -55 0 -aspect bolditalic
108 text2brep occ "Open CASCADE" -font Times -height 6 -pos 125 -95 0
109 text2brep name "Snowflake" -font Courier -height 7 -pos 65 -75 0 -aspect italic
110 text2brep material "Ice" -font Courier -height 7 -pos 75 -95 0 -aspect italic
111 text2brep sheets "Sheets 1" -font Courier -height 3.5 -pos 145 -83 0 -aspect italic
112 text2brep scale "Scale\n\n1:100" -font Courier -height 3.5 -pos 157 -63 0 -aspect italic -valign topfirstline
113 text2brep mass "Mass\n\n1 mg" -font Courier -height 3.5 -pos 140 -63 0 -aspect italic -valign topfirstline
114 eval compound [explode sample w] sample
115 eval compound [explode occ w] occ
116 eval compound [explode name w] name
117 eval compound [explode material w] material
118 eval compound [explode sheets w] sheets
119 eval compound [explode scale w] scale
120 eval compound [explode mass w] mass
121 compound sample occ name material sheets scale mass text
123 compound snowflake lines text drawing
124 bounding snowflake -save x1 y1 z1 x2 y2 z2
127 vinit Driver1/Viewer1/View1 w=1024 h=768
128 vdisplay snowflake lines text
129 vrenderparams -msaa 8
130 vsetcolor snowflake BLACK
131 vsetcolor lines BLACK
133 vbackground -color WHITE
138 # detect vertices extremal in X direction
139 plane f1 x1 0 0 1 0 0
140 plane f2 x2 0 0 1 0 0
143 bsection s1 snowflake f1
144 bsection s2 snowflake f2
145 # select only upper vertices (nearer to the upper bound)
148 plane fup 0 y2 0 0 1 0
150 for {set i 1} {$i <= 2} {incr i} {
152 for {set j 1} {$j <= 2} {incr j} {
153 distmini d s${i}_$j fup
154 set dist [dval d_val]
157 eval set v$i s${i}_$j
161 vdimension length -length -shapes $v1 $v2 -plane xoy -value 0.001 -dispunits mm -showunits -flyout 70 -label above -color black -text 5 3d sh