1 # ##### BEGIN GPL LICENSE BLOCK #####
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 # ##### END GPL LICENSE BLOCK #####
21 # ----------------------------------------------------------
22 # Automatic generation of curtains
23 # Author: Antonio Vazquez (antonioya)
25 # ----------------------------------------------------------
26 # noinspection PyUnresolvedReferences
29 from math
import cos
, sin
, radians
30 from bpy
.types
import Operator
31 from .achm_tools
import *
34 # ------------------------------------------------------------------
37 # ------------------------------------------------------------------
38 class AchmJapan(Operator
):
39 bl_idname
= "mesh.archimesh_japan"
40 bl_label
= "Japanese curtains"
41 bl_description
= "Japanese curtains Generator"
42 bl_category
= 'Archimesh'
43 bl_options
= {'REGISTER', 'UNDO'}
45 width
= bpy
.props
.FloatProperty(
47 min=0.30, max=4, default
=1, precision
=3,
48 description
='Total width',
50 height
= bpy
.props
.FloatProperty(
52 min=0.20, max=50, default
=1.8, precision
=3,
53 description
='Total height',
55 num
= bpy
.props
.IntProperty(
57 min=2, max=5, default
=2,
58 description
='Number total of rails',
60 palnum
= bpy
.props
.IntProperty(
62 min=1, max=2, default
=1,
63 description
='Panels by rail',
66 open01
= bpy
.props
.FloatProperty(
68 min=0, max=1, default
=0, precision
=3,
69 description
='Position of the panel',
71 open02
= bpy
.props
.FloatProperty(
73 min=0, max=1, default
=0, precision
=3,
74 description
='Position of the panel',
76 open03
= bpy
.props
.FloatProperty(
78 min=0, max=1, default
=0, precision
=3,
79 description
='Position of the panel',
81 open04
= bpy
.props
.FloatProperty(
83 min=0, max=1, default
=0, precision
=3,
84 description
='Position of the panel',
86 open05
= bpy
.props
.FloatProperty(
88 min=0, max=1, default
=0, precision
=3,
89 description
='Position of the panel',
93 crt_mat
= bpy
.props
.BoolProperty(
94 name
="Create default Cycles materials",
95 description
="Create default materials for Cycles render",
99 # -----------------------------------------------------
100 # Draw (create UI interface)
101 # -----------------------------------------------------
102 # noinspection PyUnusedLocal
103 def draw(self
, context
):
105 space
= bpy
.context
.space_data
106 if not space
.local_view
:
107 # Imperial units warning
108 if bpy
.context
.scene
.unit_settings
.system
== "IMPERIAL":
110 row
.label("Warning: Imperial units not supported", icon
='COLOR_RED')
114 row
.prop(self
, 'width')
115 row
.prop(self
, 'height')
117 row
.prop(self
, 'num')
118 row
.prop(self
, 'palnum')
122 row
.prop(self
, 'open01', slider
=True)
125 row
.prop(self
, 'open02', slider
=True)
128 row
.prop(self
, 'open03', slider
=True)
131 row
.prop(self
, 'open04', slider
=True)
134 row
.prop(self
, 'open05', slider
=True)
137 if not context
.scene
.render
.engine
== 'CYCLES':
139 box
.prop(self
, 'crt_mat')
141 box
.label("* Remember to verify fabric texture folder")
144 row
.label("Warning: Operator does not work in local view mode", icon
='ERROR')
146 # -----------------------------------------------------
148 # -----------------------------------------------------
149 # noinspection PyUnusedLocal
150 def execute(self
, context
):
151 if bpy
.context
.mode
== "OBJECT":
152 create_japan_mesh(self
)
155 self
.report({'WARNING'}, "Archimesh: Option only valid in Object mode")
159 # ------------------------------------------------------------------------------
161 # All custom values are passed using self container (self.myvariable)
162 # ------------------------------------------------------------------------------
163 def create_japan_mesh(self
):
165 for o
in bpy
.data
.objects
:
168 bpy
.ops
.object.select_all(False)
175 # ------------------------------------------------------------------
178 # ------------------------------------------------------------------
179 class AchmRoller(Operator
):
180 bl_idname
= "mesh.archimesh_roller"
181 bl_label
= "Roller curtains"
182 bl_description
= "Roller_curtains Generator"
183 bl_category
= 'Archimesh'
184 bl_options
= {'REGISTER', 'UNDO'}
186 width
= bpy
.props
.FloatProperty(
188 min=0.30, max=4, default
=1, precision
=3,
189 description
='Total width',
191 height
= bpy
.props
.FloatProperty(
193 min=0.01, max=50, default
=1.7, precision
=3,
194 description
='Total height',
198 crt_mat
= bpy
.props
.BoolProperty(
199 name
="Create default Cycles materials",
200 description
="Create default materials for Cycles render",
204 # -----------------------------------------------------
205 # Draw (create UI interface)
206 # -----------------------------------------------------
207 # noinspection PyUnusedLocal
208 def draw(self
, context
):
210 space
= bpy
.context
.space_data
211 if not space
.local_view
:
212 # Imperial units warning
213 if bpy
.context
.scene
.unit_settings
.system
== "IMPERIAL":
215 row
.label("Warning: Imperial units not supported", icon
='COLOR_RED')
219 row
.prop(self
, 'width')
220 row
.prop(self
, 'height')
223 if not context
.scene
.render
.engine
== 'CYCLES':
225 box
.prop(self
, 'crt_mat')
227 box
.label("* Remember to verify fabric texture folder")
230 row
.label("Warning: Operator does not work in local view mode", icon
='ERROR')
232 # -----------------------------------------------------
234 # -----------------------------------------------------
235 # noinspection PyUnusedLocal
236 def execute(self
, context
):
237 if bpy
.context
.mode
== "OBJECT":
238 create_roller_mesh(self
)
241 self
.report({'WARNING'}, "Archimesh: Option only valid in Object mode")
245 # ------------------------------------------------------------------------------
247 # All custom values are passed using self container (self.myvariable)
248 # ------------------------------------------------------------------------------
249 def create_roller_mesh(self
):
251 for o
in bpy
.data
.objects
:
254 bpy
.ops
.object.select_all(False)
255 generate_roller(self
)
260 # ------------------------------------------------------------------------------
261 # Generate japanese curtains
262 # All custom values are passed using self container (self.myvariable)
263 # ------------------------------------------------------------------------------
264 def generate_japan(self
):
268 location
= bpy
.context
.scene
.cursor_location
269 myloc
= copy(location
) # copy location to keep 3D cursor position
274 myrail
= create_japan_rail("Rail",
275 self
.width
- 0.02, self
.num
,
276 myloc
.x
, myloc
.y
, myloc
.z
,
279 remove_doubles(myrail
)
282 # --------------------------------------------------------------------------------
284 # --------------------------------------------------------------------------------
285 width
= (self
.width
/ self
.num
) / self
.palnum
290 for x
in range(self
.num
):
291 mysup
= create_japan_support("Support_" + str(x
) + ".L",
292 width
- 0.02, # subtract 2 cm
295 support
.extend([mysup
])
296 mysup
.parent
= myrail
310 maxpos
= ((self
.width
/ self
.palnum
) - width
- 0.02) * f
312 maxpos
= ((self
.width
/ self
.palnum
) - width
) * f
314 mysup
.location
.x
= posx
+ maxpos
315 mysup
.location
.y
= -posy
316 mysup
.location
.z
= posz
321 posx
= self
.width
- width
# + 0.01
324 for x
in range(self
.num
):
325 mysup
= create_japan_support("Support_" + str(x
) + ".R",
326 width
- 0.02, # subtract 2 cm
329 support
.extend([mysup
])
330 mysup
.parent
= myrail
343 maxpos
= ((self
.width
/ self
.palnum
) - width
) * f
345 mysup
.location
.x
= posx
- maxpos
346 mysup
.location
.y
= -posy
347 mysup
.location
.z
= posz
350 # --------------------------------------------------------------------------------
352 # --------------------------------------------------------------------------------
353 width
= ((self
.width
/ self
.num
) / self
.palnum
) + 0.01
359 if self
.crt_mat
and bpy
.context
.scene
.render
.engine
== 'CYCLES':
360 fabricmat
= create_fabric_material("Fabric_material", False, 0.653, 0.485, 0.265,
364 mypanel
= create_japan_panel("Panel_" + str(x
),
367 self
.crt_mat
, fabricmat
)
368 panel
.extend([mypanel
])
370 mypanel
.location
.x
= posx
371 mypanel
.location
.y
= posy
372 mypanel
.location
.z
= posz
374 # ------------------------
376 # ------------------------
377 x
= myrail
.location
.x
378 y
= myrail
.location
.y
379 z
= myrail
.location
.z
385 myp
= [((0, 0, 0), (- 0.25, 0, 0), (0.0, 0, 0)),
386 ((0, 0, long), (- 0.01, 0, long), (0.25, 0, long))] # double element
387 mycurve1
= create_bezier("String_1", myp
, (x
, y
, z
))
388 mycurve1
.parent
= myrail
389 mycurve1
.location
.x
= self
.width
390 mycurve1
.location
.y
= -0.004
391 mycurve1
.location
.z
= 0.005
393 mycurve2
= create_bezier("String_2", myp
, (x
, y
, z
))
394 mycurve2
.parent
= myrail
395 mycurve2
.location
.x
= self
.width
396 mycurve2
.location
.y
= -0.01
397 mycurve2
.location
.z
= 0.005
399 if self
.crt_mat
and bpy
.context
.scene
.render
.engine
== 'CYCLES':
400 mat
= create_diffuse_material("String_material", False, 0.1, 0.1, 0.1,
402 set_material(mycurve1
, mat
)
403 set_material(mycurve2
, mat
)
411 for o
in bpy
.data
.objects
:
416 bpy
.context
.scene
.objects
.active
= myrail
421 # ------------------------------------------------------------------------------
424 # objName: Name for the new object
426 # ways: Number of ways
427 # pX: position X axis
428 # pY: position Y axis
429 # pZ: position Z axis
430 # mat: Flag for creating materials
431 # ------------------------------------------------------------------------------
432 def create_japan_rail(objname
, sx
, ways
, px
, py
, pz
, mat
):
436 waysize
= 0.005 # gap
441 sy
= (size
* 2) + (waysize
* ways
) + (sizeint
* (ways
- 1))
444 myvertex
.extend([(0, 0, 0), (0, 0, sz
), (0, -sy
, sz
), (0, -sy
, 0),
445 (tap
, 0, 0), (tap
, 0, sz
), (tap
, -sy
, sz
), (tap
, -sy
, 0)])
446 myfaces
.extend([(0, 1, 2, 3), (4, 5, 6, 7), (0, 1, 5, 4), (3, 2, 6, 7), (2, 1, 5, 6), (3, 0, 4, 7)])
449 myvertex
.extend([(tap
, -size
, size
), (tap
, -size
, 0), (tap
, 0, 0), (tap
, 0, sz
), (tap
, -sy
, sz
), (tap
, -sy
, 0),
450 (tap
, -sy
+ size
, 0), (tap
, -sy
+ size
, sz
- 0.002)])
451 myvertex
.extend([(sx
+ tap
, -size
, size
), (sx
+ tap
, -size
, 0), (sx
+ tap
, 0, 0),
452 (sx
+ tap
, 0, sz
), (sx
+ tap
, -sy
, sz
),
453 (sx
+ tap
, -sy
, 0), (sx
+ tap
, -sy
+ size
, 0), (sx
+ tap
, -sy
+ size
, sz
- 0.002)])
454 myfaces
.extend([(v
, v
+ 8, v
+ 9, v
+ 1), (v
+ 1, v
+ 9, v
+ 10, v
+ 2), (v
+ 2, v
+ 10, v
+ 11, v
+ 3),
455 (v
+ 3, v
+ 11, v
+ 12, v
+ 4),
456 (v
+ 4, v
+ 12, v
+ 13, v
+ 5), (v
+ 5, v
+ 13, v
+ 14, v
+ 6), (v
+ 7, v
+ 15, v
+ 14, v
+ 6)])
459 myvertex
.extend([(sx
+ tap
, 0, 0), (sx
+ tap
, 0, sz
), (sx
+ tap
, -sy
, sz
),
460 (sx
+ tap
, -sy
, 0), (sx
+ tap
+ tap
, 0, 0),
461 (sx
+ tap
+ tap
, 0, sz
), (sx
+ tap
+ tap
, -sy
, sz
), (sx
+ tap
+ tap
, -sy
, 0)])
462 myfaces
.extend([(v
, v
+ 1, v
+ 2, v
+ 3), (v
+ 4, v
+ 5, v
+ 6, v
+ 7),
463 (v
, v
+ 1, v
+ 5, v
+ 4), (v
+ 3, v
+ 2, v
+ 6, v
+ 7),
464 (v
+ 2, v
+ 1, v
+ 5, v
+ 6), (v
+ 3, v
, v
+ 4, v
+ 7)])
468 space
= waysize
+ size
470 for x
in range(ways
- 1):
471 myvertex
.extend([(tap
, -space
, sz
), (tap
, -space
, 0), (tap
, -space
- sizeint
, 0),
472 (tap
, -space
- sizeint
, size
)])
473 myvertex
.extend([(sx
+ tap
, -space
, sz
), (sx
+ tap
, -space
, 0), (sx
+ tap
, -space
- sizeint
, 0),
474 (sx
+ tap
, -space
- sizeint
, size
)])
475 myfaces
.extend([(v
, v
+ 4, v
+ 5, v
+ 1), (v
+ 1, v
+ 5, v
+ 6, v
+ 2), (v
+ 2, v
+ 6, v
+ 7, v
+ 3)])
477 space
= space
+ waysize
+ sizeint
479 mymesh
= bpy
.data
.meshes
.new(objname
)
480 myobject
= bpy
.data
.objects
.new(objname
, mymesh
)
482 myobject
.location
[0] = px
483 myobject
.location
[1] = py
484 myobject
.location
[2] = pz
485 bpy
.context
.scene
.objects
.link(myobject
)
487 mymesh
.from_pydata(myvertex
, [], myfaces
)
488 mymesh
.update(calc_edges
=True)
490 # ---------------------------------
492 # ---------------------------------
493 if mat
and bpy
.context
.scene
.render
.engine
== 'CYCLES':
495 mat
= create_diffuse_material(objname
+ "_material", False, 0.8, 0.8, 0.8, 0.6, 0.6, 0.6, 0.15)
496 set_material(myobject
, mat
)
501 # ------------------------------------------------------------------------------
502 # Create japan support
504 # objName: Name for the new object
506 # pX: position X axis
507 # pY: position Y axis
508 # pZ: position Z axis
509 # mat: Flag for creating materials
510 # ------------------------------------------------------------------------------
511 def create_japan_support(objname
, sx
, px
, py
, pz
, mat
):
519 myvertex
.extend([(0, 0, 0), (0, 0, -sz
), (0, -sy
, -sz
), (0, -sy
, -waysize
), (0, -0.003, -waysize
), (0, -0.003, 0)])
521 [(sx
, 0, 0), (sx
, 0, -sz
), (sx
, -sy
, -sz
), (sx
, -sy
, - waysize
), (sx
, -0.003, -waysize
), (sx
, -0.003, 0)])
523 [(0, 1, 7, 6), (2, 3, 9, 8), (1, 7, 8, 2), (3, 4, 10, 9), (4, 5, 11, 10), (0, 6, 11, 5), (0, 1, 2, 3, 4, 5),
524 (6, 7, 8, 9, 10, 11)])
526 mymesh
= bpy
.data
.meshes
.new(objname
)
527 myobject
= bpy
.data
.objects
.new(objname
, mymesh
)
529 myobject
.location
[0] = px
530 myobject
.location
[1] = py
531 myobject
.location
[2] = pz
532 bpy
.context
.scene
.objects
.link(myobject
)
534 mymesh
.from_pydata(myvertex
, [], myfaces
)
535 mymesh
.update(calc_edges
=True)
537 # ---------------------------------
539 # ---------------------------------
540 if mat
and bpy
.context
.scene
.render
.engine
== 'CYCLES':
542 mat
= create_diffuse_material(objname
+ "_material", False, 0.8, 0.8, 0.8, 0.6, 0.6, 0.6, 0.15)
543 set_material(myobject
, mat
)
548 # ------------------------------------------------------------------------------
551 # objName: Name for the new object
554 # pX: position X axis
555 # pY: position Y axis
556 # pZ: position Z axis
557 # mat: Flag for creating materials
558 # fabricMat: Fabric material
559 # ------------------------------------------------------------------------------
560 def create_japan_panel(objname
, sx
, sz
, px
, py
, pz
, mat
, fabricmat
):
564 myvertex
.extend([(0, 0, 0), (0, 0, -sz
), (sx
, 0, -sz
), (sx
, 0, 0)])
565 myfaces
.extend([(0, 1, 2, 3)])
567 mymesh
= bpy
.data
.meshes
.new(objname
)
568 myobject
= bpy
.data
.objects
.new(objname
, mymesh
)
570 myobject
.location
[0] = px
571 myobject
.location
[1] = py
572 myobject
.location
[2] = pz
573 bpy
.context
.scene
.objects
.link(myobject
)
575 mymesh
.from_pydata(myvertex
, [], myfaces
)
576 mymesh
.update(calc_edges
=True)
578 # ---------------------------------
580 # ---------------------------------
581 if mat
and bpy
.context
.scene
.render
.engine
== 'CYCLES':
582 unwrap_mesh(myobject
, True)
583 # remap UV to use all texture
584 for uv_loop
in myobject
.data
.uv_layers
.active
.data
:
585 myvector
= uv_loop
.uv
586 if myvector
.x
> 0.0001:
589 set_material(myobject
, fabricmat
)
593 # ------------------------------------------------------------------------------
594 # Create bezier curve
595 # ------------------------------------------------------------------------------
596 def create_bezier(objname
, points
, origin
, depth
=0.001, fill
='FULL'):
597 curvedata
= bpy
.data
.curves
.new(name
=objname
, type='CURVE')
598 curvedata
.dimensions
= '3D'
599 curvedata
.fill_mode
= fill
600 curvedata
.bevel_resolution
= 5
601 curvedata
.bevel_depth
= depth
603 myobject
= bpy
.data
.objects
.new(objname
, curvedata
)
604 myobject
.location
= origin
606 bpy
.context
.scene
.objects
.link(myobject
)
608 polyline
= curvedata
.splines
.new('BEZIER')
609 polyline
.bezier_points
.add(len(points
) - 1)
611 for idx
, (knot
, h1
, h2
) in enumerate(points
):
612 point
= polyline
.bezier_points
[idx
]
614 point
.handle_left
= h1
615 point
.handle_right
= h2
616 point
.handle_left_type
= 'FREE'
617 point
.handle_right_type
= 'FREE'
622 # ------------------------------------------------------------------------------
623 # Generate Roller curtains
624 # All custom values are passed using self container (self.myvariable)
625 # ------------------------------------------------------------------------------
626 def generate_roller(self
):
627 location
= bpy
.context
.scene
.cursor_location
628 myloc
= copy(location
) # copy location to keep 3D cursor position
634 if self
.crt_mat
and bpy
.context
.scene
.render
.engine
== 'CYCLES':
635 fabricsolid
= create_diffuse_material("Fabric_solid_material", False, 0.653, 0.485, 0.265)
637 myroller
= create_roller_rail("Roller",
640 myloc
.x
, myloc
.y
, myloc
.z
,
641 self
.crt_mat
, fabricsolid
)
643 remove_doubles(myroller
)
644 set_normals(myroller
)
646 # --------------------------------------------------------------------------------
648 # --------------------------------------------------------------------------------
650 if self
.crt_mat
and bpy
.context
.scene
.render
.engine
== 'CYCLES':
651 plastic
= create_diffuse_material("Plastic_roller_material", False, 0.653, 0.485, 0.265, 0.653, 0.485, 0.265,
654 myside_l
= create_roller_sides(myroller
, "L",
656 self
.crt_mat
, plastic
)
658 remove_doubles(myside_l
)
659 set_normals(myside_l
)
661 myside_r
= create_roller_sides(myroller
, "R",
662 self
.width
- 0.026, 0, 0,
663 self
.crt_mat
, plastic
)
665 remove_doubles(myside_r
)
666 set_normals(myside_r
)
668 # --------------------------------------------------------------------------------
670 # --------------------------------------------------------------------------------
672 if self
.crt_mat
and bpy
.context
.scene
.render
.engine
== 'CYCLES':
673 fabricmat
= create_fabric_material("Fabric_translucent_material", False, 0.653, 0.485, 0.265, 0.653, 0.485,
676 mypanel
= create_japan_panel("Panel",
677 self
.width
, self
.height
,
679 self
.crt_mat
, fabricmat
)
680 mypanel
.parent
= myroller
681 mypanel
.location
.x
= 0
682 mypanel
.location
.y
= 0.035
683 mypanel
.location
.z
= 0
687 mybottom
= create_roller_rail("Roller_bottom",
691 self
.crt_mat
, plastic
)
692 mybottom
.parent
= mypanel
694 remove_doubles(myroller
)
695 set_normals(myroller
)
697 # ------------------------
699 # ------------------------
700 myp
= [((0.0000, -0.0328, -0.0000), (0.0000, -0.0403, -0.3327), (0.0000, -0.0293, 0.1528)),
701 ((0.0000, 0.0000, 0.3900), (0.0000, -0.0264, 0.3900), (-0.0000, 0.0226, 0.3900)),
702 ((-0.0000, 0.0212, 0.0000), (-0.0000, 0.0189, 0.1525), (-0.0000, 0.0260, -0.3326)),
703 ((-0.0000, -0.0000, -0.8518), (-0.0000, 0.0369, -0.8391), (0.0000, -0.0373, -0.8646))] # double element
704 mycurve
= create_bezier("String", myp
, (0, 0, 0))
705 set_curve_cycle(mycurve
)
706 mycurve
.parent
= myroller
707 mycurve
.location
.x
= self
.width
+ 0.015
708 mycurve
.location
.y
= 0
709 mycurve
.location
.z
= -0.38
710 if self
.crt_mat
and bpy
.context
.scene
.render
.engine
== 'CYCLES':
711 mat
= create_diffuse_material("String_material", False, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.01)
712 set_material(mycurve
, mat
)
715 for o
in bpy
.data
.objects
:
719 myroller
.select
= True
720 bpy
.context
.scene
.objects
.active
= myroller
725 # ------------------------------------------------------------------------------
728 # objName: Object name
729 # width: Total width of roller
731 # pX: position X axis
732 # pY: position Y axis
733 # pZ: position Z axis
734 # mat: create default cycles material
735 # mymaterial: plastic material or fabric
736 # ------------------------------------------------------------------------------
737 def create_roller_rail(objname
, width
, radio
, px
, py
, pz
, mat
, mymaterial
):
744 for i
in range(pies
):
745 x
= cos(radians(seg
)) * radio
746 y
= sin(radians(seg
)) * radio
747 mypoint
= [(0.0, x
, y
)]
748 myvertex
.extend(mypoint
)
752 for i
in range(pies
):
753 x
= cos(radians(seg
)) * radio
754 y
= sin(radians(seg
)) * radio
755 mypoint
= [(width
, x
, y
)]
756 myvertex
.extend(mypoint
)
758 # -------------------------------------
760 # -------------------------------------
762 for n
in range(0, pies
):
766 myface
= [(n
, n
- pies
+ 1, n
+ 1, n
+ pies
)]
767 myfaces
.extend(myface
)
769 myface
= [(n
, n
+ 1, n
+ pies
+ 1, n
+ pies
)]
770 myfaces
.extend(myface
)
772 mymesh
= bpy
.data
.meshes
.new(objname
)
773 myroll
= bpy
.data
.objects
.new(objname
, mymesh
)
774 bpy
.context
.scene
.objects
.link(myroll
)
776 mymesh
.from_pydata(myvertex
, [], myfaces
)
777 mymesh
.update(calc_edges
=True)
779 myroll
.location
.x
= px
780 myroll
.location
.y
= py
781 myroll
.location
.z
= pz
784 if mat
and bpy
.context
.scene
.render
.engine
== 'CYCLES':
785 set_material(myroll
, mymaterial
)
793 # ------------------------------------------------------------------------------
794 # Create roller sides
796 # myRoller: Roller to add sides
797 # side: Side of the cap R/L
798 # pX: position X axis
799 # pY: position Y axis
800 # pZ: position Z axis
801 # mat: create default cycles material
802 # plastic: plastic material
803 # ------------------------------------------------------------------------------
804 def create_roller_sides(myroller
, side
, px
, py
, pz
, mat
, plastic
):
806 mydata
= roller_side()
812 mymesh
= bpy
.data
.meshes
.new("Side." + side
)
813 myside
= bpy
.data
.objects
.new("Side." + side
, mymesh
)
814 bpy
.context
.scene
.objects
.link(myside
)
815 mymesh
.from_pydata(myvertex
, [], myfaces
)
816 mymesh
.update(calc_edges
=True)
818 myside
.location
.x
= px
819 myside
.location
.y
= py
820 myside
.location
.z
= pz
823 myside
.rotation_euler
= (0, 0, radians(180))
825 myside
.parent
= myroller
828 if mat
and bpy
.context
.scene
.render
.engine
== 'CYCLES':
829 set_material(myside
, plastic
)
833 set_modifier_subsurf(myside
)
838 # ----------------------------------------------
840 # ----------------------------------------------
842 # ------------------------------------
844 # ------------------------------------
845 minx
= -7.54842304218073e-08
846 maxx
= 0.05209559202194214
847 miny
= -0.04486268758773804
848 maxy
= 0.04486268758773804
849 minz
= -0.04486268758773804
850 maxz
= 0.08202265202999115
853 myvertex
= [(maxx
- 0.004684023559093475, maxy
, minz
+ 0.04486270064847542),
854 (maxx
- 0.004684023559093475, maxy
- 0.0034149661660194397, minz
+ 0.027694489806890488),
855 (maxx
- 0.004684023559093475, maxy
- 0.013139978051185608, minz
+ 0.013139985501766205),
856 (maxx
- 0.004684023559093475, maxy
- 0.02769448049366474, minz
+ 0.0034149736166000366),
857 (maxx
- 0.004684023559093475, miny
+ 0.044862685327428764, minz
),
858 (maxx
- 0.004684023559093475, miny
+ 0.027694476768374443, minz
+ 0.0034149736166000366),
859 (maxx
- 0.004684023559093475, miny
+ 0.013139978051185608, minz
+ 0.013139985501766205),
860 (maxx
- 0.004684023559093475, miny
+ 0.0034149661660194397, minz
+ 0.02769448794424534),
861 (maxx
- 0.004684023559093475, miny
, minz
+ 0.04486269387439812),
862 (maxx
- 0.004684023559093475, miny
+ 0.0034149624407291412, minz
+ 0.06203090213239193),
863 (maxx
- 0.004684023559093475, miny
+ 0.013139966875314713, maxz
- 0.050299935042858124),
864 (maxx
- 0.004684023559093475, miny
+ 0.027694474905729294, maxz
- 0.04057491198182106),
865 (maxx
- 0.004684023559093475, maxy
- 0.027694473043084145, maxz
- 0.04057491570711136),
866 (maxx
- 0.004684023559093475, maxy
- 0.013139966875314713, maxz
- 0.05029993876814842),
867 (maxx
- 0.004684023559093475, maxy
- 0.0034149587154388428, minz
+ 0.062030890956521034),
868 (maxx
- 0.0046574510633945465, miny
+ 0.028278490528464317, minz
+ 0.0048249028623104095),
869 (maxx
- 0.0046574510633945465, miny
+ 0.014219092205166817, minz
+ 0.014219097793102264),
870 (maxx
- 0.0046574510633945465, miny
+ 0.004824899137020111, minz
+ 0.028278499841690063),
871 (maxx
- 0.003122705966234207, maxy
, minz
+ 0.04486270064847542),
872 (maxx
- 0.003122705966234207, maxy
- 0.0034149661660194397, minz
+ 0.027694489806890488),
873 (maxx
- 0.003122705966234207, maxy
- 0.013139978051185608, minz
+ 0.013139985501766205),
874 (maxx
- 0.003122705966234207, maxy
- 0.02769448049366474, minz
+ 0.0034149736166000366),
875 (maxx
- 0.003149278461933136, maxy
- 0.04486268735455812, maxz
- 0.03868604078888893),
876 (maxx
- 0.003149278461933136, maxy
- 0.02827848680317402, maxz
- 0.04198484495282173),
877 (maxx
- 0.003149278461933136, maxy
- 0.014219081029295921, maxz
- 0.05137905105948448),
878 (maxx
- 0.003149278461933136, maxy
- 0.004824887961149216, minz
+ 0.06144687905907631),
879 (maxx
- 0.02118653617799282, miny
+ 0.027694474905729294, maxz
- 0.04057491570711136),
880 (maxx
- 0.02118653617799282, miny
+ 0.013139966875314713, maxz
- 0.050299935042858124),
881 (maxx
- 0.02118653617799282, miny
+ 0.0034149624407291412, minz
+ 0.06203090213239193),
882 (maxx
- 0.02118653617799282, miny
, minz
+ 0.04486269262849252),
883 (maxx
- 0.003122705966234207, miny
, minz
+ 0.04486269387439812),
884 (maxx
- 0.003122705966234207, miny
+ 0.0034149624407291412, minz
+ 0.06203090213239193),
885 (maxx
- 0.003122705966234207, miny
+ 0.013139966875314713, maxz
- 0.050299935042858124),
886 (maxx
- 0.003122705966234207, miny
+ 0.027694474905729294, maxz
- 0.04057491198182106),
887 (maxx
- 0.02118653617799282, maxy
- 0.02769448049366474, minz
+ 0.0034149661660194397),
888 (maxx
- 0.02118653617799282, maxy
- 0.013139978051185608, minz
+ 0.013139981776475906),
889 (maxx
- 0.02118653617799282, maxy
- 0.0034149661660194397, minz
+ 0.02769448794424534),
890 (maxx
- 0.02118653617799282, maxy
, minz
+ 0.044862699402576034),
891 (maxx
- 0.020517520606517792, miny
+ 0.01146744191646576, minz
+ 0.03102993033826351),
892 (maxx
- 0.020517520606517792, miny
+ 0.01930307224392891, minz
+ 0.019303075969219208),
893 (maxx
- 0.020517520606517792, miny
+ 0.031029919162392616, minz
+ 0.01146744191646576),
894 (maxx
- 0.020517520606517792, miny
+ 0.04486268576937835, minz
+ 0.008715935051441193),
895 (maxx
- 0.003122705966234207, maxy
- 0.013139966875314713, maxz
- 0.02605174481868744),
896 (maxx
, miny
+ 0.013139966875314713, maxz
- 0.026319395750761032),
897 (maxx
, miny
+ 0.027694474905729294, maxz
- 0.026230186223983765),
898 (maxx
, maxy
- 0.013139966875314713, maxz
- 0.02605174481868744),
899 (maxx
- 0.0046574510633945465, miny
+ 0.0015261024236679077, minz
+ 0.04486269394558251),
900 (maxx
- 0.0046574510633945465, miny
+ 0.004824895411729813, minz
+ 0.061446888372302055),
901 (maxx
- 0.0046574510633945465, miny
+ 0.014219081029295921, maxz
- 0.05137904919683933),
902 (maxx
- 0.0046574510633945465, miny
+ 0.02827848680317402, maxz
- 0.04198484495282173),
903 (maxx
, maxy
- 0.027694473043084145, maxz
- 0.026230186223983765),
904 (maxx
, maxy
- 0.04486268735205459, maxz
- 0.02629481628537178),
905 (maxx
- 0.003122705966234207, maxy
- 0.027694473043084145, maxz
- 0.04057491570711136),
906 (maxx
- 0.003122705966234207, maxy
- 0.013139966875314713, maxz
- 0.05029993876814842),
907 (maxx
- 0.003122705966234207, maxy
- 0.0034149587154388428, minz
+ 0.062030890956521034),
908 (maxx
- 0.003149278461933136, maxy
- 0.0015261024236679077, minz
+ 0.044862700489230356),
909 (maxx
- 0.003149278461933136, maxy
- 0.004824899137020111, minz
+ 0.028278501704335213),
910 (maxx
- 0.003149278461933136, maxy
- 0.014219092205166817, minz
+ 0.014219097793102264),
911 (maxx
- 0.003149278461933136, maxy
- 0.028278492391109467, minz
+ 0.0048249028623104095),
912 (maxx
- 0.003149278461933136, miny
+ 0.0015261024236679077, minz
+ 0.04486269394558251),
913 (maxx
- 0.003149278461933136, miny
+ 0.004824895411729813, minz
+ 0.061446888372302055),
914 (maxx
- 0.003149278461933136, miny
+ 0.014219081029295921, maxz
- 0.05137904919683933),
915 (maxx
- 0.003149278461933136, miny
+ 0.02827848680317402, maxz
- 0.04198484495282173),
916 (maxx
- 0.02118653617799282, maxy
- 0.0034149587154388428, minz
+ 0.062030889093875885),
917 (maxx
- 0.02118653617799282, maxy
- 0.013139966875314713, maxz
- 0.05029993876814842),
918 (maxx
- 0.02118653617799282, maxy
- 0.027694473043084145, maxz
- 0.04057491570711136),
919 (maxx
- 0.02118653617799282, maxy
- 0.04486268735205459, maxz
- 0.03715994209051132),
920 (maxx
- 0.020517520606517792, maxy
- 0.011467430740594864, minz
+ 0.058695447631180286),
921 (maxx
- 0.020517520606517792, maxy
- 0.019303061068058014, maxz
- 0.05646303482353687),
922 (maxx
- 0.020517520606517792, maxy
- 0.031029915437102318, maxz
- 0.04862739145755768),
923 (maxx
- 0.020517520606517792, maxy
- 0.044862687395027134, maxz
- 0.045875877141952515),
924 (maxx
, miny
+ 0.0034149661660194397, minz
+ 0.02769448794424534),
925 (maxx
, miny
+ 0.013139978051185608, minz
+ 0.013139985501766205),
926 (maxx
, miny
+ 0.027694476768374443, minz
+ 0.0034149736166000366),
927 (maxx
, miny
+ 0.044862685327428764, minz
),
928 (maxx
- 0.02118653617799282, miny
+ 0.0034149661660194397, minz
+ 0.02769448794424534),
929 (maxx
- 0.02118653617799282, miny
+ 0.013139978051185608, minz
+ 0.013139981776475906),
930 (maxx
- 0.02118653617799282, miny
+ 0.027694476768374443, minz
+ 0.0034149661660194397),
931 (maxx
- 0.02118653617799282, miny
+ 0.044862685327428764, minz
),
932 (maxx
- 0.020517520606517792, maxy
- 0.031029922887682915, minz
+ 0.01146744191646576),
933 (maxx
- 0.020517520606517792, maxy
- 0.01930307224392891, minz
+ 0.019303075969219208),
934 (maxx
- 0.020517520606517792, maxy
- 0.01146744191646576, minz
+ 0.03102993033826351),
935 (maxx
- 0.020517520606517792, maxy
- 0.008715927600860596, minz
+ 0.04486269835125789),
936 (maxx
- 0.0046574510633945465, maxy
- 0.04486268735455812, maxz
- 0.03868604078888893),
937 (maxx
- 0.0046574510633945465, maxy
- 0.02827848680317402, maxz
- 0.04198484495282173),
938 (maxx
- 0.0046574510633945465, maxy
- 0.014219081029295921, maxz
- 0.05137905105948448),
939 (maxx
- 0.0046574510633945465, maxy
- 0.004824887961149216, minz
+ 0.06144687905907631),
940 (maxx
- 0.0046574510633945465, maxy
- 0.0015261024236679077, minz
+ 0.044862700489230356),
941 (maxx
- 0.0046574510633945465, maxy
- 0.004824899137020111, minz
+ 0.028278501704335213),
942 (maxx
- 0.0046574510633945465, maxy
- 0.014219092205166817, minz
+ 0.014219097793102264),
943 (maxx
- 0.0046574510633945465, maxy
- 0.028278492391109467, minz
+ 0.0048249028623104095),
944 (maxx
- 0.003149278461933136, miny
+ 0.004824899137020111, minz
+ 0.028278499841690063),
945 (maxx
- 0.003149278461933136, miny
+ 0.014219092205166817, minz
+ 0.014219097793102264),
946 (maxx
- 0.003149278461933136, miny
+ 0.028278490528464317, minz
+ 0.0048249028623104095),
947 (maxx
, miny
, minz
+ 0.04486269387439812),
948 (maxx
, miny
+ 0.0034149624407291412, minz
+ 0.06203090213239193),
949 (maxx
, miny
+ 0.013139966875314713, maxz
- 0.050299935042858124),
950 (maxx
, miny
+ 0.027694474905729294, maxz
- 0.04057491198182106),
951 (maxx
- 0.020517520606517792, miny
+ 0.031029917299747467, maxz
- 0.04862739145755768),
952 (maxx
- 0.020517520606517792, miny
+ 0.019303061068058014, maxz
- 0.056463029235601425),
953 (maxx
- 0.020517520606517792, miny
+ 0.011467434465885162, minz
+ 0.05869545880705118),
954 (maxx
- 0.020517520606517792, miny
+ 0.008715927600860596, minz
+ 0.04486269289324163),
955 (maxx
- 0.003122705966234207, miny
+ 0.0034149661660194397, minz
+ 0.02769448794424534),
956 (maxx
- 0.003122705966234207, miny
+ 0.013139978051185608, minz
+ 0.013139985501766205),
957 (maxx
- 0.003122705966234207, miny
+ 0.027694476768374443, minz
+ 0.0034149736166000366),
958 (maxx
- 0.003122705966234207, miny
+ 0.044862685327428764, minz
),
959 (maxx
, maxy
- 0.02769448049366474, minz
+ 0.0034149736166000366),
960 (maxx
, maxy
- 0.013139978051185608, minz
+ 0.013139985501766205),
961 (maxx
, maxy
- 0.0034149661660194397, minz
+ 0.027694489806890488),
962 (maxx
, maxy
, minz
+ 0.04486270064847542),
963 (maxx
, maxy
- 0.0034149587154388428, minz
+ 0.062030890956521034),
964 (maxx
, maxy
- 0.013139966875314713, maxz
- 0.05029993876814842),
965 (maxx
, maxy
- 0.027694473043084145, maxz
- 0.04057491570711136),
966 (maxx
, maxy
- 0.04486268735205459, maxz
- 0.03715994209051132),
967 (maxx
- 0.003122705966234207, maxy
- 0.027694473043084145, maxz
- 0.026230186223983765),
968 (maxx
- 0.003122705966234207, maxy
- 0.04486268735205459, maxz
- 0.02629481628537178),
969 (maxx
- 0.003122705966234207, miny
+ 0.027694474905729294, maxz
- 0.026230186223983765),
970 (maxx
- 0.003122705966234207, miny
+ 0.013139966875314713, maxz
- 0.026319395750761032),
971 (maxx
- 0.003122705966234207, miny
+ 0.013139966875314713, maxz
- 0.0018796995282173157),
972 (maxx
- 0.01466318964958191, miny
+ 0.013139966875314713, maxz
- 0.0018796995282173157),
973 (maxx
, miny
+ 0.027694474905729294, maxz
- 0.0017904937267303467),
974 (maxx
, maxy
- 0.013139966875314713, maxz
- 0.001612052321434021),
975 (maxx
- 0.009187713265419006, maxy
- 0.013139966875314713, maxz
- 0.02605174481868744),
976 (maxx
- 0.009187713265419006, maxy
- 0.027694473043084145, maxz
- 0.026230186223983765),
977 (maxx
- 0.009187713265419006, maxy
- 0.04486268735205459, maxz
- 0.02629481628537178),
978 (maxx
- 0.009187713265419006, miny
+ 0.027694474905729294, maxz
- 0.026230186223983765),
979 (maxx
- 0.009187713265419006, miny
+ 0.013139966875314713, maxz
- 0.026319395750761032),
980 (maxx
- 0.003122705966234207, maxy
- 0.013139966875314713, maxz
- 0.001612052321434021),
981 (maxx
- 0.01466318964958191, miny
+ 0.027694474905729294, maxz
- 0.0017904937267303467),
982 (maxx
, miny
+ 0.022660084068775177, minz
+ 0.03566607739776373),
983 (maxx
, miny
+ 0.02786955051124096, minz
+ 0.027869559824466705),
984 (maxx
, miny
+ 0.03566606715321541, minz
+ 0.022660093382000923),
985 (maxx
, miny
+ 0.04486268649608238, minz
+ 0.020830770954489708),
986 (maxx
, miny
+ 0.02083076350390911, minz
+ 0.044862694725740226),
987 (maxx
, miny
+ 0.022660082206130028, minz
+ 0.05405931267887354),
988 (maxx
, miny
+ 0.02786954492330551, minz
+ 0.061855828389525414),
989 (maxx
, miny
+ 0.035666066221892834, maxz
- 0.059820037335157394),
990 (maxx
, maxy
- 0.03566606715321541, minz
+ 0.022660093382000923),
991 (maxx
, maxy
- 0.02786955051124096, minz
+ 0.027869559824466705),
992 (maxx
, maxy
- 0.022660084068775177, minz
+ 0.035666078329086304),
993 (maxx
, maxy
- 0.02083076350390911, minz
+ 0.044862698354463326),
994 (maxx
, maxy
- 0.02266007848083973, minz
+ 0.05405930709093809),
995 (maxx
, maxy
- 0.02786954492330551, minz
+ 0.061855828389525414),
996 (maxx
, maxy
- 0.035666064359247684, maxz
- 0.059820037335157394),
997 (maxx
, maxy
- 0.04486268734234705, maxz
- 0.05799071677029133),
998 (maxx
, miny
+ 0.04486268733843682, minz
+ 0.04486269544876009),
999 (maxx
- 0.009557131677865982, maxy
- 0.04486268735205459, maxz
- 0.02464577928185463),
1000 (maxx
- 0.009557131677865982, miny
+ 0.027694474905729294, maxz
- 0.024581149220466614),
1001 (maxx
- 0.009557131677865982, maxy
- 0.013139966875314713, maxz
- 0.024402707815170288),
1002 (maxx
- 0.009557131677865982, miny
+ 0.013139966875314713, maxz
- 0.02467035874724388),
1003 (maxx
- 0.009557131677865982, maxy
- 0.027694473043084145, maxz
- 0.024581149220466614),
1004 (maxx
- 0.015024378895759583, miny
+ 0.027694474905729294, maxz
- 0.00017844140529632568),
1005 (maxx
- 0.015024378895759583, miny
+ 0.013139966875314713, maxz
- 0.0002676546573638916),
1006 (maxx
- 0.015024378895759583, maxy
- 0.04486268735205459, maxz
- 0.0002430751919746399),
1007 (maxx
- 0.015024378895759583, maxy
- 0.027694473043084145, maxz
- 0.00017844140529632568),
1008 (maxx
- 0.015024378895759583, maxy
- 0.013139966875314713, maxz
),
1009 (maxx
, miny
+ 0.013139966875314713, maxz
- 0.0018796995282173157),
1010 (maxx
- 0.01466318964958191, maxy
- 0.04486268735205459, maxz
- 0.001855120062828064),
1011 (maxx
, maxy
- 0.04486268735205459, maxz
- 0.001855120062828064),
1012 (maxx
- 0.01466318964958191, maxy
- 0.027694473043084145, maxz
- 0.0017904937267303467),
1013 (maxx
- 0.01466318964958191, maxy
- 0.013139966875314713, maxz
- 0.001612052321434021),
1014 (maxx
, maxy
- 0.027694473043084145, maxz
- 0.0017904937267303467),
1015 (maxx
- 0.020517520606517792, miny
+ 0.014739999547600746, minz
+ 0.03238546848297119),
1016 (maxx
- 0.020517520606517792, miny
+ 0.021807780489325523, minz
+ 0.02180778607726097),
1017 (maxx
- 0.020517520606517792, miny
+ 0.03238545823842287, minz
+ 0.014740003272891045),
1018 (maxx
- 0.020517520606517792, miny
+ 0.044862685933359736, minz
+ 0.012258127331733704),
1019 (maxx
- 0.020517520606517792, maxy
- 0.014739990234375, minz
+ 0.05733991041779518),
1020 (maxx
- 0.020517520606517792, maxy
- 0.021807771176099777, maxz
- 0.05896773934364319),
1021 (maxx
- 0.020517520606517792, maxy
- 0.03238545451313257, maxz
- 0.051899950951337814),
1022 (maxx
- 0.020517520606517792, maxy
- 0.044862687428120204, maxz
- 0.049418069422245026),
1023 (maxx
- 0.020517520606517792, maxy
- 0.03238546196371317, minz
+ 0.014740003272891045),
1024 (maxx
- 0.020517520606517792, maxy
- 0.021807780489325523, minz
+ 0.02180778607726097),
1025 (maxx
- 0.020517520606517792, maxy
- 0.014739999547600746, minz
+ 0.03238546848297119),
1026 (maxx
- 0.020517520606517792, maxy
- 0.012258119881153107, minz
+ 0.04486269794694575),
1027 (maxx
- 0.020517520606517792, miny
+ 0.03238545544445515, maxz
- 0.051899950951337814),
1028 (maxx
- 0.020517520606517792, miny
+ 0.021807771176099777, maxz
- 0.05896773561835289),
1029 (maxx
- 0.020517520606517792, miny
+ 0.014739995822310448, minz
+ 0.05733991973102093),
1030 (maxx
- 0.020517520606517792, miny
+ 0.012258119881153107, minz
+ 0.04486269302378876),
1031 (minx
, miny
+ 0.014739999547600746, minz
+ 0.03238546848297119),
1032 (minx
, miny
+ 0.021807780489325523, minz
+ 0.02180778607726097),
1033 (minx
, miny
+ 0.03238545823842287, minz
+ 0.014740003272891045),
1034 (minx
, miny
+ 0.044862685933359736, minz
+ 0.012258127331733704),
1035 (minx
, maxy
- 0.014739990234375, minz
+ 0.05733991041779518),
1036 (minx
, maxy
- 0.021807771176099777, maxz
- 0.05896773934364319),
1037 (minx
, maxy
- 0.03238545451313257, maxz
- 0.051899950951337814),
1038 (minx
, maxy
- 0.044862687428120204, maxz
- 0.049418069422245026),
1039 (minx
, maxy
- 0.03238546196371317, minz
+ 0.014740003272891045),
1040 (minx
, maxy
- 0.021807780489325523, minz
+ 0.02180778607726097),
1041 (minx
, maxy
- 0.014739999547600746, minz
+ 0.03238546848297119),
1042 (minx
, maxy
- 0.012258119881153107, minz
+ 0.04486269794694575),
1043 (minx
, miny
+ 0.03238545544445515, maxz
- 0.051899950951337814),
1044 (minx
, miny
+ 0.021807771176099777, maxz
- 0.05896773561835289),
1045 (minx
, miny
+ 0.014739995822310448, minz
+ 0.05733991973102093),
1046 (minx
, miny
+ 0.012258119881153107, minz
+ 0.04486269302378876)]
1049 myfaces
= [(37, 0, 1, 36), (36, 1, 2, 35), (35, 2, 3, 34), (34, 3, 4, 78), (78, 4, 5, 77),
1050 (77, 5, 6, 76), (76, 6, 7, 75), (75, 7, 8, 29), (29, 8, 9, 28), (28, 9, 10, 27),
1051 (27, 10, 11, 26), (65, 12, 13, 64), (8, 7, 17, 46), (63, 14, 0, 37), (64, 13, 14, 63),
1052 (34, 78, 41, 79), (64, 63, 67, 68), (76, 75, 38, 39), (65, 64, 68, 69), (27, 26, 98, 99),
1053 (78, 77, 40, 41), (28, 27, 99, 100), (35, 34, 79, 80), (63, 37, 82, 67), (29, 28, 100, 101),
1054 (26, 66, 70, 98), (36, 35, 80, 81), (66, 65, 69, 70), (77, 76, 39, 40), (37, 36, 81, 82),
1055 (75, 29, 101, 38), (19, 18, 109, 108), (31, 32, 61, 60), (2, 1, 88, 89), (103, 102, 91, 92),
1056 (7, 6, 16, 17), (54, 18, 55, 25), (32, 33, 62, 61), (18, 19, 56, 55), (6, 5, 15, 16),
1057 (11, 10, 48, 49), (52, 53, 24, 23), (0, 14, 86, 87), (94, 71, 129, 133), (97, 113, 51, 44),
1058 (33, 32, 117, 116), (18, 54, 110, 109), (32, 31, 95, 96), (96, 97, 44, 43), (102, 103, 72, 71),
1059 (53, 52, 114, 42), (21, 20, 107, 106), (103, 104, 73, 72), (31, 30, 94, 95), (20, 19, 108, 107),
1060 (30, 102, 71, 94), (105, 21, 106, 74), (54, 53, 111, 110), (104, 105, 74, 73), (47, 46, 59, 60),
1061 (90, 89, 57, 58), (87, 86, 25, 55), (48, 47, 60, 61), (49, 48, 61, 62), (83, 49, 62, 22),
1062 (16, 15, 93, 92), (88, 87, 55, 56), (84, 83, 22, 23), (17, 16, 92, 91), (85, 84, 23, 24),
1063 (46, 17, 91, 59), (89, 88, 56, 57), (86, 85, 24, 25), (104, 103, 92, 93), (3, 2, 89, 90),
1064 (20, 21, 58, 57), (13, 12, 84, 85), (9, 8, 46, 47), (102, 30, 59, 91), (30, 31, 60, 59),
1065 (19, 20, 57, 56), (14, 13, 85, 86), (53, 54, 25, 24), (10, 9, 47, 48), (1, 0, 87, 88),
1066 (111, 53, 42, 45), (112, 111, 45, 50), (32, 96, 43, 117), (113, 112, 50, 51), (115, 116, 125, 124),
1067 (42, 114, 123, 122), (116, 117, 126, 125), (114, 115, 124, 123), (112, 113, 144, 143),
1069 (110, 111, 142, 141), (96, 95, 134, 135), (74, 106, 137, 132), (97, 96, 135, 136), (73, 74, 132, 131),
1070 (107, 108, 139, 138), (113, 97, 136, 144), (72, 73, 131, 130), (108, 109, 140, 139),
1071 (109, 110, 141, 140),
1072 (71, 72, 130, 129), (106, 107, 138, 137), (111, 112, 143, 142), (135, 134, 145), (137, 138, 145),
1073 (142, 143, 145), (136, 135, 145), (131, 132, 145), (143, 144, 145), (144, 136, 145),
1074 (130, 131, 145), (141, 142, 145), (129, 130, 145), (132, 137, 145), (133, 129, 145),
1075 (138, 139, 145), (134, 133, 145), (139, 140, 145), (140, 141, 145), (26, 11, 83, 66),
1076 (66, 83, 12, 65), (12, 83, 84), (22, 52, 23), (83, 11, 49), (21, 105, 58),
1077 (4, 90, 58, 105), (15, 4, 105, 93), (33, 22, 62), (4, 3, 90), (105, 104, 93),
1078 (5, 4, 15), (52, 22, 115, 114), (22, 33, 116, 115), (124, 125, 147, 146), (122, 123, 150, 148),
1079 (125, 126, 149, 147), (123, 124, 146, 150), (157, 128, 151, 153), (159, 157, 153, 154),
1080 (160, 159, 154, 155),
1081 (128, 119, 152, 151), (146, 147, 128, 157), (150, 146, 157, 159), (148, 150, 159, 160),
1082 (147, 149, 119, 128),
1083 (69, 68, 167, 168), (101, 100, 176, 177), (39, 38, 162, 163), (100, 99, 175, 176), (41, 40, 164, 165),
1084 (80, 79, 170, 171), (82, 81, 172, 173), (67, 82, 173, 166), (70, 69, 168, 169), (38, 101, 177, 162),
1085 (98, 70, 169, 174), (40, 39, 163, 164), (79, 41, 165, 170), (99, 98, 174, 175), (81, 80, 171, 172),
1086 (68, 67, 166, 167), (169, 168, 184, 185), (170, 165, 181, 186), (172, 171, 187, 188),
1087 (162, 177, 193, 178),
1088 (164, 163, 179, 180), (167, 166, 182, 183), (174, 169, 185, 190), (168, 167, 183, 184),
1089 (175, 174, 190, 191),
1090 (171, 170, 186, 187), (173, 172, 188, 189), (163, 162, 178, 179), (165, 164, 180, 181),
1091 (177, 176, 192, 193),
1092 (166, 173, 189, 182), (176, 175, 191, 192), (51, 50, 161, 158), (127, 160, 155), (156, 120, 151, 152),
1093 (155, 154, 161, 121), (161, 154, 153, 158), (42, 122, 148), (117, 149, 126), (127, 42, 148, 160),
1094 (118, 152, 119), (158, 153, 151, 120), (50, 45, 121, 161), (117, 118, 119, 149), (43, 44, 120, 156),
1095 (44, 51, 158, 120), (117, 43, 156, 118), (45, 42, 127, 121)]
1097 return myvertex
, myfaces
1100 # --------------------------------------------------------------------
1103 # myObject: Curve obejct
1104 # --------------------------------------------------------------------
1105 def set_curve_cycle(myobject
):
1106 bpy
.context
.scene
.objects
.active
= myobject
1108 bpy
.ops
.object.mode_set(mode
='EDIT')
1110 bpy
.ops
.curve
.select_all(action
='SELECT')
1112 bpy
.ops
.curve
.cyclic_toggle(direction
='CYCLIC_U')
1113 # go object mode again
1114 bpy
.ops
.object.editmode_toggle()