92ac0eb7 |
1 | # Creation of 2d drawing |
2 | |
031224c9 |
3 | #Category: Modeling |
4 | #Title: Snowflake - creation of 2d drawing |
92ac0eb7 |
5 | |
6 | pload MODELING AISV |
7 | |
031224c9 |
8 | puts "Generating sample drawing of snowflake..." |
9 | |
92ac0eb7 |
10 | # make circular elements |
11 | circle c11 5 5 0 5 |
12 | circle c12 5 5 0 3 |
13 | circle c21 18 7 0 7 |
14 | circle c22 18 7 0 5 |
15 | circle c31 28.5 5 0 5 |
16 | circle c32 28.5 5 0 3 |
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 |
21 | line l21 18 7 0 1 1 0 |
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 |
25 | trim l21 l21 5 7 |
26 | trim l22 l22 5 7 |
27 | trim l31 l31 3 5 |
28 | trim l32 l32 3 5 |
29 | line l1 -6 0 0 0.86602540378443864 0.5 0 |
30 | line l2 -6 1 0 1 0 0 |
31 | trim l1 l1 0 30 |
32 | trim l2 l2 0 45 |
33 | mkedge c11 c11 |
34 | mkedge c12 c12 |
35 | mkedge c21 c21 |
36 | mkedge c22 c22 |
37 | mkedge c31 c31 |
38 | mkedge c32 c32 |
39 | mkedge l21 l21 |
40 | mkedge l22 l22 |
41 | mkedge l31 l31 |
42 | mkedge l32 l32 |
43 | mkedge l1 l1 |
44 | mkedge l2 l2 |
45 | wire b11 c11 |
46 | wire b12 c12 |
47 | orientation b12 R |
48 | |
49 | # build one ray |
50 | plane p -6 0 0 0 0 1 |
51 | mkface f1 p b11 |
52 | add b12 f1 |
53 | wire b2 c21 l21 c22 l22 |
54 | mkface f2 p b2 |
55 | wire b3 c31 l31 c32 l32 |
56 | mkface f3 p b3 |
57 | prism f5 l1 -5 8.6602540378443864 0 |
58 | prism f4 l2 0 -1 0 |
59 | compound f1 f2 f3 bc |
60 | bfuse r bc f4 |
92ac0eb7 |
61 | bcut r r f5 |
92ac0eb7 |
62 | explode r e |
9526aa6a |
63 | wire w r_4 r_1 r_20 r_21 r_22 r_23 r_24 r_25 r_26 r_7 r_30 r_31 r_32 r_33 r_27 r_28 r_29 r_11 r_38 r_34 r_35 r_36 r_37 r_16 r_17 |
92ac0eb7 |
64 | tcopy w w1 |
65 | tmirror w1 -6 0 0 0 1 0 |
66 | wire w w w1 |
67 | mkface w p w |
4d4b43db |
68 | shape wsh Sh |
69 | add w wsh |
70 | renamevar wsh w |
92ac0eb7 |
71 | donly w |
72 | |
73 | # construct complete snowflake |
74 | tcopy w w1 |
75 | tcopy w w2 |
76 | tcopy w w3 |
77 | tcopy w w4 |
78 | tcopy w w5 |
79 | trotate w1 -6 0 0 0 0 1 60 |
80 | trotate w2 -6 0 0 0 0 1 120 |
81 | trotate w3 -6 0 0 0 0 1 180 |
82 | trotate w4 -6 0 0 0 0 1 240 |
83 | trotate w5 -6 0 0 0 0 1 300 |
84 | bfuse w w w1 |
85 | bfuse w w w2 |
86 | bfuse w w w3 |
87 | bfuse w w w4 |
88 | bfuse w w w5 |
89 | unifysamedom r w |
90 | |
91 | # keep only wires in compound |
92 | eval compound [explode r w] snowflake |
93 | tscale snowflake -6 0 0 1.5 |
94 | |
95 | # draw frame loosely following GOST 2.104-68 |
96 | polyline frame -100 -100 0 172 -100 0 172 100 0 -100 100 0 -100 -100 0 |
97 | polyline t1 52 -100 0 52 -45 0 172 -45 0 |
98 | polyline t2 52 -60 0 172 -60 0 |
99 | polyline t3 52 -85 0 172 -85 0 |
100 | polyline t4 122 -100 0 122 -60 0 |
101 | polyline t5 122 -80 0 172 -80 0 |
102 | polyline t6 122 -65 0 172 -65 0 |
103 | polyline t7 142 -80 0 142 -85 0 |
104 | polyline t8 137 -80 0 137 -60 0 |
105 | polyline t9 154 -80 0 154 -60 0 |
106 | compound frame t1 t2 t3 t4 t5 t6 t7 t8 t9 lines |
107 | |
108 | # add text |
ac84fcf6 |
109 | text2brep sample "SAMPLE" -font Arial -height 10 -pos 90 -55 0 -aspect bolditalic |
110 | text2brep occ "Open CASCADE" -font Times -height 6 -pos 125 -95 0 |
111 | text2brep name "Snowflake" -font Courier -height 7 -pos 65 -75 0 -aspect italic |
112 | text2brep material "Ice" -font Courier -height 7 -pos 75 -95 0 -aspect italic |
113 | text2brep sheets "Sheets 1" -font Courier -height 3.5 -pos 145 -83 0 -aspect italic |
114 | text2brep scale "Scale\n\n1:100" -font Courier -height 3.5 -pos 157 -63 0 -aspect italic -valign topfirstline |
115 | text2brep mass "Mass\n\n1 mg" -font Courier -height 3.5 -pos 140 -63 0 -aspect italic -valign topfirstline |
92ac0eb7 |
116 | eval compound [explode sample w] sample |
117 | eval compound [explode occ w] occ |
118 | eval compound [explode name w] name |
119 | eval compound [explode material w] material |
120 | eval compound [explode sheets w] sheets |
121 | eval compound [explode scale w] scale |
122 | eval compound [explode mass w] mass |
123 | compound sample occ name material sheets scale mass text |
124 | |
031224c9 |
125 | compound snowflake lines text drawing |
92ac0eb7 |
126 | |
127 | # display in 3d view |
128 | vinit Driver1/Viewer1/View1 w=1024 h=768 |
129 | vdisplay snowflake lines text |
63fad07e |
130 | vrenderparams -msaa 8 |
031224c9 |
131 | vsetcolor snowflake 0 0 0 |
132 | vsetcolor lines 0 0 0 |
133 | vsetcolor text 0 0 0 |
134 | vsetcolorbg 255 255 255 |
92ac0eb7 |
135 | vtop |
031224c9 |
136 | vfit |
137 | |
138 | # add dimension |
139 | explode snowflake v |
4d4b43db |
140 | vdimension length -length -shapes snowflake_64 snowflake_140 -plane xoy -value 0.001 -dispunits mm -showunits -flyout 70 -label above -color black -text 5 3d sh |
031224c9 |
141 | |
142 | if { [regexp HAVE_GL2PS [dversion]] } { |
143 | puts "You can use command vexport to generate PDF: vexport your_file_path.pdf" |
144 | } |