Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormeta-androcto <meta.androcto1@gmail.com>2016-08-03 03:10:18 +0300
committermeta-androcto <meta.androcto1@gmail.com>2016-08-03 03:10:18 +0300
commit5cd9040c995effc4c6bf233e820f741cbaf083ca (patch)
tree52571f0ec0726b6ea067db4a2eba14e939188f27 /archimesh
parent867ce6317b64a342ed0658702bed687fd3d087d7 (diff)
move archimesh to release re: T37230
Diffstat (limited to 'archimesh')
-rw-r--r--archimesh/__init__.py311
-rw-r--r--archimesh/achm_books_maker.py401
-rw-r--r--archimesh/achm_column_maker.py797
-rw-r--r--archimesh/achm_curtain_maker.py1110
-rw-r--r--archimesh/achm_door_maker.py2391
-rw-r--r--archimesh/achm_gltools.py696
-rw-r--r--archimesh/achm_kitchen_maker.py2614
-rw-r--r--archimesh/achm_lamp_maker.py786
-rw-r--r--archimesh/achm_main_panel.py578
-rw-r--r--archimesh/achm_roof_maker.py586
-rw-r--r--archimesh/achm_room_maker.py1700
-rw-r--r--archimesh/achm_shelves_maker.py466
-rw-r--r--archimesh/achm_stairs_maker.py434
-rw-r--r--archimesh/achm_tools.py1043
-rw-r--r--archimesh/achm_venetian_maker.py1409
-rw-r--r--archimesh/achm_window_maker.py2308
-rw-r--r--archimesh/achm_window_panel.py1867
-rw-r--r--archimesh/images/fabric_diffuse.pngbin0 -> 171677 bytes
18 files changed, 19497 insertions, 0 deletions
diff --git a/archimesh/__init__.py b/archimesh/__init__.py
new file mode 100644
index 00000000..6fab5c1b
--- /dev/null
+++ b/archimesh/__init__.py
@@ -0,0 +1,311 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+# ----------------------------------------------------------
+# Author: Antonio Vazquez (antonioya)
+# ----------------------------------------------------------
+
+# ----------------------------------------------
+# Define Addon info
+# ----------------------------------------------
+bl_info = {
+ "name": "Archimesh",
+ "author": "Antonio Vazquez (antonioya)",
+ "location": "View3D > Add > Mesh > Archimesh",
+ "version": (1, 1, 2),
+ "blender": (2, 6, 8),
+ "description": "Generate rooms, doors, windows, kitchen cabinets, "
+ "shelves, roofs, stairs and other architecture stuff.",
+ "tracker_url": "https://developer.blender.org/maniphest/task/edit/form/2/",
+ "category": "Add Mesh"}
+
+import sys
+import os
+
+# ----------------------------------------------
+# Add to Phyton path (once only)
+# ----------------------------------------------
+path = sys.path
+flag = False
+for item in path:
+ if "archimesh" in item:
+ flag = True
+if flag is False:
+ sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'archimesh'))
+ print("archimesh: added to phytonpath")
+
+# ----------------------------------------------
+# Import modules
+# ----------------------------------------------
+if "bpy" in locals():
+ import imp
+ imp.reload(achm_room_maker)
+ imp.reload(achm_door_maker)
+ imp.reload(achm_window_maker)
+ imp.reload(achm_roof_maker)
+ imp.reload(achm_column_maker)
+ imp.reload(achm_stairs_maker)
+ imp.reload(achm_kitchen_maker)
+ imp.reload(achm_shelves_maker)
+ imp.reload(achm_books_maker)
+ imp.reload(achm_lamp_maker)
+ imp.reload(achm_curtain_maker)
+ imp.reload(achm_venetian_maker)
+ imp.reload(achm_main_panel)
+ imp.reload(achm_window_panel)
+ print("archimesh: Reloaded multifiles")
+else:
+ import achm_books_maker
+ import achm_column_maker
+ import achm_curtain_maker
+ import achm_venetian_maker
+ import achm_door_maker
+ import achm_kitchen_maker
+ import achm_lamp_maker
+ import achm_main_panel
+ import achm_roof_maker
+ import achm_room_maker
+ import achm_shelves_maker
+ import achm_stairs_maker
+ import achm_window_maker
+ import achm_window_panel
+
+ print("archimesh: Imported multifiles")
+
+# noinspection PyUnresolvedReferences
+import bpy
+# noinspection PyUnresolvedReferences
+from bpy.props import *
+
+# ----------------------------------------------------------
+# Decoration assets
+# ----------------------------------------------------------
+
+
+class AchmInfoMtMeshDecorationAdd(bpy.types.Menu):
+ bl_idname = "INFO_MT_mesh_decoration_add"
+ bl_label = "Decoration assets"
+
+ # noinspection PyUnusedLocal
+ def draw(self, context):
+ self.layout.operator("mesh.archimesh_books", text="Add Books", icon="PLUGIN")
+ self.layout.operator("mesh.archimesh_lamp", text="Add Lamp", icon="PLUGIN")
+ self.layout.operator("mesh.archimesh_roller", text="Add Roller curtains", icon="PLUGIN")
+ self.layout.operator("mesh.archimesh_venetian", text="Add Venetian blind", icon="PLUGIN")
+ self.layout.operator("mesh.archimesh_japan", text="Add Japanese curtains", icon="PLUGIN")
+
+# ----------------------------------------------------------
+# Registration
+# ----------------------------------------------------------
+
+
+class AchmInfoMtMeshCustomMenuAdd(bpy.types.Menu):
+ bl_idname = "INFO_MT_mesh_custom_menu_add"
+ bl_label = "Archimesh"
+
+ # noinspection PyUnusedLocal
+ def draw(self, context):
+ self.layout.operator_context = 'INVOKE_REGION_WIN'
+ self.layout.operator("mesh.archimesh_room", text="Add Room", icon="PLUGIN")
+ self.layout.operator("mesh.archimesh_door", text="Add Door", icon="PLUGIN")
+ self.layout.operator("mesh.archimesh_window", text="Add Rail Window", icon="PLUGIN")
+ self.layout.operator("mesh.archimesh_winpanel", text="Add Panel Window", icon="PLUGIN")
+ self.layout.operator("mesh.archimesh_kitchen", text="Add Cabinet", icon="PLUGIN")
+ self.layout.operator("mesh.archimesh_shelves", text="Add Shelves", icon="PLUGIN")
+ self.layout.operator("mesh.archimesh_column", text="Add Column", icon="PLUGIN")
+ self.layout.operator("mesh.archimesh_stairs", text="Add Stairs", icon="PLUGIN")
+ self.layout.operator("mesh.archimesh_roof", text="Add Roof", icon="PLUGIN")
+ self.layout.menu("INFO_MT_mesh_decoration_add", text="Decoration props", icon="GROUP")
+
+# --------------------------------------------------------------
+# Register all operators and panels
+# --------------------------------------------------------------
+# Define menu
+
+
+# noinspection PyUnusedLocal
+def AchmMenu_func(self, context):
+ self.layout.menu("INFO_MT_mesh_custom_menu_add", icon="PLUGIN")
+
+
+def register():
+ bpy.utils.register_class(AchmInfoMtMeshCustomMenuAdd)
+ bpy.utils.register_class(AchmInfoMtMeshDecorationAdd)
+ bpy.utils.register_class(achm_room_maker.AchmRoom)
+ bpy.utils.register_class(achm_room_maker.AchmRoomGeneratorPanel)
+ bpy.utils.register_class(achm_room_maker.AchmExportRoom)
+ bpy.utils.register_class(achm_room_maker.AchmImportRoom)
+ bpy.utils.register_class(achm_door_maker.AchmDoor)
+ bpy.utils.register_class(achm_door_maker.AchmDoorObjectgeneratorpanel)
+ bpy.utils.register_class(achm_window_maker.AchmWindows)
+ bpy.utils.register_class(achm_window_maker.AchmWindowObjectgeneratorpanel)
+ bpy.utils.register_class(achm_roof_maker.AchmRoof)
+ bpy.utils.register_class(achm_column_maker.AchmColumn)
+ bpy.utils.register_class(achm_stairs_maker.AchmStairs)
+ bpy.utils.register_class(achm_kitchen_maker.AchmKitchen)
+ bpy.utils.register_class(achm_kitchen_maker.AchmExportInventory)
+ bpy.utils.register_class(achm_shelves_maker.AchmShelves)
+ bpy.utils.register_class(achm_books_maker.AchmBooks)
+ bpy.utils.register_class(achm_lamp_maker.AchmLamp)
+ bpy.utils.register_class(achm_curtain_maker.AchmRoller)
+ bpy.utils.register_class(achm_curtain_maker.AchmJapan)
+ bpy.utils.register_class(achm_venetian_maker.AchmVenetian)
+ bpy.utils.register_class(achm_venetian_maker.AchmVenetianObjectgeneratorpanel)
+ bpy.utils.register_class(achm_main_panel.ArchimeshMainPanel)
+ bpy.utils.register_class(achm_main_panel.AchmHoleAction)
+ bpy.utils.register_class(achm_main_panel.AchmPencilAction)
+ bpy.utils.register_class(achm_main_panel.AchmRunHintDisplayButton)
+ bpy.utils.register_class(achm_window_panel.AchmWinPanel)
+ bpy.utils.register_class(achm_window_panel.AchmWindowEditPanel)
+ bpy.types.INFO_MT_mesh_add.append(AchmMenu_func)
+
+ # Define properties
+ bpy.types.Scene.archimesh_select_only = bpy.props.BoolProperty(
+ name="Only selected",
+ description="Apply auto holes only to selected objects",
+ default=False,
+ )
+ bpy.types.Scene.archimesh_ceiling = bpy.props.BoolProperty(
+ name="Ceiling",
+ description="Create a ceiling",
+ default=False,
+ )
+ bpy.types.Scene.archimesh_floor = bpy.props.BoolProperty(
+ name="Floor",
+ description="Create a floor automatically",
+ default=False,
+ )
+
+ bpy.types.Scene.archimesh_merge = bpy.props.BoolProperty(
+ name="Close walls",
+ description="Close walls to create a full closed room",
+ default=False,
+ )
+
+ bpy.types.Scene.archimesh_text_color = bpy.props.FloatVectorProperty(
+ name="Hint color",
+ description="Color for the text and lines",
+ default=(0.173, 0.545, 1.0, 1.0),
+ min=0.1,
+ max=1,
+ subtype='COLOR',
+ size=4,
+ )
+ bpy.types.Scene.archimesh_walltext_color = bpy.props.FloatVectorProperty(
+ name="Hint color",
+ description="Color for the wall label",
+ default=(1, 0.8, 0.1, 1.0),
+ min=0.1,
+ max=1,
+ subtype='COLOR',
+ size=4,
+ )
+ bpy.types.Scene.archimesh_font_size = bpy.props.IntProperty(
+ name="Text Size",
+ description="Text size for hints",
+ default=14, min=10, max=150,
+ )
+ bpy.types.Scene.archimesh_wfont_size = bpy.props.IntProperty(
+ name="Text Size",
+ description="Text size for wall labels",
+ default=16, min=10, max=150,
+ )
+ bpy.types.Scene.archimesh_hint_space = bpy.props.FloatProperty(
+ name='Separation', min=0, max=5, default=0.1,
+ precision=2,
+ description='Distance from object to display hint',
+ )
+ bpy.types.Scene.archimesh_gl_measure = bpy.props.BoolProperty(
+ name="Measures",
+ description="Display measures",
+ default=True,
+ )
+ bpy.types.Scene.archimesh_gl_name = bpy.props.BoolProperty(
+ name="Names",
+ description="Display names",
+ default=True,
+ )
+ bpy.types.Scene.archimesh_gl_ghost = bpy.props.BoolProperty(
+ name="All",
+ description="Display measures for all objects,"
+ " not only selected",
+ default=True,
+ )
+
+ # OpenGL flag
+ wm = bpy.types.WindowManager
+ # register internal property
+ wm.archimesh_run_opengl = bpy.props.BoolProperty(default=False)
+
+
+def unregister():
+ bpy.utils.unregister_class(AchmInfoMtMeshCustomMenuAdd)
+ bpy.utils.unregister_class(AchmInfoMtMeshDecorationAdd)
+ bpy.utils.unregister_class(achm_room_maker.AchmRoom)
+ bpy.utils.unregister_class(achm_room_maker.AchmRoomGeneratorPanel)
+ bpy.utils.unregister_class(achm_room_maker.AchmExportRoom)
+ bpy.utils.unregister_class(achm_room_maker.AchmImportRoom)
+ bpy.utils.unregister_class(achm_door_maker.AchmDoor)
+ bpy.utils.unregister_class(achm_door_maker.AchmDoorObjectgeneratorpanel)
+ bpy.utils.unregister_class(achm_window_maker.AchmWindows)
+ bpy.utils.unregister_class(achm_window_maker.AchmWindowObjectgeneratorpanel)
+ bpy.utils.unregister_class(achm_roof_maker.AchmRoof)
+ bpy.utils.unregister_class(achm_column_maker.AchmColumn)
+ bpy.utils.unregister_class(achm_stairs_maker.AchmStairs)
+ bpy.utils.unregister_class(achm_kitchen_maker.AchmKitchen)
+ bpy.utils.unregister_class(achm_kitchen_maker.AchmExportInventory)
+ bpy.utils.unregister_class(achm_shelves_maker.AchmShelves)
+ bpy.utils.unregister_class(achm_books_maker.AchmBooks)
+ bpy.utils.unregister_class(achm_lamp_maker.AchmLamp)
+ bpy.utils.unregister_class(achm_curtain_maker.AchmRoller)
+ bpy.utils.unregister_class(achm_curtain_maker.AchmJapan)
+ bpy.utils.unregister_class(achm_venetian_maker.AchmVenetian)
+ bpy.utils.unregister_class(achm_venetian_maker.AchmVenetianObjectgeneratorpanel)
+ bpy.utils.unregister_class(achm_main_panel.ArchimeshMainPanel)
+ bpy.utils.unregister_class(achm_main_panel.AchmHoleAction)
+ bpy.utils.unregister_class(achm_main_panel.AchmPencilAction)
+ bpy.utils.unregister_class(achm_main_panel.AchmRunHintDisplayButton)
+ bpy.utils.unregister_class(achm_window_panel.AchmWinPanel)
+ bpy.utils.unregister_class(achm_window_panel.AchmWindowEditPanel)
+ bpy.types.INFO_MT_mesh_add.remove(AchmMenu_func)
+
+ # Remove properties
+ del bpy.types.Scene.archimesh_select_only
+ del bpy.types.Scene.archimesh_ceiling
+ del bpy.types.Scene.archimesh_floor
+ del bpy.types.Scene.archimesh_merge
+ del bpy.types.Scene.archimesh_text_color
+ del bpy.types.Scene.archimesh_walltext_color
+ del bpy.types.Scene.archimesh_font_size
+ del bpy.types.Scene.archimesh_wfont_size
+ del bpy.types.Scene.archimesh_hint_space
+ del bpy.types.Scene.archimesh_gl_measure
+ del bpy.types.Scene.archimesh_gl_name
+ del bpy.types.Scene.archimesh_gl_ghost
+ # remove OpenGL data
+ achm_main_panel.AchmRunHintDisplayButton.handle_remove(achm_main_panel.AchmRunHintDisplayButton, bpy.context)
+ wm = bpy.context.window_manager
+ p = 'archimesh_run_opengl'
+ if p in wm:
+ del wm[p]
+
+
+if __name__ == '__main__':
+ register()
diff --git a/archimesh/achm_books_maker.py b/archimesh/achm_books_maker.py
new file mode 100644
index 00000000..1d0f47e2
--- /dev/null
+++ b/archimesh/achm_books_maker.py
@@ -0,0 +1,401 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+# ----------------------------------------------------------
+# Automatic generation of books
+# Author: Antonio Vazquez (antonioya)
+#
+# ----------------------------------------------------------
+# noinspection PyUnresolvedReferences
+import bpy
+import math
+import random
+import copy
+import colorsys
+from achm_tools import *
+
+
+# ------------------------------------------------------------------
+# Define UI class
+# Books
+# ------------------------------------------------------------------
+class AchmBooks(bpy.types.Operator):
+ bl_idname = "mesh.archimesh_books"
+ bl_label = "Books"
+ bl_description = "Books Generator"
+ bl_category = 'Archimesh'
+ bl_options = {'REGISTER', 'UNDO'}
+
+ width = bpy.props.FloatProperty(
+ name='Width', min=0.001, max=1, default=0.045, precision=3,
+ description='Bounding book width',
+ )
+ depth = bpy.props.FloatProperty(
+ name='Depth', min=0.001, max=1, default=0.22, precision=3,
+ description='Bounding book depth',
+ )
+ height = bpy.props.FloatProperty(
+ name='Height', min=0.001, max=1, default=0.30, precision=3,
+ description='Bounding book height',
+ )
+ num = bpy.props.IntProperty(
+ name='Number of books', min=1, max=100, default=20,
+ description='Number total of books',
+ )
+
+ rX = bpy.props.FloatProperty(
+ name='X', min=0.000, max=0.999, default=0, precision=3,
+ description='Randomness for X axis',
+ )
+ rY = bpy.props.FloatProperty(
+ name='Y', min=0.000, max=0.999, default=0, precision=3,
+ description='Randomness for Y axis',
+ )
+ rZ = bpy.props.FloatProperty(
+ name='Z', min=0.000, max=0.999, default=0, precision=3,
+ description='Randomness for Z axis',
+ )
+
+ rot = bpy.props.FloatProperty(
+ name='Rotation', min=0.000, max=1, default=0, precision=3,
+ description='Randomness for vertical position (0-> All straight)',
+ )
+ afn = bpy.props.IntProperty(
+ name='Affinity', min=0, max=10, default=5,
+ description='Number of books with same rotation angle',
+ )
+
+ # Materials
+ crt_mat = bpy.props.BoolProperty(
+ name="Create default Cycles materials",
+ description="Create default materials for Cycles render",
+ default=True,
+ )
+ objcol = bpy.props.FloatVectorProperty(
+ name="Color",
+ description="Color for material",
+ default=(1.0, 1.0, 1.0, 1.0),
+ min=0.1, max=1,
+ subtype='COLOR',
+ size=4,
+ )
+ rC = bpy.props.FloatProperty(
+ name='Randomness',
+ min=0.000, max=1, default=0, precision=3,
+ description='Randomness for color ',
+ )
+
+ # -----------------------------------------------------
+ # Draw (create UI interface)
+ # -----------------------------------------------------
+ # noinspection PyUnusedLocal
+ def draw(self, context):
+ layout = self.layout
+ space = bpy.context.space_data
+ if not space.local_view:
+ # Imperial units warning
+ if bpy.context.scene.unit_settings.system == "IMPERIAL":
+ row = layout.row()
+ row.label("Warning: Imperial units not supported", icon='COLOR_RED')
+
+ box = layout.box()
+ box.label("Book size")
+ row = box.row()
+ row.prop(self, 'width')
+ row.prop(self, 'depth')
+ row.prop(self, 'height')
+ row = box.row()
+ row.prop(self, 'num', slider=True)
+
+ box = layout.box()
+ box.label("Randomness")
+ row = box.row()
+ row.prop(self, 'rX', slider=True)
+ row.prop(self, 'rY', slider=True)
+ row.prop(self, 'rZ', slider=True)
+ row = box.row()
+ row.prop(self, 'rot', slider=True)
+ row.prop(self, 'afn', slider=True)
+
+ box = layout.box()
+ box.prop(self, 'crt_mat')
+ if self.crt_mat:
+ row = box.row()
+ row.prop(self, 'objcol')
+ row = box.row()
+ row.prop(self, 'rC', slider=True)
+ else:
+ row = layout.row()
+ row.label("Warning: Operator does not work in local view mode", icon='ERROR')
+
+ # -----------------------------------------------------
+ # Execute
+ # -----------------------------------------------------
+ # noinspection PyUnusedLocal
+ def execute(self, context):
+ if bpy.context.mode == "OBJECT":
+ # Create shelves
+ create_book_mesh(self)
+ return {'FINISHED'}
+ else:
+ self.report({'WARNING'}, "Archimesh: Option only valid in Object mode")
+ return {'CANCELLED'}
+
+
+# ------------------------------------------------------------------------------
+# Generate mesh data
+# All custom values are passed using self container (self.myvariable)
+# ------------------------------------------------------------------------------
+def create_book_mesh(self):
+ # deactivate others
+ for o in bpy.data.objects:
+ if o.select is True:
+ o.select = False
+ bpy.ops.object.select_all(False)
+ generate_books(self)
+
+ return
+
+
+# ------------------------------------------------------------------------------
+# Generate books
+# All custom values are passed using self container (self.myvariable)
+# ------------------------------------------------------------------------------
+def generate_books(self):
+ boxes = []
+ location = bpy.context.scene.cursor_location
+ myloc = copy.copy(location) # copy location to keep 3D cursor position
+
+ # Create
+ lastx = myloc.x
+ ox = 0
+ oy = 0
+ oz = 0
+ ot = 0
+ i = 0
+ for x in range(self.num):
+ # reset rotation
+ if i >= self.afn:
+ i = 0
+ ot = -1
+
+ mydata = create_book("Book" + str(x),
+ self.width, self.depth, self.height,
+ lastx, myloc.y, myloc.z,
+ self.crt_mat,
+ self.rX, self.rY, self.rZ, self.rot, ox, oy, oz, ot,
+ self.objcol, self.rC)
+ boxes.extend([mydata[0]])
+ bookdata = mydata[1]
+
+ # calculate rotation using previous book
+ ot = bookdata[3]
+ i += 1
+ oz = 0
+
+ # calculate x size after rotation
+ if i < self.afn:
+ size = 0.0002
+ else:
+ size = 0.0003 + math.cos(math.radians(90 - bookdata[3])) * bookdata[2] # the height is the radius
+ oz = bookdata[2]
+
+ lastx = lastx + bookdata[0] + size
+
+ # refine units
+ for box in boxes:
+ remove_doubles(box)
+ set_normals(box)
+
+ # deactivate others
+ for o in bpy.data.objects:
+ if o.select is True:
+ o.select = False
+
+ boxes[0].select = True
+ bpy.context.scene.objects.active = boxes[0]
+
+ return
+
+
+# ------------------------------------------------------------------------------
+# Create books unit
+#
+# objName: Name for the new object
+# thickness: wood thickness (sides)
+# sX: Size in X axis
+# sY: Size in Y axis
+# sZ: Size in Z axis
+# pX: position X axis
+# pY: position Y axis
+# pZ: position Z axis
+# mat: Flag for creating materials
+# frX: Random factor X
+# frY: Random factor Y
+# frZ: Random factor Z
+# frR: Random factor Rotation
+# oX: override x size
+# oY: override y size
+# oZ: override z size
+# oR: override rotation
+# objcol: color
+# frC: color randomness factor
+# ------------------------------------------------------------------------------
+def create_book(objname, sx, sy, sz, px, py, pz, mat, frx,
+ fry, frz, frr, ox, oy, oz, ot, objcol, frc):
+ # gap Randomness
+ ri = random.randint(10, 150)
+ gap = ri / 100000
+ # Randomness X
+ if ox == 0:
+ ri = random.randint(0, int(frx * 1000))
+ factor = ri / 1000
+ sx -= sx * factor
+ if sx < (gap * 3):
+ sx = gap * 3
+ else:
+ sx = ox
+
+ # Randomness Y
+ if oy == 0:
+ ri = random.randint(0, int(fry * 1000))
+ factor = ri / 1000
+ sy -= sy * factor
+ if sy < (gap * 3):
+ sy = gap * 3
+ else:
+ sy = oy
+
+ # Randomness Z
+ if oz == 0:
+ ri = random.randint(0, int(frz * 1000))
+ factor = ri / 1000
+ sz -= sz * factor
+ if sz < (gap * 3):
+ sz = gap * 3
+ else:
+ sz = oz
+
+ # Randomness rotation
+ rot = 0
+ if frr > 0 and ot != -1:
+ if ot == 0:
+ ri = random.randint(0, int(frr * 1000))
+ factor = ri / 1000
+ rot = 30 * factor
+ else:
+ rot = ot
+
+ # Randomness color (only hue)
+ hsv = colorsys.rgb_to_hsv(objcol[0], objcol[1], objcol[2])
+ hue = hsv[0]
+ if frc > 0:
+ rc1 = random.randint(0, int(hue * 1000)) # 0 to hue
+ rc2 = random.randint(int(hue * 1000), 1000) # hue to maximum
+ rc3 = random.randint(0, 1000) # sign
+
+ if rc3 >= hue * 1000:
+ hue += (rc2 * frc) / 1000
+ else:
+ hue -= (rc1 * frc) / 1000
+ # Convert random color
+ objcol = colorsys.hsv_to_rgb(hue, hsv[1], hsv[2])
+
+ myvertex = []
+ myfaces = []
+ x = 0
+ # Left side
+ myvertex.extend([(x, -sy, 0), (0, 0, 0), (x, 0, sz), (x, -sy, sz)])
+ myfaces.extend([(0, 1, 2, 3)])
+
+ myvertex.extend([(x + gap, -sy + gap, 0), (x + gap, 0, 0), (x + gap, 0, sz),
+ (x + gap, -sy + gap, sz)])
+ myfaces.extend([(4, 5, 6, 7)])
+
+ # Right side
+ x = sx - gap
+ myvertex.extend([(x, -sy + gap, 0), (x, 0, 0), (x, 0, sz), (x, -sy + gap, sz)])
+ myfaces.extend([(8, 9, 10, 11)])
+
+ myvertex.extend([(x + gap, -sy, 0), (x + gap, 0, 0), (x + gap, 0, sz), (x + gap, -sy, sz)])
+ myfaces.extend([(12, 13, 14, 15)])
+
+ myfaces.extend(
+ [(0, 12, 15, 3), (4, 8, 11, 7), (3, 15, 11, 7), (0, 12, 8, 4), (0, 1, 5, 4),
+ (8, 9, 13, 12), (3, 2, 6, 7),
+ (11, 10, 14, 15), (1, 2, 6, 5), (9, 10, 14, 13)])
+
+ # Top inside
+ myvertex.extend([(gap, -sy + gap, sz - gap), (gap, -gap, sz - gap), (sx - gap, -gap, sz - gap),
+ (sx - gap, -sy + gap, sz - gap)])
+ myfaces.extend([(16, 17, 18, 19)])
+
+ # bottom inside and front face
+ myvertex.extend([(gap, -sy + gap, gap), (gap, -gap, gap), (sx - gap, -gap, gap), (sx - gap, -sy + gap, gap)])
+ myfaces.extend([(20, 21, 22, 23), (17, 18, 22, 21)])
+
+ mymesh = bpy.data.meshes.new(objname)
+ mybook = bpy.data.objects.new(objname, mymesh)
+
+ mybook.location[0] = px
+ mybook.location[1] = py
+ mybook.location[2] = pz + math.sin(math.radians(rot)) * sx
+ bpy.context.scene.objects.link(mybook)
+
+ mymesh.from_pydata(myvertex, [], myfaces)
+ mymesh.update(calc_edges=True)
+
+ # ---------------------------------
+ # Materials and UV Maps
+ # ---------------------------------
+ if mat:
+ rgb = objcol
+ # External
+ mat = create_diffuse_material(objname + "_material", True,
+ rgb[0], rgb[1], rgb[2], rgb[0], rgb[1], rgb[2], 0.05)
+ set_material(mybook, mat)
+ # UV unwrap external
+ select_faces(mybook, 0, True)
+ select_faces(mybook, 3, False)
+ select_faces(mybook, 4, False)
+ unwrap_mesh(mybook, False)
+ # Add Internal
+ mat = create_diffuse_material(objname + "_side_material", True, 0.5, 0.5, 0.5, 0.5, 0.5, 0.3, 0.03)
+ mybook.data.materials.append(mat)
+ select_faces(mybook, 14, True)
+ select_faces(mybook, 15, False)
+ select_faces(mybook, 16, False)
+ set_material_faces(mybook, 1)
+ # UV unwrap
+ bpy.ops.object.mode_set(mode='EDIT', toggle=False)
+ bpy.ops.mesh.select_all(action='DESELECT')
+ bpy.ops.object.mode_set(mode='OBJECT')
+ select_faces(mybook, 14, True)
+ select_faces(mybook, 15, False)
+ select_faces(mybook, 16, False)
+ unwrap_mesh(mybook, False)
+
+ # ---------------------------------
+ # Rotation on Y axis
+ # ---------------------------------
+ mybook.rotation_euler = (0.0, math.radians(rot), 0.0) # radians
+
+ # add some gap to the size between books
+ return mybook, (sx, sy, sz, rot)
diff --git a/archimesh/achm_column_maker.py b/archimesh/achm_column_maker.py
new file mode 100644
index 00000000..d13f544c
--- /dev/null
+++ b/archimesh/achm_column_maker.py
@@ -0,0 +1,797 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+# ----------------------------------------------------------
+# Automatic generation of columns
+# Author: Antonio Vazquez (antonioya)
+#
+# ----------------------------------------------------------
+# noinspection PyUnresolvedReferences
+import bpy
+import math
+from achm_tools import *
+
+
+# ------------------------------------------------------------------
+# Define UI class
+# Columns
+# ------------------------------------------------------------------
+class AchmColumn(bpy.types.Operator):
+ bl_idname = "mesh.archimesh_column"
+ bl_label = "Column"
+ bl_description = "Columns Generator"
+ bl_category = 'Archimesh'
+ bl_options = {'REGISTER', 'UNDO'}
+
+ # Define properties
+ model = bpy.props.EnumProperty(
+ name="Model",
+ items=(
+ ('1', "Circular", ""),
+ ('2', "Rectangular", ""),
+ ),
+ description="Type of column",
+ )
+ keep_size = bpy.props.BoolProperty(
+ name="Keep radius equal",
+ description="Keep all radius (top, mid and bottom) to the same size",
+ default=True,
+ )
+
+ rad_top = bpy.props.FloatProperty(
+ name='Top radius',
+ min=0.001, max=10, default=0.15, precision=3,
+ description='Radius of the column in the top',
+ )
+ rad_mid = bpy.props.FloatProperty(
+ name='Middle radius',
+ min=0.001, max=10, default=0.15, precision=3,
+ description='Radius of the column in the middle',
+ )
+ shift = bpy.props.FloatProperty(
+ name='',
+ min=-1, max=1, default=0, precision=3,
+ description='Middle displacement',
+ )
+
+ rad_bottom = bpy.props.FloatProperty(
+ name='Bottom radius',
+ min=0.001, max=10, default=0.15, precision=3,
+ description='Radius of the column in the bottom',
+ )
+
+ col_height = bpy.props.FloatProperty(
+ name='Total height',
+ min=0.001, max=10, default=2.4, precision=3,
+ description='Total height of column, including bases and tops',
+ )
+ col_sx = bpy.props.FloatProperty(
+ name='X size',
+ min=0.001, max=10, default=0.30, precision=3,
+ description='Column size for x axis',
+ )
+ col_sy = bpy.props.FloatProperty(
+ name='Y size',
+ min=0.001, max=10, default=0.30, precision=3,
+ description='Column size for y axis',
+ )
+
+ cir_base = bpy.props.BoolProperty(
+ name="Include circular base",
+ description="Include a base with circular form",
+ default=False,
+ )
+ cir_base_r = bpy.props.FloatProperty(
+ name='Radio',
+ min=0.001, max=10, default=0.08, precision=3,
+ description='Rise up radio of base',
+ )
+ cir_base_z = bpy.props.FloatProperty(
+ name='Height',
+ min=0.001, max=10, default=0.05, precision=3,
+ description='Size for z axis',
+ )
+
+ cir_top = bpy.props.BoolProperty(
+ name="Include circular top",
+ description="Include a top with circular form",
+ default=False,
+ )
+ cir_top_r = bpy.props.FloatProperty(
+ name='Radio',
+ min=0.001, max=10, default=0.08, precision=3,
+ description='Rise up radio of top',
+ )
+ cir_top_z = bpy.props.FloatProperty(
+ name='Height',
+ min=0.001, max=10, default=0.05, precision=3,
+ description='Size for z axis',
+ )
+
+ box_base = bpy.props.BoolProperty(
+ name="Include rectangular base",
+ description="Include a base with rectangular form",
+ default=True,
+ )
+ box_base_x = bpy.props.FloatProperty(
+ name='X size',
+ min=0.001, max=10, default=0.40, precision=3,
+ description='Size for x axis',
+ )
+ box_base_y = bpy.props.FloatProperty(
+ name='Y size',
+ min=0.001, max=10, default=0.40, precision=3,
+ description='Size for y axis',
+ )
+ box_base_z = bpy.props.FloatProperty(
+ name='Height',
+ min=0.001, max=10, default=0.05, precision=3,
+ description='Size for z axis',
+ )
+
+ box_top = bpy.props.BoolProperty(
+ name="Include rectangular top",
+ description="Include a top with rectangular form",
+ default=True,
+ )
+ box_top_x = bpy.props.FloatProperty(
+ name='X size',
+ min=0.001, max=10, default=0.40, precision=3,
+ description='Size for x axis',
+ )
+ box_top_y = bpy.props.FloatProperty(
+ name='Y size',
+ min=0.001, max=10, default=0.40, precision=3,
+ description='Size for y axis',
+ )
+ box_top_z = bpy.props.FloatProperty(
+ name='Height',
+ min=0.001, max=10, default=0.05, precision=3,
+ description='Size for z axis',
+ )
+
+ arc_top = bpy.props.BoolProperty(
+ name="Create top arch",
+ description="Include an arch in the top of the column",
+ default=False,
+ )
+ arc_radio = bpy.props.FloatProperty(
+ name='Arc Radio',
+ min=0.001, max=10, default=1, precision=1,
+ description='Radio of the arch',
+ )
+ arc_width = bpy.props.FloatProperty(
+ name='Thickness',
+ min=0.01, max=10, default=0.15, precision=2,
+ description='Thickness of the arch wall',
+ )
+ arc_gap = bpy.props.FloatProperty(
+ name='Arc gap',
+ min=0.01, max=10, default=0.25, precision=2,
+ description='Size of the gap in the arch sides',
+ )
+
+ crt_mat = bpy.props.BoolProperty(
+ name="Create default Cycles materials",
+ description="Create default materials for Cycles render",
+ default=True,
+ )
+ crt_array = bpy.props.BoolProperty(
+ name="Create array of elements",
+ description="Create a modifier array for all elemnst",
+ default=False,
+ )
+ array_num_x = bpy.props.IntProperty(
+ name='Count X',
+ min=0, max=100, default=3,
+ description='Number of elements in array',
+ )
+ array_space_x = bpy.props.FloatProperty(
+ name='Distance X',
+ min=0.000, max=10, default=1, precision=3,
+ description='Distance between elements (only arc disabled)',
+ )
+ array_num_y = bpy.props.IntProperty(
+ name='Count Y',
+ min=0, max=100, default=0,
+ description='Number of elements in array',
+ )
+ array_space_y = bpy.props.FloatProperty(
+ name='Distance Y',
+ min=0.000, max=10, default=1, precision=3,
+ description='Distance between elements (only arc disabled)',
+ )
+ array_space_z = bpy.props.FloatProperty(
+ name='Distance Z',
+ min=-10, max=10, default=0, precision=3,
+ description='Combined X/Z distance between elements (only arc disabled)',
+ )
+ ramp = bpy.props.BoolProperty(
+ name="Deform",
+ description="Deform top base with Z displacement", default=True,
+ )
+ array_space_factor = bpy.props.FloatProperty(
+ name='Move Y center',
+ min=0.00, max=1, default=0.0, precision=3,
+ description='Move the center of the arch in Y axis. (0 centered)',
+ )
+
+ # -----------------------------------------------------
+ # Draw (create UI interface)
+ # -----------------------------------------------------
+ # noinspection PyUnusedLocal
+ def draw(self, context):
+ layout = self.layout
+ space = bpy.context.space_data
+ if not space.local_view:
+ # Imperial units warning
+ if bpy.context.scene.unit_settings.system == "IMPERIAL":
+ row = layout.row()
+ row.label("Warning: Imperial units not supported", icon='COLOR_RED')
+ box = layout.box()
+ box.prop(self, 'model')
+ # Circular
+ if self.model == "1":
+ box.prop(self, 'keep_size')
+ box.prop(self, 'rad_top')
+ if self.keep_size is False:
+ row = box.row()
+ row.prop(self, 'rad_mid')
+ row.prop(self, 'shift')
+ box.prop(self, 'rad_bottom')
+
+ # Rectangular
+ if self.model == "2":
+ box.prop(self, 'col_sx')
+ box.prop(self, 'col_sy')
+
+ box.prop(self, 'col_height')
+
+ box = layout.box()
+ box.prop(self, 'box_base')
+ if self.box_base is True:
+ row = box.row()
+ row.prop(self, 'box_base_x')
+ row.prop(self, 'box_base_y')
+ row.prop(self, 'box_base_z')
+
+ box = layout.box()
+ box.prop(self, 'box_top')
+ if self.box_top is True:
+ row = box.row()
+ row.prop(self, 'box_top_x')
+ row.prop(self, 'box_top_y')
+ row.prop(self, 'box_top_z')
+
+ box = layout.box()
+ box.prop(self, 'cir_base')
+ if self.cir_base is True:
+ row = box.row()
+ row.prop(self, 'cir_base_r')
+ row.prop(self, 'cir_base_z')
+
+ box = layout.box()
+ box.prop(self, 'cir_top')
+ if self.cir_top is True:
+ row = box.row()
+ row.prop(self, 'cir_top_r')
+ row.prop(self, 'cir_top_z')
+
+ box = layout.box()
+ box.prop(self, 'arc_top')
+ if self.arc_top is True:
+ row = box.row()
+ row.prop(self, 'arc_radio')
+ row.prop(self, 'arc_width')
+ row = box.row()
+ row.prop(self, 'arc_gap')
+ row.prop(self, 'array_space_factor')
+
+ box = layout.box()
+ box.prop(self, 'crt_array')
+ if self.crt_array is True:
+ row = box.row()
+ row.prop(self, 'array_num_x')
+ row.prop(self, 'array_num_y')
+ if self.arc_top is True:
+ box.label("Use arch radio and thickness to set distances")
+
+ if self.arc_top is False:
+ row = box.row()
+ row.prop(self, 'array_space_x')
+ row.prop(self, 'array_space_y')
+ row = box.row()
+ row.prop(self, 'array_space_z')
+ row.prop(self, 'ramp')
+
+ box = layout.box()
+ box.prop(self, 'crt_mat')
+ else:
+ row = layout.row()
+ row.label("Warning: Operator does not work in local view mode", icon='ERROR')
+
+ # -----------------------------------------------------
+ # Execute
+ # -----------------------------------------------------
+ # noinspection PyUnusedLocal
+ def execute(self, context):
+ if bpy.context.mode == "OBJECT":
+ create_column_mesh(self)
+ return {'FINISHED'}
+ else:
+ self.report({'WARNING'}, "Archimesh: Option only valid in Object mode")
+ return {'CANCELLED'}
+
+
+# ------------------------------------------------------------------------------
+# Generate mesh data
+# All custom values are passed using self container (self.myvariable)
+# ------------------------------------------------------------------------------
+def create_column_mesh(self):
+ myarc = None
+ cir_top = None
+ cir_bottom = None
+ box_top = None
+ box_bottom = None
+ mycolumn = None
+ # deactivate others
+ for o in bpy.data.objects:
+ if o.select is True:
+ o.select = False
+
+ bpy.ops.object.select_all(False)
+
+ radio_top = self.rad_top
+ if self.keep_size is True:
+ radio_mid = radio_top
+ radio_bottom = radio_top
+ else:
+ radio_mid = self.rad_mid
+ radio_bottom = self.rad_bottom
+
+ # Calculate height
+ height = self.col_height
+ if self.box_base:
+ height = height - self.box_base_z
+ if self.box_top:
+ height = height - self.box_top_z
+ # ------------------------
+ # Create circular column
+ # ------------------------
+ if self.model == "1":
+ bpy.ops.object.select_all(False)
+ mycolumn = create_circular_column(self, "Column", radio_top, radio_mid, radio_bottom, height)
+ mycolumn.select = True
+ bpy.context.scene.objects.active = mycolumn
+ # Subsurf
+ set_smooth(mycolumn)
+ set_modifier_subsurf(mycolumn)
+ # ------------------------
+ # Create rectangular column
+ # ------------------------
+ if self.model == "2":
+ mycolumn = create_rectangular_base(self, "Column", self.col_sx, self.col_sy, height)
+ bpy.ops.object.select_all(False)
+ mycolumn.select = True
+ bpy.context.scene.objects.active = mycolumn
+ set_normals(mycolumn)
+ # ------------------------
+ # Circular base
+ # ------------------------
+ if self.cir_base is True:
+ cir_bottom = create_torus("Column_cir_bottom", radio_bottom, self.cir_base_r, self.cir_base_z)
+ bpy.ops.object.select_all(False)
+ cir_bottom.select = True
+ bpy.context.scene.objects.active = cir_bottom
+ set_modifier_subsurf(cir_bottom)
+ set_smooth(cir_bottom)
+ cir_bottom.location.x = 0.0
+ cir_bottom.location.y = 0.0
+ cir_bottom.location.z = self.cir_base_z / 2
+ cir_bottom.parent = mycolumn
+
+ # ------------------------
+ # Rectangular base
+ # ------------------------
+ if self.box_base is True:
+ box_bottom = create_rectangular_base(self, "Column_box_bottom", self.box_base_x, self.box_base_y,
+ self.box_base_z)
+ bpy.ops.object.select_all(False)
+ box_bottom.select = True
+ bpy.context.scene.objects.active = box_bottom
+ box_bottom.parent = mycolumn
+ set_normals(box_bottom)
+ box_bottom.location.x = 0.0
+ box_bottom.location.y = 0.0
+ box_bottom.location.z = - self.box_base_z
+ # move column
+ mycolumn.location.z += self.box_base_z
+
+ # ------------------------
+ # Circular top
+ # ------------------------
+ if self.cir_top is True:
+ cir_top = create_torus("Column_cir_top", radio_top, self.cir_top_r, self.cir_top_z)
+ bpy.ops.object.select_all(False)
+ cir_top.select = True
+ bpy.context.scene.objects.active = cir_top
+ set_modifier_subsurf(cir_top)
+ set_smooth(cir_top)
+ cir_top.parent = mycolumn
+ cir_top.location.x = 0.0
+ cir_top.location.y = 0.0
+ cir_top.location.z = height - self.cir_top_z / 2
+
+ # ------------------------
+ # Rectangular top
+ # ------------------------
+ if self.box_top is True:
+ box_top = create_rectangular_base(self, "Column_box_top", self.box_top_x, self.box_top_y,
+ self.box_top_z, self.ramp)
+ bpy.ops.object.select_all(False)
+ box_top.select = True
+ bpy.context.scene.objects.active = box_top
+ set_normals(box_top)
+ box_top.parent = mycolumn
+ box_top.location.x = 0.0
+ box_top.location.y = 0.0
+ box_top.location.z = height
+
+ # ------------------------
+ # Create arc
+ # ------------------------
+ if self.arc_top:
+ myarc = create_arc("Column_arch", self.arc_radio, self.arc_gap, self.arc_width,
+ self.array_space_factor)
+ myarc.parent = mycolumn
+ bpy.ops.object.select_all(False)
+ myarc.select = True
+ bpy.context.scene.objects.active = myarc
+ set_normals(myarc)
+ set_modifier_mirror(myarc, "X")
+ myarc.location.x = self.arc_radio + self.arc_gap
+ myarc.location.y = 0.0
+ if self.box_top is True:
+ myarc.location.z = height + self.box_top_z
+ else:
+ myarc.location.z = height
+ # ------------------------
+ # Create Array X
+ # ------------------------
+ if self.array_num_x > 0:
+ if self.arc_top:
+ distance = ((self.arc_radio + self.arc_gap) * 2)
+ zmove = 0
+ else:
+ distance = self.array_space_x
+ zmove = self.array_space_z
+
+ if self.crt_array:
+ set_modifier_array(mycolumn, "X", 0, self.array_num_x, True, distance, zmove)
+
+ if self.box_base is True:
+ set_modifier_array(box_bottom, "X", 0, self.array_num_x, True, distance, zmove)
+ if self.box_top is True:
+ set_modifier_array(box_top, "X", 0, self.array_num_x, True, distance, zmove)
+
+ if self.cir_base is True:
+ set_modifier_array(cir_bottom, "X", 0, self.array_num_x, True, distance, zmove)
+ if self.cir_top is True:
+ set_modifier_array(cir_top, "X", 0, self.array_num_x, True, distance, zmove)
+
+ if self.arc_top:
+ if self.array_num_x > 1:
+ set_modifier_array(myarc, "X", 1, self.array_num_x - 1) # one arc minus
+ # ------------------------
+ # Create Array Y
+ # ------------------------
+ if self.array_num_y > 0:
+ if self.arc_top:
+ distance = self.arc_width
+ else:
+ distance = self.array_space_y
+
+ if self.crt_array:
+ set_modifier_array(mycolumn, "Y", 0, self.array_num_y, True, distance)
+
+ if self.box_base is True:
+ set_modifier_array(box_bottom, "Y", 0, self.array_num_y, True, distance)
+ if self.box_top is True:
+ set_modifier_array(box_top, "Y", 0, self.array_num_y, True, distance)
+
+ if self.cir_base is True:
+ set_modifier_array(cir_bottom, "Y", 0, self.array_num_y, True, distance)
+ if self.cir_top is True:
+ set_modifier_array(cir_top, "Y", 0, self.array_num_y, True, distance)
+
+ if self.arc_top:
+ if self.array_num_y > 1:
+ set_modifier_array(myarc, "Y", 1, self.array_num_y - 1) # one less
+
+ # ------------------------
+ # Create materials
+ # ------------------------
+ if self.crt_mat:
+ # Column material
+ mat = create_diffuse_material("Column_material", False, 0.748, 0.734, 0.392, 0.573, 0.581, 0.318)
+ set_material(mycolumn, mat)
+
+ if self.box_base is True or self.box_top is True:
+ mat = create_diffuse_material("Column_rect", False, 0.56, 0.56, 0.56, 0.56, 0.56, 0.56)
+ if self.box_base is True:
+ set_material(box_bottom, mat)
+ if self.box_top is True:
+ set_material(box_top, mat)
+
+ if self.cir_base is True or self.cir_top is True:
+ mat = create_diffuse_material("Column_cir", False, 0.65, 0.65, 0.65, 0.65, 0.65, 0.65)
+ if self.cir_base is True:
+ set_material(cir_bottom, mat)
+ if self.cir_top is True:
+ set_material(cir_top, mat)
+
+ if self.arc_top:
+ mat = create_diffuse_material("Column_arch", False, 0.8, 0.8, 0.8)
+ set_material(myarc, mat)
+
+ bpy.ops.object.select_all(False)
+ mycolumn.select = True
+ bpy.context.scene.objects.active = mycolumn
+
+ return
+
+
+# ------------------------------------------------------------------------------
+# Create Column
+# ------------------------------------------------------------------------------
+def create_circular_column(self, objname, radio_top, radio_mid, radio_bottom, height):
+ myvertex = []
+ myfaces = []
+ pies = [0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330] # circle
+
+ # Add bottom circle
+ for pie in pies:
+ x = math.cos(math.radians(pie)) * radio_bottom
+ y = math.sin(math.radians(pie)) * radio_bottom
+ mypoint = [(x, y, 0.0)]
+ myvertex.extend(mypoint)
+ # Add middle circle
+ for pie in pies:
+ x = math.cos(math.radians(pie)) * radio_mid
+ y = math.sin(math.radians(pie)) * radio_mid
+ mypoint = [(x, y, (height / 2) + ((height / 2) * self.shift))]
+ myvertex.extend(mypoint)
+ # Add top circle
+ for pie in pies:
+ x = math.cos(math.radians(pie)) * radio_top
+ y = math.sin(math.radians(pie)) * radio_top
+ mypoint = [(x, y, height)]
+ myvertex.extend(mypoint)
+ # -------------------------------------
+ # Faces
+ # -------------------------------------
+ t = 1
+ for n in range(0, len(pies) * 2):
+ t += 1
+ if t > len(pies):
+ t = 1
+ myface = [(n, n - len(pies) + 1, n + 1, n + len(pies))]
+ myfaces.extend(myface)
+ else:
+ myface = [(n, n + 1, n + len(pies) + 1, n + len(pies))]
+ myfaces.extend(myface)
+
+ mesh = bpy.data.meshes.new(objname)
+ myobject = bpy.data.objects.new(objname, mesh)
+
+ myobject.location = bpy.context.scene.cursor_location
+ bpy.context.scene.objects.link(myobject)
+
+ mesh.from_pydata(myvertex, [], myfaces)
+ mesh.update(calc_edges=True)
+
+ return myobject
+
+
+# ------------------------------------------------------------------------------
+# Create Torus
+# ------------------------------------------------------------------------------
+def create_torus(objname, radio_inside, radio_outside, height):
+ myvertex = []
+ myfaces = []
+ pies = [0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330] # circle
+ segments = [80, 60, 30, 0, 330, 300, 280] # section
+
+ radio_mid = radio_outside + radio_inside - (height / 2)
+ # Add internal circles Top
+ for pie in pies:
+ x = math.cos(math.radians(pie)) * radio_inside
+ y = math.sin(math.radians(pie)) * radio_inside
+ mypoint = [(x, y, height / 2)]
+ myvertex.extend(mypoint)
+ # Add external circles Top
+ for pie in pies:
+ x = math.cos(math.radians(pie)) * radio_mid
+ y = math.sin(math.radians(pie)) * radio_mid
+ mypoint = [(x, y, height / 2)]
+ myvertex.extend(mypoint)
+ # Add Intermediate lines
+ for segment in segments:
+ for pie in pies:
+ radio_externo = radio_mid + (height * math.cos(math.radians(segment)))
+ x = math.cos(math.radians(pie)) * radio_externo
+ y = math.sin(math.radians(pie)) * radio_externo
+ z = math.sin(math.radians(segment)) * (height / 2)
+
+ mypoint = [(x, y, z)]
+ myvertex.extend(mypoint)
+
+ # Add internal circles Bottom
+ for pie in pies:
+ x = math.cos(math.radians(pie)) * radio_inside
+ y = math.sin(math.radians(pie)) * radio_inside
+ mypoint = [(x, y, height / 2 * -1)]
+ myvertex.extend(mypoint)
+ # Add external circles bottom
+ for pie in pies:
+ x = math.cos(math.radians(pie)) * radio_mid
+ y = math.sin(math.radians(pie)) * radio_mid
+ mypoint = [(x, y, height / 2 * -1)]
+ myvertex.extend(mypoint)
+
+ # -------------------------------------
+ # Faces
+ # -------------------------------------
+ t = 1
+ for n in range(0, len(pies) * len(segments) + (len(pies) * 2)):
+ t += 1
+ if t > len(pies):
+ t = 1
+ myface = [(n, n - len(pies) + 1, n + 1, n + len(pies))]
+ myfaces.extend(myface)
+ else:
+ myface = [(n, n + 1, n + len(pies) + 1, n + len(pies))]
+ myfaces.extend(myface)
+
+ mesh = bpy.data.meshes.new(objname)
+ myobject = bpy.data.objects.new(objname, mesh)
+
+ myobject.location = bpy.context.scene.cursor_location
+ bpy.context.scene.objects.link(myobject)
+
+ mesh.from_pydata(myvertex, [], myfaces)
+ mesh.update(calc_edges=True)
+
+ return myobject
+
+
+# ------------------------------------------------------------------------------
+# Create rectangular base
+# ------------------------------------------------------------------------------
+def create_rectangular_base(self, objname, x, y, z, ramp=False):
+ elements = self.array_num_x - 1
+ height = self.array_space_z * elements
+ width = self.array_space_x * elements
+ if width > 0:
+ angle = math.atan(height / width)
+ else:
+ angle = 0
+
+ radio = math.sqrt((x * x) + (self.array_space_z * self.array_space_z))
+ disp = radio * math.sin(angle)
+
+ if ramp is False or self.arc_top:
+ addz1 = 0
+ addz2 = 0
+ else:
+ if self.array_space_z >= 0:
+ addz1 = 0
+ addz2 = disp
+ else:
+ addz1 = disp * -1
+ addz2 = 0
+
+ myvertex = [(-x / 2, -y / 2, 0.0),
+ (-x / 2, y / 2, 0.0),
+ (x / 2, y / 2, 0.0),
+ (x / 2, -y / 2, 0.0),
+ (-x / 2, -y / 2, z + addz1),
+ (-x / 2, y / 2, z + addz1),
+ (x / 2, y / 2, z + addz2),
+ (x / 2, -y / 2, z + addz2)]
+
+ myfaces = [(0, 1, 2, 3), (0, 1, 5, 4), (1, 2, 6, 5), (2, 6, 7, 3), (5, 6, 7, 4), (0, 4, 7, 3)]
+
+ mesh = bpy.data.meshes.new(objname)
+ myobject = bpy.data.objects.new(objname, mesh)
+
+ myobject.location = bpy.context.scene.cursor_location
+ bpy.context.scene.objects.link(myobject)
+
+ mesh.from_pydata(myvertex, [], myfaces)
+ mesh.update(calc_edges=True)
+
+ return myobject
+
+
+# ------------------------------------------------------------------------------
+# Create arc
+# ------------------------------------------------------------------------------
+def create_arc(objname, radio, gap, thickness, center):
+ myvertex = []
+
+ half = (thickness / 2)
+ move = half * center
+
+ listdata = [half + move, -half + move]
+ for pos_y in listdata:
+ # --------------------------------
+ # First vertices
+ # --------------------------------
+ myvertex.extend([(-radio - gap, pos_y, radio + radio / 10)])
+ # Flat cuts
+ angle = 13 * (180 / 16)
+ for i in range(1, 4):
+ z = math.sin(math.radians(angle)) * radio
+ mypoint = [(-radio - gap, pos_y, z)]
+ myvertex.extend(mypoint)
+ angle += 180 / 16
+
+ myvertex.extend([(-radio - gap, pos_y, 0.0)])
+ # --------------------------------
+ # Arc points
+ # --------------------------------
+ angle = 180
+ for i in range(0, 9):
+ x = math.cos(math.radians(angle)) * radio
+ z = math.sin(math.radians(angle)) * radio
+ mypoint = [(x, pos_y, z)]
+ myvertex.extend(mypoint)
+
+ angle -= 180 / 16
+ # --------------------------------
+ # vertical cut points
+ # --------------------------------
+ angle = 8 * (180 / 16)
+ for i in range(1, 5):
+ x = math.cos(math.radians(angle)) * radio
+ mypoint = [(x, pos_y, radio + radio / 10)]
+ myvertex.extend(mypoint)
+
+ angle += 180 / 16
+
+ myfaces = [(23, 24, 21, 22), (24, 25, 20, 21), (25, 26, 19, 20), (27, 18, 19, 26), (18, 27, 28, 35),
+ (28, 29, 34, 35), (29, 30, 33, 34), (30, 31, 32, 33), (12, 13, 31, 30), (29, 11, 12, 30),
+ (11, 29, 28, 10), (10, 28, 27, 9), (9, 27, 26, 8), (25, 7, 8, 26), (24, 6, 7, 25),
+ (23, 5, 6, 24), (22, 4, 5, 23), (5, 4, 3, 6), (6, 3, 2, 7), (7, 2, 1, 8),
+ (8, 1, 0, 9), (9, 0, 17, 10), (10, 17, 16, 11), (11, 16, 15, 12), (14, 13, 12, 15),
+ (21, 3, 4, 22), (20, 2, 3, 21), (19, 1, 2, 20), (1, 19, 18, 0), (0, 18, 35, 17),
+ (17, 35, 34, 16), (33, 15, 16, 34), (32, 14, 15, 33)]
+
+ mesh = bpy.data.meshes.new(objname)
+ myobject = bpy.data.objects.new(objname, mesh)
+
+ myobject.location = bpy.context.scene.cursor_location
+ bpy.context.scene.objects.link(myobject)
+
+ mesh.from_pydata(myvertex, [], myfaces)
+ mesh.update(calc_edges=True)
+
+ return myobject
diff --git a/archimesh/achm_curtain_maker.py b/archimesh/achm_curtain_maker.py
new file mode 100644
index 00000000..30e4f456
--- /dev/null
+++ b/archimesh/achm_curtain_maker.py
@@ -0,0 +1,1110 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+# ----------------------------------------------------------
+# Automatic generation of curtains
+# Author: Antonio Vazquez (antonioya)
+#
+# ----------------------------------------------------------
+# noinspection PyUnresolvedReferences
+import bpy
+import colorsys
+import copy
+import math
+from achm_tools import *
+
+
+# ------------------------------------------------------------------
+# Define UI class
+# Japanese curtains
+# ------------------------------------------------------------------
+class AchmJapan(bpy.types.Operator):
+ bl_idname = "mesh.archimesh_japan"
+ bl_label = "Japanese curtains"
+ bl_description = "Japanese curtains Generator"
+ bl_category = 'Archimesh'
+ bl_options = {'REGISTER', 'UNDO'}
+
+ width = bpy.props.FloatProperty(
+ name='Width',
+ min=0.30, max=4, default=1, precision=3,
+ description='Total width',
+ )
+ height = bpy.props.FloatProperty(
+ name='Height',
+ min=0.20, max=50, default=1.8, precision=3,
+ description='Total height',
+ )
+ num = bpy.props.IntProperty(
+ name='Rails',
+ min=2, max=5, default=2,
+ description='Number total of rails',
+ )
+ palnum = bpy.props.IntProperty(
+ name='Panels',
+ min=1, max=2, default=1,
+ description='Panels by rail',
+ )
+
+ open01 = bpy.props.FloatProperty(
+ name='Position 01',
+ min=0, max=1, default=0, precision=3,
+ description='Position of the panel',
+ )
+ open02 = bpy.props.FloatProperty(
+ name='Position 02',
+ min=0, max=1, default=0, precision=3,
+ description='Position of the panel',
+ )
+ open03 = bpy.props.FloatProperty(
+ name='Position 03',
+ min=0, max=1, default=0, precision=3,
+ description='Position of the panel',
+ )
+ open04 = bpy.props.FloatProperty(
+ name='Position 04',
+ min=0, max=1, default=0, precision=3,
+ description='Position of the panel',
+ )
+ open05 = bpy.props.FloatProperty(
+ name='Position 05',
+ min=0, max=1, default=0, precision=3,
+ description='Position of the panel',
+ )
+
+ # Materials
+ crt_mat = bpy.props.BoolProperty(
+ name="Create default Cycles materials",
+ description="Create default materials for Cycles render",
+ default=True,
+ )
+
+ # -----------------------------------------------------
+ # Draw (create UI interface)
+ # -----------------------------------------------------
+ # noinspection PyUnusedLocal
+ def draw(self, context):
+ layout = self.layout
+ space = bpy.context.space_data
+ if not space.local_view:
+ # Imperial units warning
+ if bpy.context.scene.unit_settings.system == "IMPERIAL":
+ row = layout.row()
+ row.label("Warning: Imperial units not supported", icon='COLOR_RED')
+
+ box = layout.box()
+ row = box.row()
+ row.prop(self, 'width')
+ row.prop(self, 'height')
+ row = box.row()
+ row.prop(self, 'num')
+ row.prop(self, 'palnum')
+
+ if self.num >= 1:
+ row = box.row()
+ row.prop(self, 'open01', slider=True)
+ if self.num >= 2:
+ row = box.row()
+ row.prop(self, 'open02', slider=True)
+ if self.num >= 3:
+ row = box.row()
+ row.prop(self, 'open03', slider=True)
+ if self.num >= 4:
+ row = box.row()
+ row.prop(self, 'open04', slider=True)
+ if self.num >= 5:
+ row = box.row()
+ row.prop(self, 'open05', slider=True)
+
+ box = layout.box()
+ box.prop(self, 'crt_mat')
+ if self.crt_mat:
+ box.label("* Remember to verify fabric texture folder")
+ else:
+ row = layout.row()
+ row.label("Warning: Operator does not work in local view mode", icon='ERROR')
+
+ # -----------------------------------------------------
+ # Execute
+ # -----------------------------------------------------
+ # noinspection PyUnusedLocal
+ def execute(self, context):
+ if bpy.context.mode == "OBJECT":
+ create_japan_mesh(self)
+ return {'FINISHED'}
+ else:
+ self.report({'WARNING'}, "Archimesh: Option only valid in Object mode")
+ return {'CANCELLED'}
+
+
+# ------------------------------------------------------------------------------
+# Generate mesh data
+# All custom values are passed using self container (self.myvariable)
+# ------------------------------------------------------------------------------
+def create_japan_mesh(self):
+ # deactivate others
+ for o in bpy.data.objects:
+ if o.select is True:
+ o.select = False
+ bpy.ops.object.select_all(False)
+ # Create units
+ generate_japan(self)
+
+ return
+
+
+# ------------------------------------------------------------------
+# Define UI class
+# Roller curtains
+# ------------------------------------------------------------------
+class AchmRoller(bpy.types.Operator):
+ bl_idname = "mesh.archimesh_roller"
+ bl_label = "Roller curtains"
+ bl_description = "Roller_curtains Generator"
+ bl_category = 'Archimesh'
+ bl_options = {'REGISTER', 'UNDO'}
+
+ width = bpy.props.FloatProperty(
+ name='Width',
+ min=0.30, max=4, default=1, precision=3,
+ description='Total width',
+ )
+ height = bpy.props.FloatProperty(
+ name='Height',
+ min=0.01, max=50, default=1.7, precision=3,
+ description='Total height',
+ )
+
+ # Materials
+ crt_mat = bpy.props.BoolProperty(
+ name="Create default Cycles materials",
+ description="Create default materials for Cycles render",
+ default=True,
+ )
+
+ # -----------------------------------------------------
+ # Draw (create UI interface)
+ # -----------------------------------------------------
+ # noinspection PyUnusedLocal
+ def draw(self, context):
+ layout = self.layout
+ space = bpy.context.space_data
+ if not space.local_view:
+ # Imperial units warning
+ if bpy.context.scene.unit_settings.system == "IMPERIAL":
+ row = layout.row()
+ row.label("Warning: Imperial units not supported", icon='COLOR_RED')
+
+ box = layout.box()
+ row = box.row()
+ row.prop(self, 'width')
+ row.prop(self, 'height')
+
+ box = layout.box()
+ box.prop(self, 'crt_mat')
+ if self.crt_mat:
+ box.label("* Remember to verify fabric texture folder")
+ else:
+ row = layout.row()
+ row.label("Warning: Operator does not work in local view mode", icon='ERROR')
+
+ # -----------------------------------------------------
+ # Execute
+ # -----------------------------------------------------
+ # noinspection PyUnusedLocal
+ def execute(self, context):
+ if bpy.context.mode == "OBJECT":
+ create_roller_mesh(self)
+ return {'FINISHED'}
+ else:
+ self.report({'WARNING'}, "Archimesh: Option only valid in Object mode")
+ return {'CANCELLED'}
+
+
+# ------------------------------------------------------------------------------
+# Generate mesh data
+# All custom values are passed using self container (self.myvariable)
+# ------------------------------------------------------------------------------
+def create_roller_mesh(self):
+ # deactivate others
+ for o in bpy.data.objects:
+ if o.select is True:
+ o.select = False
+ bpy.ops.object.select_all(False)
+ generate_roller(self)
+
+ return
+
+
+# ------------------------------------------------------------------------------
+# Generate japanese curtains
+# All custom values are passed using self container (self.myvariable)
+# ------------------------------------------------------------------------------
+def generate_japan(self):
+ support = []
+ panel = []
+
+ location = bpy.context.scene.cursor_location
+ myloc = copy.copy(location) # copy location to keep 3D cursor position
+
+ # ------------------
+ # Rail
+ # ------------------
+ myrail = create_japan_rail("Rail",
+ self.width - 0.02, self.num,
+ myloc.x, myloc.y, myloc.z,
+ self.crt_mat)
+ # refine
+ remove_doubles(myrail)
+ set_normals(myrail)
+
+ # --------------------------------------------------------------------------------
+ # Supports
+ # --------------------------------------------------------------------------------
+ width = (self.width / self.num) / self.palnum
+ # left
+ posx = 0.01 + 0.01
+ posy = 0.006
+ posz = 0.006
+ for x in range(self.num):
+ mysup = create_japan_support("Support_" + str(x) + ".L",
+ width - 0.02, # subtract 2 cm
+ 0, 0, 0,
+ self.crt_mat)
+ support.extend([mysup])
+ mysup.parent = myrail
+
+ if x == 0:
+ f = self.open01
+ if x == 1:
+ f = self.open02
+ if x == 2:
+ f = self.open03
+ if x == 3:
+ f = self.open04
+ if x == 4:
+ f = self.open05
+
+ if self.palnum == 1:
+ maxpos = ((self.width / self.palnum) - width - 0.02) * f
+ else:
+ maxpos = ((self.width / self.palnum) - width) * f
+
+ mysup.location.x = posx + maxpos
+ mysup.location.y = -posy
+ mysup.location.z = posz
+
+ posy += 0.015
+ # Right
+ if self.palnum > 1:
+ posx = self.width - width # + 0.01
+ posy = 0.006
+ posz = 0.006
+ for x in range(self.num):
+ mysup = create_japan_support("Support_" + str(x) + ".R",
+ width - 0.02, # subtract 2 cm
+ 0, 0, 0,
+ self.crt_mat)
+ support.extend([mysup])
+ mysup.parent = myrail
+
+ if x == 0:
+ f = self.open01
+ if x == 1:
+ f = self.open02
+ if x == 2:
+ f = self.open03
+ if x == 3:
+ f = self.open04
+ if x == 4:
+ f = self.open05
+
+ maxpos = ((self.width / self.palnum) - width) * f
+
+ mysup.location.x = posx - maxpos
+ mysup.location.y = -posy
+ mysup.location.z = posz
+
+ posy += 0.015
+ # --------------------------------------------------------------------------------
+ # Panels
+ # --------------------------------------------------------------------------------
+ width = ((self.width / self.num) / self.palnum) + 0.01
+ posx = -0.01
+ posy = -0.006
+ posz = -0.008
+ x = 1
+ fabricmat = None
+ if self.crt_mat:
+ fabricmat = create_fabric_material("Fabric_material", False, 0.653, 0.485, 0.265,
+ 0.653, 0.485, 0.265)
+
+ for sup in support:
+ mypanel = create_japan_panel("Panel_" + str(x),
+ width, self.height,
+ 0, 0, 0,
+ self.crt_mat, fabricmat)
+ panel.extend([mypanel])
+ mypanel.parent = sup
+ mypanel.location.x = posx
+ mypanel.location.y = posy
+ mypanel.location.z = posz
+ x += 1
+ # ------------------------
+ # Strings
+ # ------------------------
+ x = myrail.location.x
+ y = myrail.location.y
+ z = myrail.location.z
+
+ long = -1
+ if self.height < 1:
+ long = -self.height
+
+ myp = [((0, 0, 0), (- 0.25, 0, 0), (0.0, 0, 0)),
+ ((0, 0, long), (- 0.01, 0, long), (0.25, 0, long))] # double element
+ mycurve1 = create_bezier("String_1", myp, (x, y, z))
+ mycurve1.parent = myrail
+ mycurve1.location.x = self.width
+ mycurve1.location.y = -0.004
+ mycurve1.location.z = 0.005
+
+ mycurve2 = create_bezier("String_2", myp, (x, y, z))
+ mycurve2.parent = myrail
+ mycurve2.location.x = self.width
+ mycurve2.location.y = -0.01
+ mycurve2.location.z = 0.005
+
+ if self.crt_mat:
+ mat = create_diffuse_material("String_material", False, 0.1, 0.1, 0.1,
+ 0.1, 0.1, 0.1, 0.01)
+ set_material(mycurve1, mat)
+ set_material(mycurve2, mat)
+
+ # refine
+ for obj in support:
+ remove_doubles(obj)
+ set_normals(obj)
+
+ # deactivate others
+ for o in bpy.data.objects:
+ if o.select is True:
+ o.select = False
+
+ myrail.select = True
+ bpy.context.scene.objects.active = myrail
+
+ return
+
+
+# ------------------------------------------------------------------------------
+# Create japan rail
+#
+# objName: Name for the new object
+# sX: Size in X axis
+# ways: Number of ways
+# pX: position X axis
+# pY: position Y axis
+# pZ: position Z axis
+# mat: Flag for creating materials
+# ------------------------------------------------------------------------------
+def create_japan_rail(objname, sx, ways, px, py, pz, mat):
+ myvertex = []
+ myfaces = []
+
+ waysize = 0.005 # gap
+ sz = 0.0145
+ size = 0.005
+ sizeint = 0.01
+ tap = 0.01
+ sy = (size * 2) + (waysize * ways) + (sizeint * (ways - 1))
+ v = 0
+ # left extension
+ myvertex.extend([(0, 0, 0), (0, 0, sz), (0, -sy, sz), (0, -sy, 0),
+ (tap, 0, 0), (tap, 0, sz), (tap, -sy, sz), (tap, -sy, 0)])
+ 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)])
+ v += 8
+ # Center
+ myvertex.extend([(tap, -size, size), (tap, -size, 0), (tap, 0, 0), (tap, 0, sz), (tap, -sy, sz), (tap, -sy, 0),
+ (tap, -sy + size, 0), (tap, -sy + size, sz - 0.002)])
+ myvertex.extend([(sx + tap, -size, size), (sx + tap, -size, 0), (sx + tap, 0, 0),
+ (sx + tap, 0, sz), (sx + tap, -sy, sz),
+ (sx + tap, -sy, 0), (sx + tap, -sy + size, 0), (sx + tap, -sy + size, sz - 0.002)])
+ 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),
+ (v + 3, v + 11, v + 12, v + 4),
+ (v + 4, v + 12, v + 13, v + 5), (v + 5, v + 13, v + 14, v + 6), (v + 7, v + 15, v + 14, v + 6)])
+ v += 16
+ # Right extension
+ myvertex.extend([(sx + tap, 0, 0), (sx + tap, 0, sz), (sx + tap, -sy, sz),
+ (sx + tap, -sy, 0), (sx + tap + tap, 0, 0),
+ (sx + tap + tap, 0, sz), (sx + tap + tap, -sy, sz), (sx + tap + tap, -sy, 0)])
+ myfaces.extend([(v, v + 1, v + 2, v + 3), (v + 4, v + 5, v + 6, v + 7),
+ (v, v + 1, v + 5, v + 4), (v + 3, v + 2, v + 6, v + 7),
+ (v + 2, v + 1, v + 5, v + 6), (v + 3, v, v + 4, v + 7)])
+ v += 8
+
+ # Internal
+ space = waysize + size
+ if ways > 1:
+ for x in range(ways - 1):
+ myvertex.extend([(tap, -space, sz), (tap, -space, 0), (tap, -space - sizeint, 0),
+ (tap, -space - sizeint, size)])
+ myvertex.extend([(sx + tap, -space, sz), (sx + tap, -space, 0), (sx + tap, -space - sizeint, 0),
+ (sx + tap, -space - sizeint, size)])
+ 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)])
+ v += 8
+ space = space + waysize + sizeint
+
+ mymesh = bpy.data.meshes.new(objname)
+ myobject = bpy.data.objects.new(objname, mymesh)
+
+ myobject.location[0] = px
+ myobject.location[1] = py
+ myobject.location[2] = pz
+ bpy.context.scene.objects.link(myobject)
+
+ mymesh.from_pydata(myvertex, [], myfaces)
+ mymesh.update(calc_edges=True)
+
+ # ---------------------------------
+ # Materials
+ # ---------------------------------
+ if mat:
+ # External
+ mat = create_diffuse_material(objname + "_material", False, 0.8, 0.8, 0.8, 0.6, 0.6, 0.6, 0.15)
+ set_material(myobject, mat)
+
+ return myobject
+
+
+# ------------------------------------------------------------------------------
+# Create japan support
+#
+# objName: Name for the new object
+# sX: Size in X axis
+# pX: position X axis
+# pY: position Y axis
+# pZ: position Z axis
+# mat: Flag for creating materials
+# ------------------------------------------------------------------------------
+def create_japan_support(objname, sx, px, py, pz, mat):
+ myvertex = []
+ myfaces = []
+
+ waysize = 0.008
+ sz = 0.015
+ sy = 0.006
+
+ myvertex.extend([(0, 0, 0), (0, 0, -sz), (0, -sy, -sz), (0, -sy, -waysize), (0, -0.003, -waysize), (0, -0.003, 0)])
+ myvertex.extend(
+ [(sx, 0, 0), (sx, 0, -sz), (sx, -sy, -sz), (sx, -sy, - waysize), (sx, -0.003, -waysize), (sx, -0.003, 0)])
+ myfaces.extend(
+ [(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),
+ (6, 7, 8, 9, 10, 11)])
+
+ mymesh = bpy.data.meshes.new(objname)
+ myobject = bpy.data.objects.new(objname, mymesh)
+
+ myobject.location[0] = px
+ myobject.location[1] = py
+ myobject.location[2] = pz
+ bpy.context.scene.objects.link(myobject)
+
+ mymesh.from_pydata(myvertex, [], myfaces)
+ mymesh.update(calc_edges=True)
+
+ # ---------------------------------
+ # Materials
+ # ---------------------------------
+ if mat:
+ # External
+ mat = create_diffuse_material(objname + "_material", False, 0.8, 0.8, 0.8, 0.6, 0.6, 0.6, 0.15)
+ set_material(myobject, mat)
+
+ return myobject
+
+
+# ------------------------------------------------------------------------------
+# Create japan panel
+#
+# objName: Name for the new object
+# sX: Size in X axis
+# sZ: Size in Z axis
+# pX: position X axis
+# pY: position Y axis
+# pZ: position Z axis
+# mat: Flag for creating materials
+# fabricMat: Fabric material
+# ------------------------------------------------------------------------------
+def create_japan_panel(objname, sx, sz, px, py, pz, mat, fabricmat):
+ myvertex = []
+ myfaces = []
+
+ myvertex.extend([(0, 0, 0), (0, 0, -sz), (sx, 0, -sz), (sx, 0, 0)])
+ myfaces.extend([(0, 1, 2, 3)])
+
+ mymesh = bpy.data.meshes.new(objname)
+ myobject = bpy.data.objects.new(objname, mymesh)
+
+ myobject.location[0] = px
+ myobject.location[1] = py
+ myobject.location[2] = pz
+ bpy.context.scene.objects.link(myobject)
+
+ mymesh.from_pydata(myvertex, [], myfaces)
+ mymesh.update(calc_edges=True)
+
+ # ---------------------------------
+ # Materials
+ # ---------------------------------
+ if mat:
+ unwrap_mesh(myobject, True)
+ # remap UV to use all texture
+ for uv_loop in myobject.data.uv_layers.active.data:
+ myvector = uv_loop.uv
+ if myvector.x > 0.0001:
+ myvector.x = 1
+
+ set_material(myobject, fabricmat)
+ return myobject
+
+
+# ------------------------------------------------------------------------------
+# Create bezier curve
+# ------------------------------------------------------------------------------
+def create_bezier(objname, points, origin, depth=0.001, fill='FULL'):
+ curvedata = bpy.data.curves.new(name=objname, type='CURVE')
+ curvedata.dimensions = '3D'
+ curvedata.fill_mode = fill
+ curvedata.bevel_resolution = 5
+ curvedata.bevel_depth = depth
+
+ myobject = bpy.data.objects.new(objname, curvedata)
+ myobject.location = origin
+
+ bpy.context.scene.objects.link(myobject)
+
+ polyline = curvedata.splines.new('BEZIER')
+ polyline.bezier_points.add(len(points) - 1)
+
+ for idx, (knot, h1, h2) in enumerate(points):
+ point = polyline.bezier_points[idx]
+ point.co = knot
+ point.handle_left = h1
+ point.handle_right = h2
+ point.handle_left_type = 'FREE'
+ point.handle_right_type = 'FREE'
+
+ return myobject
+
+
+# ------------------------------------------------------------------------------
+# Generate Roller curtains
+# All custom values are passed using self container (self.myvariable)
+# ------------------------------------------------------------------------------
+def generate_roller(self):
+ location = bpy.context.scene.cursor_location
+ myloc = copy.copy(location) # copy location to keep 3D cursor position
+
+ # ------------------
+ # Roller Top
+ # ------------------
+ fabricsolid = None
+ if self.crt_mat:
+ fabricsolid = create_diffuse_material("Fabric_solid_material", False, 0.653, 0.485, 0.265)
+
+ myroller = create_roller_rail("Roller",
+ self.width,
+ 0.035,
+ myloc.x, myloc.y, myloc.z,
+ self.crt_mat, fabricsolid)
+ # refine
+ remove_doubles(myroller)
+ set_normals(myroller)
+
+ # --------------------------------------------------------------------------------
+ # Sides
+ # --------------------------------------------------------------------------------
+ plastic = None
+ if self.crt_mat:
+ plastic = create_diffuse_material("Plastic_roller_material", False, 0.653, 0.485, 0.265, 0.653, 0.485, 0.265,
+ 0.2)
+
+ myside_l = create_roller_sides(myroller, "L",
+ 0.026, 0, 0,
+ self.crt_mat, plastic)
+ # refine
+ remove_doubles(myside_l)
+ set_normals(myside_l)
+
+ myside_r = create_roller_sides(myroller, "R",
+ self.width - 0.026, 0, 0,
+ self.crt_mat, plastic)
+ # refine
+ remove_doubles(myside_r)
+ set_normals(myside_r)
+
+ # --------------------------------------------------------------------------------
+ # Panel
+ # --------------------------------------------------------------------------------
+ fabricmat = None
+ if self.crt_mat:
+ fabricmat = create_fabric_material("Fabric_translucent_material", False, 0.653, 0.485, 0.265, 0.653, 0.485,
+ 0.265)
+
+ mypanel = create_japan_panel("Panel",
+ self.width, self.height,
+ 0, 0, 0,
+ self.crt_mat, fabricmat)
+ mypanel.parent = myroller
+ mypanel.location.x = 0
+ mypanel.location.y = 0.035
+ mypanel.location.z = 0
+ # ------------------
+ # Roller Bottom
+ # ------------------
+ mybottom = create_roller_rail("Roller_bottom",
+ self.width,
+ 0.001,
+ 0, 0, -self.height,
+ self.crt_mat, plastic)
+ mybottom.parent = mypanel
+ # refine
+ remove_doubles(myroller)
+ set_normals(myroller)
+
+ # ------------------------
+ # Strings
+ # ------------------------
+ myp = [((0.0000, -0.0328, -0.0000), (0.0000, -0.0403, -0.3327), (0.0000, -0.0293, 0.1528)),
+ ((0.0000, 0.0000, 0.3900), (0.0000, -0.0264, 0.3900), (-0.0000, 0.0226, 0.3900)),
+ ((-0.0000, 0.0212, 0.0000), (-0.0000, 0.0189, 0.1525), (-0.0000, 0.0260, -0.3326)),
+ ((-0.0000, -0.0000, -0.8518), (-0.0000, 0.0369, -0.8391), (0.0000, -0.0373, -0.8646))] # double element
+ mycurve = create_bezier("String", myp, (0, 0, 0))
+ set_curve_cycle(mycurve)
+ mycurve.parent = myroller
+ mycurve.location.x = self.width + 0.015
+ mycurve.location.y = 0
+ mycurve.location.z = -0.38
+ if self.crt_mat:
+ mat = create_diffuse_material("String_material", False, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.01)
+ set_material(mycurve, mat)
+
+ # deactivate others
+ for o in bpy.data.objects:
+ if o.select is True:
+ o.select = False
+
+ myroller.select = True
+ bpy.context.scene.objects.active = myroller
+
+ return
+
+
+# ------------------------------------------------------------------------------
+# Create roller
+#
+# objName: Object name
+# width: Total width of roller
+# radio: Roll radio
+# pX: position X axis
+# pY: position Y axis
+# pZ: position Z axis
+# mat: create default cycles material
+# mymaterial: plastic material or fabric
+# ------------------------------------------------------------------------------
+def create_roller_rail(objname, width, radio, px, py, pz, mat, mymaterial):
+ myvertex = []
+ myfaces = []
+ pies = 16
+ seg = 0
+
+ # Add right circle
+ for i in range(pies):
+ x = math.cos(math.radians(seg)) * radio
+ y = math.sin(math.radians(seg)) * radio
+ mypoint = [(0.0, x, y)]
+ myvertex.extend(mypoint)
+ seg += 360 / pies
+ # Add left circle
+ seg = 0
+ for i in range(pies):
+ x = math.cos(math.radians(seg)) * radio
+ y = math.sin(math.radians(seg)) * radio
+ mypoint = [(width, x, y)]
+ myvertex.extend(mypoint)
+ seg += 360 / pies
+ # -------------------------------------
+ # Faces
+ # -------------------------------------
+ t = 1
+ for n in range(0, pies):
+ t += 1
+ if t > pies:
+ t = 1
+ myface = [(n, n - pies + 1, n + 1, n + pies)]
+ myfaces.extend(myface)
+ else:
+ myface = [(n, n + 1, n + pies + 1, n + pies)]
+ myfaces.extend(myface)
+
+ mymesh = bpy.data.meshes.new(objname)
+ myroll = bpy.data.objects.new(objname, mymesh)
+ bpy.context.scene.objects.link(myroll)
+
+ mymesh.from_pydata(myvertex, [], myfaces)
+ mymesh.update(calc_edges=True)
+ # Position
+ myroll.location.x = px
+ myroll.location.y = py
+ myroll.location.z = pz
+
+ # Materials
+ if mat:
+ set_material(myroll, mymaterial)
+
+ # Smooth
+ set_smooth(myroll)
+
+ return myroll
+
+
+# ------------------------------------------------------------------------------
+# Create roller sides
+#
+# myRoller: Roller to add sides
+# side: Side of the cap R/L
+# pX: position X axis
+# pY: position Y axis
+# pZ: position Z axis
+# mat: create default cycles material
+# plastic: plastic material
+# ------------------------------------------------------------------------------
+def create_roller_sides(myroller, side, px, py, pz, mat, plastic):
+ # Retry mesh data
+ mydata = roller_side()
+
+ # move data
+ myvertex = mydata[0]
+ myfaces = mydata[1]
+
+ mymesh = bpy.data.meshes.new("Side." + side)
+ myside = bpy.data.objects.new("Side." + side, mymesh)
+ bpy.context.scene.objects.link(myside)
+ mymesh.from_pydata(myvertex, [], myfaces)
+ mymesh.update(calc_edges=True)
+ # Position
+ myside.location.x = px
+ myside.location.y = py
+ myside.location.z = pz
+ # rotate
+ if side == "L":
+ myside.rotation_euler = (0, 0, math.radians(180))
+ # parent
+ myside.parent = myroller
+
+ # Materials
+ if mat:
+ set_material(myside, plastic)
+
+ # Smooth
+ set_smooth(myside)
+ set_modifier_subsurf(myside)
+
+ return myside
+
+
+# ----------------------------------------------
+# Roller side data
+# ----------------------------------------------
+def roller_side():
+ # ------------------------------------
+ # Mesh data
+ # ------------------------------------
+ minx = -7.54842304218073e-08
+ maxx = 0.05209559202194214
+ miny = -0.04486268758773804
+ maxy = 0.04486268758773804
+ minz = -0.04486268758773804
+ maxz = 0.08202265202999115
+
+ # Vertex
+ myvertex = [(maxx - 0.004684023559093475, maxy, minz + 0.04486270064847542),
+ (maxx - 0.004684023559093475, maxy - 0.0034149661660194397, minz + 0.027694489806890488),
+ (maxx - 0.004684023559093475, maxy - 0.013139978051185608, minz + 0.013139985501766205),
+ (maxx - 0.004684023559093475, maxy - 0.02769448049366474, minz + 0.0034149736166000366),
+ (maxx - 0.004684023559093475, miny + 0.044862685327428764, minz),
+ (maxx - 0.004684023559093475, miny + 0.027694476768374443, minz + 0.0034149736166000366),
+ (maxx - 0.004684023559093475, miny + 0.013139978051185608, minz + 0.013139985501766205),
+ (maxx - 0.004684023559093475, miny + 0.0034149661660194397, minz + 0.02769448794424534),
+ (maxx - 0.004684023559093475, miny, minz + 0.04486269387439812),
+ (maxx - 0.004684023559093475, miny + 0.0034149624407291412, minz + 0.06203090213239193),
+ (maxx - 0.004684023559093475, miny + 0.013139966875314713, maxz - 0.050299935042858124),
+ (maxx - 0.004684023559093475, miny + 0.027694474905729294, maxz - 0.04057491198182106),
+ (maxx - 0.004684023559093475, maxy - 0.027694473043084145, maxz - 0.04057491570711136),
+ (maxx - 0.004684023559093475, maxy - 0.013139966875314713, maxz - 0.05029993876814842),
+ (maxx - 0.004684023559093475, maxy - 0.0034149587154388428, minz + 0.062030890956521034),
+ (maxx - 0.0046574510633945465, miny + 0.028278490528464317, minz + 0.0048249028623104095),
+ (maxx - 0.0046574510633945465, miny + 0.014219092205166817, minz + 0.014219097793102264),
+ (maxx - 0.0046574510633945465, miny + 0.004824899137020111, minz + 0.028278499841690063),
+ (maxx - 0.003122705966234207, maxy, minz + 0.04486270064847542),
+ (maxx - 0.003122705966234207, maxy - 0.0034149661660194397, minz + 0.027694489806890488),
+ (maxx - 0.003122705966234207, maxy - 0.013139978051185608, minz + 0.013139985501766205),
+ (maxx - 0.003122705966234207, maxy - 0.02769448049366474, minz + 0.0034149736166000366),
+ (maxx - 0.003149278461933136, maxy - 0.04486268735455812, maxz - 0.03868604078888893),
+ (maxx - 0.003149278461933136, maxy - 0.02827848680317402, maxz - 0.04198484495282173),
+ (maxx - 0.003149278461933136, maxy - 0.014219081029295921, maxz - 0.05137905105948448),
+ (maxx - 0.003149278461933136, maxy - 0.004824887961149216, minz + 0.06144687905907631),
+ (maxx - 0.02118653617799282, miny + 0.027694474905729294, maxz - 0.04057491570711136),
+ (maxx - 0.02118653617799282, miny + 0.013139966875314713, maxz - 0.050299935042858124),
+ (maxx - 0.02118653617799282, miny + 0.0034149624407291412, minz + 0.06203090213239193),
+ (maxx - 0.02118653617799282, miny, minz + 0.04486269262849252),
+ (maxx - 0.003122705966234207, miny, minz + 0.04486269387439812),
+ (maxx - 0.003122705966234207, miny + 0.0034149624407291412, minz + 0.06203090213239193),
+ (maxx - 0.003122705966234207, miny + 0.013139966875314713, maxz - 0.050299935042858124),
+ (maxx - 0.003122705966234207, miny + 0.027694474905729294, maxz - 0.04057491198182106),
+ (maxx - 0.02118653617799282, maxy - 0.02769448049366474, minz + 0.0034149661660194397),
+ (maxx - 0.02118653617799282, maxy - 0.013139978051185608, minz + 0.013139981776475906),
+ (maxx - 0.02118653617799282, maxy - 0.0034149661660194397, minz + 0.02769448794424534),
+ (maxx - 0.02118653617799282, maxy, minz + 0.044862699402576034),
+ (maxx - 0.020517520606517792, miny + 0.01146744191646576, minz + 0.03102993033826351),
+ (maxx - 0.020517520606517792, miny + 0.01930307224392891, minz + 0.019303075969219208),
+ (maxx - 0.020517520606517792, miny + 0.031029919162392616, minz + 0.01146744191646576),
+ (maxx - 0.020517520606517792, miny + 0.04486268576937835, minz + 0.008715935051441193),
+ (maxx - 0.003122705966234207, maxy - 0.013139966875314713, maxz - 0.02605174481868744),
+ (maxx, miny + 0.013139966875314713, maxz - 0.026319395750761032),
+ (maxx, miny + 0.027694474905729294, maxz - 0.026230186223983765),
+ (maxx, maxy - 0.013139966875314713, maxz - 0.02605174481868744),
+ (maxx - 0.0046574510633945465, miny + 0.0015261024236679077, minz + 0.04486269394558251),
+ (maxx - 0.0046574510633945465, miny + 0.004824895411729813, minz + 0.061446888372302055),
+ (maxx - 0.0046574510633945465, miny + 0.014219081029295921, maxz - 0.05137904919683933),
+ (maxx - 0.0046574510633945465, miny + 0.02827848680317402, maxz - 0.04198484495282173),
+ (maxx, maxy - 0.027694473043084145, maxz - 0.026230186223983765),
+ (maxx, maxy - 0.04486268735205459, maxz - 0.02629481628537178),
+ (maxx - 0.003122705966234207, maxy - 0.027694473043084145, maxz - 0.04057491570711136),
+ (maxx - 0.003122705966234207, maxy - 0.013139966875314713, maxz - 0.05029993876814842),
+ (maxx - 0.003122705966234207, maxy - 0.0034149587154388428, minz + 0.062030890956521034),
+ (maxx - 0.003149278461933136, maxy - 0.0015261024236679077, minz + 0.044862700489230356),
+ (maxx - 0.003149278461933136, maxy - 0.004824899137020111, minz + 0.028278501704335213),
+ (maxx - 0.003149278461933136, maxy - 0.014219092205166817, minz + 0.014219097793102264),
+ (maxx - 0.003149278461933136, maxy - 0.028278492391109467, minz + 0.0048249028623104095),
+ (maxx - 0.003149278461933136, miny + 0.0015261024236679077, minz + 0.04486269394558251),
+ (maxx - 0.003149278461933136, miny + 0.004824895411729813, minz + 0.061446888372302055),
+ (maxx - 0.003149278461933136, miny + 0.014219081029295921, maxz - 0.05137904919683933),
+ (maxx - 0.003149278461933136, miny + 0.02827848680317402, maxz - 0.04198484495282173),
+ (maxx - 0.02118653617799282, maxy - 0.0034149587154388428, minz + 0.062030889093875885),
+ (maxx - 0.02118653617799282, maxy - 0.013139966875314713, maxz - 0.05029993876814842),
+ (maxx - 0.02118653617799282, maxy - 0.027694473043084145, maxz - 0.04057491570711136),
+ (maxx - 0.02118653617799282, maxy - 0.04486268735205459, maxz - 0.03715994209051132),
+ (maxx - 0.020517520606517792, maxy - 0.011467430740594864, minz + 0.058695447631180286),
+ (maxx - 0.020517520606517792, maxy - 0.019303061068058014, maxz - 0.05646303482353687),
+ (maxx - 0.020517520606517792, maxy - 0.031029915437102318, maxz - 0.04862739145755768),
+ (maxx - 0.020517520606517792, maxy - 0.044862687395027134, maxz - 0.045875877141952515),
+ (maxx, miny + 0.0034149661660194397, minz + 0.02769448794424534),
+ (maxx, miny + 0.013139978051185608, minz + 0.013139985501766205),
+ (maxx, miny + 0.027694476768374443, minz + 0.0034149736166000366),
+ (maxx, miny + 0.044862685327428764, minz),
+ (maxx - 0.02118653617799282, miny + 0.0034149661660194397, minz + 0.02769448794424534),
+ (maxx - 0.02118653617799282, miny + 0.013139978051185608, minz + 0.013139981776475906),
+ (maxx - 0.02118653617799282, miny + 0.027694476768374443, minz + 0.0034149661660194397),
+ (maxx - 0.02118653617799282, miny + 0.044862685327428764, minz),
+ (maxx - 0.020517520606517792, maxy - 0.031029922887682915, minz + 0.01146744191646576),
+ (maxx - 0.020517520606517792, maxy - 0.01930307224392891, minz + 0.019303075969219208),
+ (maxx - 0.020517520606517792, maxy - 0.01146744191646576, minz + 0.03102993033826351),
+ (maxx - 0.020517520606517792, maxy - 0.008715927600860596, minz + 0.04486269835125789),
+ (maxx - 0.0046574510633945465, maxy - 0.04486268735455812, maxz - 0.03868604078888893),
+ (maxx - 0.0046574510633945465, maxy - 0.02827848680317402, maxz - 0.04198484495282173),
+ (maxx - 0.0046574510633945465, maxy - 0.014219081029295921, maxz - 0.05137905105948448),
+ (maxx - 0.0046574510633945465, maxy - 0.004824887961149216, minz + 0.06144687905907631),
+ (maxx - 0.0046574510633945465, maxy - 0.0015261024236679077, minz + 0.044862700489230356),
+ (maxx - 0.0046574510633945465, maxy - 0.004824899137020111, minz + 0.028278501704335213),
+ (maxx - 0.0046574510633945465, maxy - 0.014219092205166817, minz + 0.014219097793102264),
+ (maxx - 0.0046574510633945465, maxy - 0.028278492391109467, minz + 0.0048249028623104095),
+ (maxx - 0.003149278461933136, miny + 0.004824899137020111, minz + 0.028278499841690063),
+ (maxx - 0.003149278461933136, miny + 0.014219092205166817, minz + 0.014219097793102264),
+ (maxx - 0.003149278461933136, miny + 0.028278490528464317, minz + 0.0048249028623104095),
+ (maxx, miny, minz + 0.04486269387439812),
+ (maxx, miny + 0.0034149624407291412, minz + 0.06203090213239193),
+ (maxx, miny + 0.013139966875314713, maxz - 0.050299935042858124),
+ (maxx, miny + 0.027694474905729294, maxz - 0.04057491198182106),
+ (maxx - 0.020517520606517792, miny + 0.031029917299747467, maxz - 0.04862739145755768),
+ (maxx - 0.020517520606517792, miny + 0.019303061068058014, maxz - 0.056463029235601425),
+ (maxx - 0.020517520606517792, miny + 0.011467434465885162, minz + 0.05869545880705118),
+ (maxx - 0.020517520606517792, miny + 0.008715927600860596, minz + 0.04486269289324163),
+ (maxx - 0.003122705966234207, miny + 0.0034149661660194397, minz + 0.02769448794424534),
+ (maxx - 0.003122705966234207, miny + 0.013139978051185608, minz + 0.013139985501766205),
+ (maxx - 0.003122705966234207, miny + 0.027694476768374443, minz + 0.0034149736166000366),
+ (maxx - 0.003122705966234207, miny + 0.044862685327428764, minz),
+ (maxx, maxy - 0.02769448049366474, minz + 0.0034149736166000366),
+ (maxx, maxy - 0.013139978051185608, minz + 0.013139985501766205),
+ (maxx, maxy - 0.0034149661660194397, minz + 0.027694489806890488),
+ (maxx, maxy, minz + 0.04486270064847542),
+ (maxx, maxy - 0.0034149587154388428, minz + 0.062030890956521034),
+ (maxx, maxy - 0.013139966875314713, maxz - 0.05029993876814842),
+ (maxx, maxy - 0.027694473043084145, maxz - 0.04057491570711136),
+ (maxx, maxy - 0.04486268735205459, maxz - 0.03715994209051132),
+ (maxx - 0.003122705966234207, maxy - 0.027694473043084145, maxz - 0.026230186223983765),
+ (maxx - 0.003122705966234207, maxy - 0.04486268735205459, maxz - 0.02629481628537178),
+ (maxx - 0.003122705966234207, miny + 0.027694474905729294, maxz - 0.026230186223983765),
+ (maxx - 0.003122705966234207, miny + 0.013139966875314713, maxz - 0.026319395750761032),
+ (maxx - 0.003122705966234207, miny + 0.013139966875314713, maxz - 0.0018796995282173157),
+ (maxx - 0.01466318964958191, miny + 0.013139966875314713, maxz - 0.0018796995282173157),
+ (maxx, miny + 0.027694474905729294, maxz - 0.0017904937267303467),
+ (maxx, maxy - 0.013139966875314713, maxz - 0.001612052321434021),
+ (maxx - 0.009187713265419006, maxy - 0.013139966875314713, maxz - 0.02605174481868744),
+ (maxx - 0.009187713265419006, maxy - 0.027694473043084145, maxz - 0.026230186223983765),
+ (maxx - 0.009187713265419006, maxy - 0.04486268735205459, maxz - 0.02629481628537178),
+ (maxx - 0.009187713265419006, miny + 0.027694474905729294, maxz - 0.026230186223983765),
+ (maxx - 0.009187713265419006, miny + 0.013139966875314713, maxz - 0.026319395750761032),
+ (maxx - 0.003122705966234207, maxy - 0.013139966875314713, maxz - 0.001612052321434021),
+ (maxx - 0.01466318964958191, miny + 0.027694474905729294, maxz - 0.0017904937267303467),
+ (maxx, miny + 0.022660084068775177, minz + 0.03566607739776373),
+ (maxx, miny + 0.02786955051124096, minz + 0.027869559824466705),
+ (maxx, miny + 0.03566606715321541, minz + 0.022660093382000923),
+ (maxx, miny + 0.04486268649608238, minz + 0.020830770954489708),
+ (maxx, miny + 0.02083076350390911, minz + 0.044862694725740226),
+ (maxx, miny + 0.022660082206130028, minz + 0.05405931267887354),
+ (maxx, miny + 0.02786954492330551, minz + 0.061855828389525414),
+ (maxx, miny + 0.035666066221892834, maxz - 0.059820037335157394),
+ (maxx, maxy - 0.03566606715321541, minz + 0.022660093382000923),
+ (maxx, maxy - 0.02786955051124096, minz + 0.027869559824466705),
+ (maxx, maxy - 0.022660084068775177, minz + 0.035666078329086304),
+ (maxx, maxy - 0.02083076350390911, minz + 0.044862698354463326),
+ (maxx, maxy - 0.02266007848083973, minz + 0.05405930709093809),
+ (maxx, maxy - 0.02786954492330551, minz + 0.061855828389525414),
+ (maxx, maxy - 0.035666064359247684, maxz - 0.059820037335157394),
+ (maxx, maxy - 0.04486268734234705, maxz - 0.05799071677029133),
+ (maxx, miny + 0.04486268733843682, minz + 0.04486269544876009),
+ (maxx - 0.009557131677865982, maxy - 0.04486268735205459, maxz - 0.02464577928185463),
+ (maxx - 0.009557131677865982, miny + 0.027694474905729294, maxz - 0.024581149220466614),
+ (maxx - 0.009557131677865982, maxy - 0.013139966875314713, maxz - 0.024402707815170288),
+ (maxx - 0.009557131677865982, miny + 0.013139966875314713, maxz - 0.02467035874724388),
+ (maxx - 0.009557131677865982, maxy - 0.027694473043084145, maxz - 0.024581149220466614),
+ (maxx - 0.015024378895759583, miny + 0.027694474905729294, maxz - 0.00017844140529632568),
+ (maxx - 0.015024378895759583, miny + 0.013139966875314713, maxz - 0.0002676546573638916),
+ (maxx - 0.015024378895759583, maxy - 0.04486268735205459, maxz - 0.0002430751919746399),
+ (maxx - 0.015024378895759583, maxy - 0.027694473043084145, maxz - 0.00017844140529632568),
+ (maxx - 0.015024378895759583, maxy - 0.013139966875314713, maxz),
+ (maxx, miny + 0.013139966875314713, maxz - 0.0018796995282173157),
+ (maxx - 0.01466318964958191, maxy - 0.04486268735205459, maxz - 0.001855120062828064),
+ (maxx, maxy - 0.04486268735205459, maxz - 0.001855120062828064),
+ (maxx - 0.01466318964958191, maxy - 0.027694473043084145, maxz - 0.0017904937267303467),
+ (maxx - 0.01466318964958191, maxy - 0.013139966875314713, maxz - 0.001612052321434021),
+ (maxx, maxy - 0.027694473043084145, maxz - 0.0017904937267303467),
+ (maxx - 0.020517520606517792, miny + 0.014739999547600746, minz + 0.03238546848297119),
+ (maxx - 0.020517520606517792, miny + 0.021807780489325523, minz + 0.02180778607726097),
+ (maxx - 0.020517520606517792, miny + 0.03238545823842287, minz + 0.014740003272891045),
+ (maxx - 0.020517520606517792, miny + 0.044862685933359736, minz + 0.012258127331733704),
+ (maxx - 0.020517520606517792, maxy - 0.014739990234375, minz + 0.05733991041779518),
+ (maxx - 0.020517520606517792, maxy - 0.021807771176099777, maxz - 0.05896773934364319),
+ (maxx - 0.020517520606517792, maxy - 0.03238545451313257, maxz - 0.051899950951337814),
+ (maxx - 0.020517520606517792, maxy - 0.044862687428120204, maxz - 0.049418069422245026),
+ (maxx - 0.020517520606517792, maxy - 0.03238546196371317, minz + 0.014740003272891045),
+ (maxx - 0.020517520606517792, maxy - 0.021807780489325523, minz + 0.02180778607726097),
+ (maxx - 0.020517520606517792, maxy - 0.014739999547600746, minz + 0.03238546848297119),
+ (maxx - 0.020517520606517792, maxy - 0.012258119881153107, minz + 0.04486269794694575),
+ (maxx - 0.020517520606517792, miny + 0.03238545544445515, maxz - 0.051899950951337814),
+ (maxx - 0.020517520606517792, miny + 0.021807771176099777, maxz - 0.05896773561835289),
+ (maxx - 0.020517520606517792, miny + 0.014739995822310448, minz + 0.05733991973102093),
+ (maxx - 0.020517520606517792, miny + 0.012258119881153107, minz + 0.04486269302378876),
+ (minx, miny + 0.014739999547600746, minz + 0.03238546848297119),
+ (minx, miny + 0.021807780489325523, minz + 0.02180778607726097),
+ (minx, miny + 0.03238545823842287, minz + 0.014740003272891045),
+ (minx, miny + 0.044862685933359736, minz + 0.012258127331733704),
+ (minx, maxy - 0.014739990234375, minz + 0.05733991041779518),
+ (minx, maxy - 0.021807771176099777, maxz - 0.05896773934364319),
+ (minx, maxy - 0.03238545451313257, maxz - 0.051899950951337814),
+ (minx, maxy - 0.044862687428120204, maxz - 0.049418069422245026),
+ (minx, maxy - 0.03238546196371317, minz + 0.014740003272891045),
+ (minx, maxy - 0.021807780489325523, minz + 0.02180778607726097),
+ (minx, maxy - 0.014739999547600746, minz + 0.03238546848297119),
+ (minx, maxy - 0.012258119881153107, minz + 0.04486269794694575),
+ (minx, miny + 0.03238545544445515, maxz - 0.051899950951337814),
+ (minx, miny + 0.021807771176099777, maxz - 0.05896773561835289),
+ (minx, miny + 0.014739995822310448, minz + 0.05733991973102093),
+ (minx, miny + 0.012258119881153107, minz + 0.04486269302378876)]
+
+ # Faces
+ myfaces = [(37, 0, 1, 36), (36, 1, 2, 35), (35, 2, 3, 34), (34, 3, 4, 78), (78, 4, 5, 77),
+ (77, 5, 6, 76), (76, 6, 7, 75), (75, 7, 8, 29), (29, 8, 9, 28), (28, 9, 10, 27),
+ (27, 10, 11, 26), (65, 12, 13, 64), (8, 7, 17, 46), (63, 14, 0, 37), (64, 13, 14, 63),
+ (34, 78, 41, 79), (64, 63, 67, 68), (76, 75, 38, 39), (65, 64, 68, 69), (27, 26, 98, 99),
+ (78, 77, 40, 41), (28, 27, 99, 100), (35, 34, 79, 80), (63, 37, 82, 67), (29, 28, 100, 101),
+ (26, 66, 70, 98), (36, 35, 80, 81), (66, 65, 69, 70), (77, 76, 39, 40), (37, 36, 81, 82),
+ (75, 29, 101, 38), (19, 18, 109, 108), (31, 32, 61, 60), (2, 1, 88, 89), (103, 102, 91, 92),
+ (7, 6, 16, 17), (54, 18, 55, 25), (32, 33, 62, 61), (18, 19, 56, 55), (6, 5, 15, 16),
+ (11, 10, 48, 49), (52, 53, 24, 23), (0, 14, 86, 87), (94, 71, 129, 133), (97, 113, 51, 44),
+ (33, 32, 117, 116), (18, 54, 110, 109), (32, 31, 95, 96), (96, 97, 44, 43), (102, 103, 72, 71),
+ (53, 52, 114, 42), (21, 20, 107, 106), (103, 104, 73, 72), (31, 30, 94, 95), (20, 19, 108, 107),
+ (30, 102, 71, 94), (105, 21, 106, 74), (54, 53, 111, 110), (104, 105, 74, 73), (47, 46, 59, 60),
+ (90, 89, 57, 58), (87, 86, 25, 55), (48, 47, 60, 61), (49, 48, 61, 62), (83, 49, 62, 22),
+ (16, 15, 93, 92), (88, 87, 55, 56), (84, 83, 22, 23), (17, 16, 92, 91), (85, 84, 23, 24),
+ (46, 17, 91, 59), (89, 88, 56, 57), (86, 85, 24, 25), (104, 103, 92, 93), (3, 2, 89, 90),
+ (20, 21, 58, 57), (13, 12, 84, 85), (9, 8, 46, 47), (102, 30, 59, 91), (30, 31, 60, 59),
+ (19, 20, 57, 56), (14, 13, 85, 86), (53, 54, 25, 24), (10, 9, 47, 48), (1, 0, 87, 88),
+ (111, 53, 42, 45), (112, 111, 45, 50), (32, 96, 43, 117), (113, 112, 50, 51), (115, 116, 125, 124),
+ (42, 114, 123, 122), (116, 117, 126, 125), (114, 115, 124, 123), (112, 113, 144, 143),
+ (95, 94, 133, 134),
+ (110, 111, 142, 141), (96, 95, 134, 135), (74, 106, 137, 132), (97, 96, 135, 136), (73, 74, 132, 131),
+ (107, 108, 139, 138), (113, 97, 136, 144), (72, 73, 131, 130), (108, 109, 140, 139),
+ (109, 110, 141, 140),
+ (71, 72, 130, 129), (106, 107, 138, 137), (111, 112, 143, 142), (135, 134, 145), (137, 138, 145),
+ (142, 143, 145), (136, 135, 145), (131, 132, 145), (143, 144, 145), (144, 136, 145),
+ (130, 131, 145), (141, 142, 145), (129, 130, 145), (132, 137, 145), (133, 129, 145),
+ (138, 139, 145), (134, 133, 145), (139, 140, 145), (140, 141, 145), (26, 11, 83, 66),
+ (66, 83, 12, 65), (12, 83, 84), (22, 52, 23), (83, 11, 49), (21, 105, 58),
+ (4, 90, 58, 105), (15, 4, 105, 93), (33, 22, 62), (4, 3, 90), (105, 104, 93),
+ (5, 4, 15), (52, 22, 115, 114), (22, 33, 116, 115), (124, 125, 147, 146), (122, 123, 150, 148),
+ (125, 126, 149, 147), (123, 124, 146, 150), (157, 128, 151, 153), (159, 157, 153, 154),
+ (160, 159, 154, 155),
+ (128, 119, 152, 151), (146, 147, 128, 157), (150, 146, 157, 159), (148, 150, 159, 160),
+ (147, 149, 119, 128),
+ (69, 68, 167, 168), (101, 100, 176, 177), (39, 38, 162, 163), (100, 99, 175, 176), (41, 40, 164, 165),
+ (80, 79, 170, 171), (82, 81, 172, 173), (67, 82, 173, 166), (70, 69, 168, 169), (38, 101, 177, 162),
+ (98, 70, 169, 174), (40, 39, 163, 164), (79, 41, 165, 170), (99, 98, 174, 175), (81, 80, 171, 172),
+ (68, 67, 166, 167), (169, 168, 184, 185), (170, 165, 181, 186), (172, 171, 187, 188),
+ (162, 177, 193, 178),
+ (164, 163, 179, 180), (167, 166, 182, 183), (174, 169, 185, 190), (168, 167, 183, 184),
+ (175, 174, 190, 191),
+ (171, 170, 186, 187), (173, 172, 188, 189), (163, 162, 178, 179), (165, 164, 180, 181),
+ (177, 176, 192, 193),
+ (166, 173, 189, 182), (176, 175, 191, 192), (51, 50, 161, 158), (127, 160, 155), (156, 120, 151, 152),
+ (155, 154, 161, 121), (161, 154, 153, 158), (42, 122, 148), (117, 149, 126), (127, 42, 148, 160),
+ (118, 152, 119), (158, 153, 151, 120), (50, 45, 121, 161), (117, 118, 119, 149), (43, 44, 120, 156),
+ (44, 51, 158, 120), (117, 43, 156, 118), (45, 42, 127, 121)]
+
+ return myvertex, myfaces
+
+
+# --------------------------------------------------------------------
+# Set curve cycle
+#
+# myObject: Curve obejct
+# --------------------------------------------------------------------
+def set_curve_cycle(myobject):
+ bpy.context.scene.objects.active = myobject
+ # go edit mode
+ bpy.ops.object.mode_set(mode='EDIT')
+ # select all faces
+ bpy.ops.curve.select_all(action='SELECT')
+ # St cyclic
+ bpy.ops.curve.cyclic_toggle(direction='CYCLIC_U')
+ # go object mode again
+ bpy.ops.object.editmode_toggle()
diff --git a/archimesh/achm_door_maker.py b/archimesh/achm_door_maker.py
new file mode 100644
index 00000000..cbc16684
--- /dev/null
+++ b/archimesh/achm_door_maker.py
@@ -0,0 +1,2391 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+# ----------------------------------------------------------
+# Author: Antonio Vazquez (antonioya)
+#
+# ----------------------------------------------------------
+# noinspection PyUnresolvedReferences
+import bpy
+import math
+# noinspection PyUnresolvedReferences
+from bpy.props import *
+from achm_tools import *
+
+
+# ------------------------------------------------------------------
+# Define operator class to create object
+# ------------------------------------------------------------------
+class AchmDoor(bpy.types.Operator):
+ bl_idname = "mesh.archimesh_door"
+ bl_label = "Door"
+ bl_description = "Door"
+ bl_category = 'Archimesh'
+ bl_options = {'REGISTER', 'UNDO'}
+
+ # -----------------------------------------------------
+ # Draw (create UI interface)
+ # -----------------------------------------------------
+ # noinspection PyUnusedLocal
+ def draw(self, context):
+ layout = self.layout
+ row = layout.row()
+ row.label("Use Properties panel (N) to define parms", icon='INFO')
+
+ # -----------------------------------------------------
+ # Execute
+ # -----------------------------------------------------
+ def execute(self, context):
+ if bpy.context.mode == "OBJECT":
+ create_object(self, context)
+ return {'FINISHED'}
+ else:
+ self.report({'WARNING'}, "Archimesh: Option only valid in Object mode")
+ return {'CANCELLED'}
+
+
+# ------------------------------------------------------------------------------
+#
+# Create main object. The other objects will be children of this.
+#
+# ------------------------------------------------------------------------------
+# noinspection PyUnusedLocal
+def create_object(self, context):
+ # deselect all objects
+ for o in bpy.data.objects:
+ o.select = False
+
+ # we create main object and mesh
+ mainmesh = bpy.data.meshes.new("DoorFrane")
+ mainobject = bpy.data.objects.new("DoorFrame", mainmesh)
+ mainobject.location = bpy.context.scene.cursor_location
+ bpy.context.scene.objects.link(mainobject)
+ mainobject.DoorObjectGenerator.add()
+
+ # we shape the main object and create other objects as children
+ shape_mesh(mainobject, mainmesh)
+ shape_children(mainobject)
+
+ # we select, and activate, main object
+ mainobject.select = True
+ bpy.context.scene.objects.active = mainobject
+
+
+# ------------------------------------------------------------------------------
+#
+# Update main mesh and children objects
+#
+# ------------------------------------------------------------------------------
+# noinspection PyUnusedLocal
+def update_object(self, context):
+ # When we update, the active object is the main object
+ o = bpy.context.active_object
+ oldmesh = o.data
+ oldname = o.data.name
+ # Now we deselect that object to not delete it.
+ o.select = False
+ # and we create a new mesh
+ tmp_mesh = bpy.data.meshes.new("temp")
+ # deselect all objects
+ for obj in bpy.data.objects:
+ obj.select = False
+
+ # ---------------------------------
+ # Clear Parent objects (autohole)
+ # ---------------------------------
+ myparent = o.parent
+ if myparent is not None:
+ ploc = myparent.location
+ o.parent = None
+ o.location = ploc
+ # remove_children(parent)
+ for child in myparent.children:
+ # noinspection PyBroadException
+ try:
+ # clear child data
+ child.hide = False # must be visible to avoid bug
+ child.hide_render = False # must be visible to avoid bug
+ old = child.data
+ child.select = True
+ bpy.ops.object.delete()
+ bpy.data.meshes.remove(old)
+ except:
+ dummy = -1
+
+ myparent.select = True
+ bpy.ops.object.delete()
+
+ # -----------------------
+ # remove all children
+ # -----------------------
+ # first granchild
+ for child in o.children:
+ remove_children(child)
+ # now children of main object
+ remove_children(o)
+
+ # Finally we create all that again (except main object),
+ shape_mesh(o, tmp_mesh, True)
+ o.data = tmp_mesh
+ shape_children(o, True)
+ # Remove data (mesh of active object),
+ bpy.data.meshes.remove(oldmesh)
+ tmp_mesh.name = oldname
+ # and select, and activate, the main object
+ o.select = True
+ bpy.context.scene.objects.active = o
+
+
+# ------------------------------------------------------------------------------
+# Generate all objects
+# For main, it only shapes mesh and creates modifiers (the modifier, only the first time).
+# And, for the others, it creates object and mesh.
+# ------------------------------------------------------------------------------
+# noinspection PyUnusedLocal
+def shape_mesh(mainobject, tmp_mesh, update=False):
+ mp = mainobject.DoorObjectGenerator[0]
+ # Create only mesh, because the object is created before
+ create_doorframe(mp, tmp_mesh)
+
+ remove_doubles(mainobject)
+ set_normals(mainobject)
+
+ # saves OpenGL data
+ mp.glpoint_a = (-mp.frame_width / 2, 0, 0)
+ mp.glpoint_b = (-mp.frame_width / 2, 0, mp.frame_height)
+ mp.glpoint_c = (mp.frame_width / 2, 0, mp.frame_height)
+ mp.glpoint_d = (-mp.frame_width / 2 + mp.frame_size, 0, mp.frame_height - mp.frame_size - 0.01)
+ mp.glpoint_e = (mp.frame_width / 2 - mp.frame_size, 0, mp.frame_height - mp.frame_size - 0.01)
+
+ # Lock
+ mainobject.lock_location = (True, True, True)
+ mainobject.lock_rotation = (True, True, True)
+
+ return
+
+# ------------------------------------------------------------------------------
+# Generate all Children
+#
+# ------------------------------------------------------------------------------
+# noinspection PyUnusedLocal
+
+
+def shape_children(mainobject, update=False):
+ mp = mainobject.DoorObjectGenerator[0]
+
+ if mp.openside != "3":
+ make_one_door(mp, mainobject, mp.frame_width, mp.openside)
+ else:
+ w = mp.frame_width
+ widthl = (w * mp.factor)
+ widthr = w - widthl
+
+ # left door
+ mydoor = make_one_door(mp, mainobject, widthl + mp.frame_size, "2")
+ mydoor.location.x = -mp.frame_width / 2 + mp.frame_size
+ # right door (pending width)
+ mydoor = make_one_door(mp, mainobject, widthr + mp.frame_size, "1")
+ mydoor.location.x = mp.frame_width / 2 - mp.frame_size
+
+ if mp.crt_mat:
+ mat = create_diffuse_material("Door_material", False, 0.8, 0.8, 0.8)
+ set_material(mainobject, mat)
+
+ # -------------------------
+ # Create empty and parent
+ # -------------------------
+ bpy.ops.object.empty_add(type='PLAIN_AXES')
+ myempty = bpy.data.objects[bpy.context.active_object.name]
+ myempty.location = mainobject.location
+
+ myempty.name = "Door_Group"
+ parentobject(myempty, mainobject)
+ mainobject["archimesh.hole_enable"] = True
+ # Rotate Empty
+ myempty.rotation_euler.z = math.radians(mp.r)
+ # Create control box to open wall holes
+ gap = 0.002
+ myctrl = create_control_box("CTRL_Hole",
+ mp.frame_width, mp.frame_thick * 3, mp.frame_height)
+ # Add custom property to detect Controller
+ myctrl["archimesh.ctrl_hole"] = True
+
+ set_normals(myctrl)
+ myctrl.parent = myempty
+ myctrl.location.x = 0
+ myctrl.location.y = -((mp.frame_thick * 3) / 2)
+ myctrl.location.z = -gap
+ myctrl.draw_type = 'BOUNDS'
+ myctrl.hide = False
+ myctrl.hide_render = True
+ myctrl.cycles_visibility.camera = False
+ myctrl.cycles_visibility.diffuse = False
+ myctrl.cycles_visibility.glossy = False
+ myctrl.cycles_visibility.transmission = False
+ myctrl.cycles_visibility.scatter = False
+ myctrl.cycles_visibility.shadow = False
+
+ # Create control box for baseboard
+ myctrlbase = create_control_box("CTRL_Baseboard",
+ mp.frame_width, 0.40, 0.40,
+ False)
+ # Add custom property to detect Controller
+ myctrlbase["archimesh.ctrl_base"] = True
+
+ set_normals(myctrlbase)
+ myctrlbase.parent = myempty
+ myctrlbase.location.x = 0
+ myctrlbase.location.y = -0.15 - (mp.frame_thick / 3)
+ myctrlbase.location.z = -0.10
+ myctrlbase.draw_type = 'BOUNDS'
+ myctrlbase.hide = False
+ myctrlbase.hide_render = True
+ myctrlbase.cycles_visibility.camera = False
+ myctrlbase.cycles_visibility.diffuse = False
+ myctrlbase.cycles_visibility.glossy = False
+ myctrlbase.cycles_visibility.transmission = False
+ myctrlbase.cycles_visibility.scatter = False
+ myctrlbase.cycles_visibility.shadow = False
+
+ mat = create_transparent_material("hidden_material", False)
+ set_material(myctrl, mat)
+ set_material(myctrlbase, mat)
+
+ # deactivate others
+ for o in bpy.data.objects:
+ if o.select is True and o.name != mainobject.name:
+ o.select = False
+
+
+# ------------------------------------------------------------------
+# Define property group class to create or modify
+# ------------------------------------------------------------------
+class ObjectProperties(bpy.types.PropertyGroup):
+ frame_width = bpy.props.FloatProperty(
+ name='Frame width',
+ min=0.25, max=10,
+ default=1, precision=2,
+ description='Doorframe width', update=update_object,
+ )
+ frame_height = bpy.props.FloatProperty(
+ name='Frame height',
+ min=0.25, max=10,
+ default=2.1, precision=2,
+ description='Doorframe height', update=update_object,
+ )
+ frame_thick = bpy.props.FloatProperty(
+ name='Frame thickness',
+ min=0.05, max=0.50,
+ default=0.08, precision=2,
+ description='Doorframe thickness', update=update_object,
+ )
+ frame_size = bpy.props.FloatProperty(
+ name='Frame size',
+ min=0.05, max=0.25,
+ default=0.08, precision=2,
+ description='Doorframe size', update=update_object,
+ )
+ crt_mat = bpy.props.BoolProperty(
+ name="Create default Cycles materials",
+ description="Create default materials for Cycles render",
+ default=True,
+ update=update_object,
+ )
+ factor = bpy.props.FloatProperty(
+ name='',
+ min=0.2, max=1,
+ default=0.5, precision=3, description='Door ratio',
+ update=update_object,
+ )
+ r = bpy.props.FloatProperty(
+ name='Rotation', min=0, max=360,
+ default=0, precision=1,
+ description='Door rotation', update=update_object,
+ )
+
+ openside = bpy.props.EnumProperty(
+ name="Open side",
+ items=(
+ ('1', "Right open", ""),
+ ('2', "Left open", ""),
+ ('3', "Both sides", ""),
+ ),
+ description="Defines the direction for opening the door",
+ update=update_object,
+ )
+
+ model = bpy.props.EnumProperty(
+ name="Model",
+ items=(
+ ('1', "Model 01", ""),
+ ('2', "Model 02", ""),
+ ('3', "Model 03", ""),
+ ('4', "Model 04", ""),
+ ('5', "Model 05", "Glass"),
+ ('6', "Model 06", "Glass"),
+ ),
+ description="Door model",
+ update=update_object,
+ )
+
+ handle = bpy.props.EnumProperty(
+ name="Handle",
+ items=(
+ ('1', "Handle 01", ""),
+ ('2', "Handle 02", ""),
+ ('3', "Handle 03", ""),
+ ('4', "Handle 04", ""),
+ ('0', "None", ""),
+ ),
+ description="Handle model",
+ update=update_object,
+ )
+
+ # opengl internal data
+ glpoint_a = bpy.props.FloatVectorProperty(
+ name="glpointa",
+ description="Hidden property for opengl",
+ default=(0, 0, 0),
+ )
+ glpoint_b = bpy.props.FloatVectorProperty(
+ name="glpointb",
+ description="Hidden property for opengl",
+ default=(0, 0, 0),
+ )
+ glpoint_c = bpy.props.FloatVectorProperty(
+ name="glpointc",
+ description="Hidden property for opengl",
+ default=(0, 0, 0),
+ )
+ glpoint_d = bpy.props.FloatVectorProperty(
+ name="glpointc",
+ description="Hidden property for opengl",
+ default=(0, 0, 0),
+ )
+ glpoint_e = bpy.props.FloatVectorProperty(
+ name="glpointc",
+ description="Hidden property for opengl",
+ default=(0, 0, 0),
+ )
+
+# Register
+bpy.utils.register_class(ObjectProperties)
+bpy.types.Object.DoorObjectGenerator = bpy.props.CollectionProperty(type=ObjectProperties)
+
+
+# ------------------------------------------------------------------
+# Define panel class to modify object
+# ------------------------------------------------------------------
+class AchmDoorObjectgeneratorpanel(bpy.types.Panel):
+ bl_idname = "OBJECT_PT_door_generator"
+ bl_label = "Door"
+ bl_space_type = 'VIEW_3D'
+ bl_region_type = 'UI'
+ bl_category = 'Archimesh'
+
+ # -----------------------------------------------------
+ # Verify if visible
+ # -----------------------------------------------------
+ @classmethod
+ def poll(cls, context):
+ o = context.object
+ if o is None:
+ return False
+ if 'DoorObjectGenerator' not in o:
+ return False
+ else:
+ return True
+
+ # -----------------------------------------------------
+ # Draw (create UI interface)
+ # -----------------------------------------------------
+ def draw(self, context):
+ o = context.object
+ # noinspection PyBroadException
+ try:
+ if 'DoorObjectGenerator' not in o:
+ return
+ except:
+ return
+
+ layout = self.layout
+ if bpy.context.mode == 'EDIT_MESH':
+ layout.label('Warning: Operator does not work in edit mode.', icon='ERROR')
+ else:
+ myobjdat = o.DoorObjectGenerator[0]
+ space = bpy.context.space_data
+ if not space.local_view:
+ # Imperial units warning
+ if bpy.context.scene.unit_settings.system == "IMPERIAL":
+ row = layout.row()
+ row.label("Warning: Imperial units not supported", icon='COLOR_RED')
+ box = layout.box()
+ row = box.row()
+ row.prop(myobjdat, 'frame_width')
+ row.prop(myobjdat, 'frame_height')
+ row = box.row()
+ row.prop(myobjdat, 'frame_thick')
+ row.prop(myobjdat, 'frame_size')
+ row = box.row()
+ row.prop(myobjdat, 'r')
+
+ box = layout.box()
+ row = box.row()
+ row.prop(myobjdat, 'openside')
+ if myobjdat.openside == "3":
+ row.prop(myobjdat, "factor")
+
+ layout.prop(myobjdat, 'model')
+ layout.prop(myobjdat, 'handle')
+
+ box = layout.box()
+ box.prop(myobjdat, 'crt_mat')
+ else:
+ row = layout.row()
+ row.label("Warning: Operator does not work in local view mode", icon='ERROR')
+
+
+# ------------------------------------------------------------------------------
+# Create Doorframe
+# ------------------------------------------------------------------------------
+def create_doorframe(mp, mymesh):
+ tf = mp.frame_thick / 3
+ sf = mp.frame_size
+ wf = (mp.frame_width / 2) - sf
+ hf = mp.frame_height - sf
+ gap = 0.02
+ deep = mp.frame_thick * 0.50
+
+ verts = [(-wf - sf, -tf, 0),
+ (-wf - sf, tf * 2, 0),
+ (-wf, tf * 2, 0),
+ (-wf - sf, -tf, hf + sf),
+ (-wf - sf, tf * 2, hf + sf),
+ (wf + sf, tf * 2, hf + sf),
+ (wf + sf, -tf, hf + sf),
+ (wf, -tf, hf),
+ (-wf, tf * 2, hf),
+ (wf, -tf, 0),
+ (wf + sf, -tf, 0),
+ (wf + sf, tf * 2, 0),
+ (wf, -tf + deep, hf),
+ (-wf, -tf + deep, hf),
+ (-wf, -tf + deep, 0),
+ (-wf + gap, -tf + deep, hf),
+ (-wf + gap, -tf + deep, 0),
+ (-wf + gap, tf * 2, hf),
+ (-wf + gap, tf * 2, 0),
+ (wf, -tf + deep, 0),
+ (-wf, -tf, hf),
+ (-wf, -tf, 0),
+ (wf, tf * 2, hf),
+ (wf, tf * 2, 0),
+ (wf - gap, tf * 2, 0),
+ (wf - gap, -tf + deep, 0),
+ (wf - gap, tf * 2, hf),
+ (wf - gap, -tf + deep, hf - gap),
+ (wf - gap, -tf + deep, hf),
+ (-wf + gap, tf * 2, hf - gap),
+ (-wf + gap, -tf + deep, hf - gap),
+ (wf - gap, tf * 2, hf - gap)]
+
+ faces = [(3, 4, 1, 0), (7, 12, 19, 9), (4, 3, 6, 5), (10, 11, 5, 6), (13, 20, 21, 14), (17, 15, 16, 18),
+ (11, 23, 22, 5),
+ (20, 13, 12, 7), (20, 3, 0, 21), (9, 10, 6, 7), (13, 14, 16, 15), (4, 8, 2, 1), (29, 30, 27, 31),
+ (7, 6, 3, 20),
+ (8, 4, 5, 22), (14, 2, 18, 16), (17, 18, 2, 8), (28, 25, 19, 12), (28, 26, 24, 25), (25, 24, 23, 19),
+ (22, 23, 24, 26),
+ (29, 31, 26, 17), (15, 28, 27, 30), (8, 22, 26)]
+
+ mymesh.from_pydata(verts, [], faces)
+ mymesh.update(calc_edges=True)
+
+ return
+
+
+# ------------------------------------------------------------------------------
+# Make one door
+#
+# ------------------------------------------------------------------------------
+def make_one_door(self, myframe, width, openside):
+ mydoor = create_door_data(self, myframe, width, openside)
+ handle1 = None
+ handle2 = None
+ if self.handle != "0":
+ handle1 = create_handle(self, mydoor, "Front", width, openside)
+ handle1.select = True
+ bpy.context.scene.objects.active = handle1
+ set_smooth(handle1)
+ set_modifier_subsurf(handle1)
+ handle2 = create_handle(self, mydoor, "Back", width, openside)
+ set_smooth(handle2)
+ set_modifier_subsurf(handle2)
+ # Create materials
+ if self.crt_mat:
+ # Door material
+ mat = create_diffuse_material("Door_material", False, 0.8, 0.8, 0.8)
+ set_material(mydoor, mat)
+ # Handle material
+ if self.handle != "0":
+ mat = create_glossy_material("Handle_material", False, 0.733, 0.779, 0.8)
+ set_material(handle1, mat)
+ set_material(handle2, mat)
+ if self.model == "5" or self.model == "6":
+ mat = create_glass_material("DoorGlass_material", False)
+ mydoor.data.materials.append(mat)
+ if self.model == "5":
+ select_faces(mydoor, 20, True)
+ select_faces(mydoor, 41, False)
+ if self.model == "6":
+ select_faces(mydoor, 37, True)
+ select_faces(mydoor, 76, False)
+ set_material_faces(mydoor, 1)
+
+ set_normals(mydoor)
+
+ return mydoor
+
+
+# ------------------------------------------------------------------------------
+# Create Door
+# All custom values are passed using self container (self.myvariable)
+# ------------------------------------------------------------------------------
+def create_door_data(self, myframe, width, openside):
+ # Retry mesh data
+ if self.model == "1":
+ mydata = door_model_01(self.frame_size, width, self.frame_height, self.frame_thick, openside)
+ elif self.model == "2":
+ mydata = door_model_02(self.frame_size, width, self.frame_height, self.frame_thick, openside)
+ elif self.model == "3":
+ mydata = door_model_03(self.frame_size, width, self.frame_height, self.frame_thick, openside)
+ elif self.model == "4":
+ mydata = door_model_04(self.frame_size, width, self.frame_height, self.frame_thick, openside)
+ elif self.model == "5":
+ mydata = door_model_04(self.frame_size, width, self.frame_height, self.frame_thick,
+ openside) # uses the same mesh
+ elif self.model == "6":
+ mydata = door_model_02(self.frame_size, width, self.frame_height, self.frame_thick,
+ openside) # uses the same mesh
+ else:
+ mydata = door_model_01(self.frame_size, width, self.frame_height, self.frame_thick, openside) # default model
+
+ # move data
+ verts = mydata[0]
+ faces = mydata[1]
+ wf = mydata[2]
+ deep = mydata[3]
+ side = mydata[4]
+
+ mymesh = bpy.data.meshes.new("Door")
+ myobject = bpy.data.objects.new("Door", mymesh)
+
+ myobject.location = bpy.context.scene.cursor_location
+ bpy.context.scene.objects.link(myobject)
+
+ mymesh.from_pydata(verts, [], faces)
+ mymesh.update(calc_edges=True)
+
+ # Translate to doorframe and parent
+ myobject.parent = myframe
+ myobject.lock_rotation = (True, True, False)
+ myobject.lock_location = (True, True, True)
+
+ myobject.location.x = ((wf / 2) * side)
+ myobject.location.y = -(deep * 0.65)
+ myobject.location.z = self.frame_height / 2
+
+ return myobject
+
+
+# ------------------------------------------------------------------------------
+# Create Handles
+# All custom values are passed using self container (self.myvariable)
+# ------------------------------------------------------------------------------
+def create_handle(self, mydoor, pos, frame_width, openside):
+ # Retry mesh data
+ if self.handle == "1":
+ mydata = handle_model_01()
+ elif self.handle == "2":
+ mydata = handle_model_02()
+ elif self.handle == "3":
+ mydata = handle_model_03()
+ elif self.handle == "4":
+ mydata = handle_model_04()
+ else:
+ mydata = handle_model_01() # default model
+
+ # move data
+ verts = mydata[0]
+ faces = mydata[1]
+
+ gap = 0.002
+ sf = self.frame_size
+ wf = frame_width - (sf * 2) - (gap * 2)
+ deep = (self.frame_thick * 0.50) - (gap * 3)
+ # Open to right or left
+ if openside == "1":
+ side = -1
+ else:
+ side = 1
+
+ mymesh = bpy.data.meshes.new("Handle_" + pos)
+ myobject = bpy.data.objects.new("Handle_" + pos, mymesh)
+
+ myobject.location = bpy.context.scene.cursor_location
+ bpy.context.scene.objects.link(myobject)
+
+ mymesh.from_pydata(verts, [], faces)
+ mymesh.update(calc_edges=True)
+ # Rotate if pos is front
+ xrot = 0.0
+ yrot = 0.0
+ if self.handle == "1":
+ if openside != "1":
+ yrot = math.pi
+ else:
+ yrot = 0.0
+
+ if pos == "Front":
+ xrot = math.pi
+
+ myobject.rotation_euler = (xrot, yrot, 0.0) # radians PI=180
+
+ # Translate to door and parent (depend of model of door)
+ if self.model == "1":
+ myobject.location.x = (wf * side) + (0.072 * side * -1)
+ if pos == "Front":
+ myobject.location.y = deep - 0.005
+ else:
+ myobject.location.y = 0.005
+
+ if self.model == "2" or self.model == "6":
+ myobject.location.x = (wf * side) + (0.060 * side * -1)
+ if pos == "Front":
+ myobject.location.y = deep - 0.011
+ else:
+ myobject.location.y = 0.00665
+
+ if self.model == "3":
+ myobject.location.x = (wf * side) + (0.060 * side * -1)
+ if pos == "Front":
+ myobject.location.y = deep - 0.011
+ else:
+ myobject.location.y = 0.00665
+
+ if self.model == "4" or self.model == "5":
+ myobject.location.x = (wf * side) + (0.060 * side * -1)
+ if pos == "Front":
+ myobject.location.y = deep - 0.011
+ else:
+ myobject.location.y = 0.00665
+
+ myobject.location.z = 0
+ myobject.parent = mydoor
+ myobject.lock_rotation = (True, False, True)
+
+ return myobject
+
+
+# ----------------------------------------------
+# Door model 01
+# ----------------------------------------------
+def door_model_01(frame_size, frame_width, frame_height, frame_thick, openside):
+ # ------------------------------------
+ # Mesh data
+ # ------------------------------------
+ gap = 0.002
+ sf = frame_size
+ wf = frame_width - (sf * 2) - (gap * 2)
+ hf = (frame_height / 2) - (gap * 2)
+ deep = (frame_thick * 0.50) - (gap * 3)
+ # Open to right or left
+ if openside == "1":
+ side = 1
+ minx = wf * -1
+ maxx = 0.0
+ else:
+ side = -1
+ minx = 0.0
+ maxx = wf
+
+ miny = 0.0 # locked
+ maxy = deep
+ minz = -hf
+ maxz = hf - sf - gap
+
+ # Vertex
+ myvertex = [(minx, miny, minz),
+ (minx, maxy, minz),
+ (maxx, maxy, minz),
+ (maxx, miny, minz),
+ (minx, miny, maxz),
+ (minx, maxy, maxz),
+ (maxx, maxy, maxz),
+ (maxx, miny, maxz)]
+
+ # Faces
+ myfaces = [(4, 5, 1, 0), (5, 6, 2, 1), (6, 7, 3, 2), (7, 4, 0, 3), (0, 1, 2, 3),
+ (7, 6, 5, 4)]
+
+ return myvertex, myfaces, wf, deep, side
+
+
+# ----------------------------------------------
+# Door model 02
+# ----------------------------------------------
+def door_model_02(frame_size, frame_width, frame_height, frame_thick, openside):
+ gap = 0.002
+ sf = frame_size
+ wf = frame_width - (sf * 2) - (gap * 2)
+ hf = (frame_height / 2) - (gap * 2)
+ deep = (frame_thick * 0.50)
+
+ # ------------------------------------
+ # Mesh data
+ # ------------------------------------
+ # Open to right or left
+ if openside == "1":
+ side = 1
+ minx = wf * -1
+ maxx = 0.0
+ else:
+ side = -1
+ minx = 0.0
+ maxx = wf
+
+ maxy = deep
+ minz = -hf
+ maxz = hf - sf - gap
+
+ # Vertex
+ myvertex = [(minx, -1.57160684466362e-08, minz + 2.384185791015625e-06),
+ (maxx, -1.5599653124809265e-08, minz),
+ (minx, -1.5599653124809265e-08, maxz),
+ (minx, -1.5599653124809265e-08, maxz - 0.12999999523162842),
+ (minx, -1.57160684466362e-08, minz + 0.2500007152557373),
+ (maxx, -1.5599653124809265e-08, minz + 0.25000011920928955),
+ (maxx, -1.5599653124809265e-08, maxz),
+ (maxx, -1.5599653124809265e-08, maxz - 0.12999999523162842),
+ (maxx - 0.11609852313995361, -1.5599653124809265e-08, maxz),
+ (maxx - 0.12357193231582642, -1.5599653124809265e-08, minz),
+ (maxx - 0.11658430099487305, -1.5599653124809265e-08, maxz - 0.12999999523162842),
+ (maxx - 0.12263774871826172, -1.5599653124809265e-08, minz + 0.25000011920928955),
+ (minx, -1.57160684466362e-08, minz + 0.8700000941753387),
+ (maxx, -1.5599653124809265e-08, minz + 0.8700000941753387),
+ (maxx - 0.12076938152313232, -1.5599653124809265e-08, minz + 0.7500001192092896),
+ (minx + 0.11735659837722778, -1.57160684466362e-08, minz + 0.25000011920928955),
+ (minx + 0.12341010570526123, -1.5599653124809265e-08, maxz - 0.12999999523162842),
+ (minx + 0.11642247438430786, -1.57160684466362e-08, minz),
+ (minx + 0.11967337131500244, -1.57160684466362e-08, minz + 0.8700000941753387),
+ (minx, -1.57160684466362e-08, minz + 0.7500001192092896),
+ (maxx - 0.12032097578048706, -1.5599653124809265e-08, minz + 0.8700000941753387),
+ (minx + 0.12389582395553589, -1.5599653124809265e-08, maxz),
+ (maxx, -1.5599653124809265e-08, minz + 0.7500001192092896),
+ (minx + 0.11922496557235718, -1.57160684466362e-08, minz + 0.7500001192092896),
+ (minx + 0.11922496557235718, -0.010000014677643776, minz + 0.7500001192092896),
+ (minx + 0.12341010570526123, -0.010000014677643776, maxz - 0.12999999523162842),
+ (maxx - 0.12032097578048706, -0.010000014677643776, minz + 0.8700000941753387),
+ (minx + 0.11735659837722778, -0.010000014677643776, minz + 0.25000011920928955),
+ (maxx - 0.11658430099487305, -0.010000014677643776, maxz - 0.12999999523162842),
+ (maxx - 0.12263774871826172, -0.010000014677643776, minz + 0.25000011920928955),
+ (minx + 0.11967337131500244, -0.010000014677643776, minz + 0.8700000941753387),
+ (maxx - 0.12076938152313232, -0.010000014677643776, minz + 0.7500001192092896),
+ (minx + 0.13388586044311523, -0.010000014677643776, minz + 0.7375001013278961),
+ (minx + 0.1321108341217041, -0.010000014677643776, minz + 0.2625001072883606),
+ (maxx - 0.1372986137866974, -0.010000014677643776, minz + 0.2625001072883606),
+ (maxx - 0.13552364706993103, -0.010000014677643776, minz + 0.7375001013278961),
+ (minx + 0.13802427053451538, -0.010000014677643776, maxz - 0.14747536182403564),
+ (maxx - 0.13493508100509644, -0.010000014677643776, minz + 0.8866067305207253),
+ (maxx - 0.13138526678085327, -0.010000014677643776, maxz - 0.14747536182403564),
+ (minx + 0.13447439670562744, -0.010000014677643776, minz + 0.8866067305207253),
+ (minx + 0.13388586044311523, -0.008776669390499592, minz + 0.7375001013278961),
+ (minx + 0.1321108341217041, -0.008776669390499592, minz + 0.2625001072883606),
+ (maxx - 0.1372986137866974, -0.008776669390499592, minz + 0.2625001072883606),
+ (maxx - 0.13552364706993103, -0.008776669390499592, minz + 0.7375001013278961),
+ (minx + 0.13802427053451538, -0.008776669390499592, maxz - 0.14747536182403564),
+ (maxx - 0.13493508100509644, -0.008776669390499592, minz + 0.8866067305207253),
+ (maxx - 0.13138526678085327, -0.008776669390499592, maxz - 0.14747536182403564),
+ (minx + 0.13447439670562744, -0.008776669390499592, minz + 0.8866067305207253),
+ (minx, maxy - 0.009999999776482582, minz + 2.384185791015625e-06),
+ (maxx, maxy - 0.009999999776482582, minz),
+ (minx, maxy - 0.009999999776482582, maxz),
+ (minx, maxy - 0.009999999776482582, maxz - 0.12999999523162842),
+ (minx, maxy - 0.009999999776482582, minz + 0.2500007152557373),
+ (maxx, maxy - 0.009999999776482582, minz + 0.25000011920928955),
+ (maxx, maxy - 0.009999999776482582, maxz),
+ (maxx, maxy - 0.009999999776482582, maxz - 0.12999999523162842),
+ (maxx - 0.11609852313995361, maxy - 0.009999999776482582, maxz),
+ (maxx - 0.12357193231582642, maxy - 0.009999999776482582, minz),
+ (maxx - 0.11658430099487305, maxy - 0.009999999776482582, maxz - 0.12999999523162842),
+ (maxx - 0.12263774871826172, maxy - 0.009999999776482582, minz + 0.25000011920928955),
+ (minx, maxy - 0.009999999776482582, minz + 0.8700000941753387),
+ (maxx, maxy - 0.009999999776482582, minz + 0.8700000941753387),
+ (maxx - 0.12076938152313232, maxy - 0.009999999776482582, minz + 0.7500001192092896),
+ (minx + 0.11735659837722778, maxy - 0.009999999776482582, minz + 0.25000011920928955),
+ (minx + 0.12341010570526123, maxy - 0.009999999776482582, maxz - 0.12999999523162842),
+ (minx + 0.11642247438430786, maxy - 0.009999999776482582, minz),
+ (minx + 0.11967337131500244, maxy - 0.009999999776482582, minz + 0.8700000941753387),
+ (minx, maxy - 0.009999999776482582, minz + 0.7500001192092896),
+ (maxx - 0.12032097578048706, maxy - 0.009999999776482582, minz + 0.8700000941753387),
+ (minx + 0.12389582395553589, maxy - 0.009999999776482582, maxz),
+ (maxx, maxy - 0.009999999776482582, minz + 0.7500001192092896),
+ (minx + 0.11922496557235718, maxy - 0.009999999776482582, minz + 0.7500001192092896),
+ (minx + 0.11922496557235718, maxy, minz + 0.7500001192092896),
+ (minx + 0.12341010570526123, maxy, maxz - 0.12999999523162842),
+ (maxx - 0.12032097578048706, maxy, minz + 0.8700000941753387),
+ (minx + 0.11735659837722778, maxy, minz + 0.25000011920928955),
+ (maxx - 0.11658430099487305, maxy, maxz - 0.12999999523162842),
+ (maxx - 0.12263774871826172, maxy, minz + 0.25000011920928955),
+ (minx + 0.11967337131500244, maxy, minz + 0.8700000941753387),
+ (maxx - 0.12076938152313232, maxy, minz + 0.7500001192092896),
+ (minx + 0.13388586044311523, maxy, minz + 0.7375001013278961),
+ (minx + 0.1321108341217041, maxy, minz + 0.2625001072883606),
+ (maxx - 0.1372986137866974, maxy, minz + 0.2625001072883606),
+ (maxx - 0.13552364706993103, maxy, minz + 0.7375001013278961),
+ (minx + 0.13802427053451538, maxy, maxz - 0.14747536182403564),
+ (maxx - 0.13493508100509644, maxy, minz + 0.8866067305207253),
+ (maxx - 0.13138526678085327, maxy, maxz - 0.14747536182403564),
+ (minx + 0.13447439670562744, maxy, minz + 0.8866067305207253),
+ (minx + 0.13388586044311523, maxy - 0.0012233443558216095, minz + 0.7375001013278961),
+ (minx + 0.1321108341217041, maxy - 0.0012233443558216095, minz + 0.2625001072883606),
+ (maxx - 0.1372986137866974, maxy - 0.0012233443558216095, minz + 0.2625001072883606),
+ (maxx - 0.13552364706993103, maxy - 0.0012233443558216095, minz + 0.7375001013278961),
+ (minx + 0.13802427053451538, maxy - 0.0012233443558216095, maxz - 0.14747536182403564),
+ (maxx - 0.13493508100509644, maxy - 0.0012233443558216095, minz + 0.8866067305207253),
+ (maxx - 0.13138526678085327, maxy - 0.0012233443558216095, maxz - 0.14747536182403564),
+ (minx + 0.13447439670562744, maxy - 0.0012233443558216095, minz + 0.8866067305207253)]
+
+ # Faces
+ myfaces = [(15, 4, 0, 17), (21, 2, 3, 16), (23, 19, 4, 15), (6, 8, 10, 7), (8, 21, 16, 10),
+ (16, 3, 12, 18), (11, 15, 17, 9), (20, 18, 23, 14), (18, 12, 19, 23), (5, 11, 9, 1),
+ (22, 14, 11, 5), (7, 10, 20, 13), (13, 20, 14, 22), (20, 10, 28, 26), (10, 16, 25, 28),
+ (16, 18, 30, 25), (18, 20, 26, 30), (15, 11, 29, 27), (14, 23, 24, 31), (23, 15, 27, 24),
+ (11, 14, 31, 29), (31, 24, 32, 35), (24, 27, 33, 32), (27, 29, 34, 33), (29, 31, 35, 34),
+ (26, 28, 38, 37), (30, 26, 37, 39), (28, 25, 36, 38), (25, 30, 39, 36), (33, 34, 42, 41),
+ (36, 39, 47, 44), (34, 35, 43, 42), (37, 38, 46, 45), (32, 33, 41, 40), (38, 36, 44, 46),
+ (35, 32, 40, 43), (39, 37, 45, 47), (18, 20, 10, 16), (14, 23, 15, 11), (63, 52, 48, 65),
+ (69, 50, 51, 64), (71, 67, 52, 63), (54, 56, 58, 55), (56, 69, 64, 58), (64, 51, 60, 66),
+ (59, 63, 65, 57), (68, 66, 71, 62), (66, 60, 67, 71), (53, 59, 57, 49), (70, 62, 59, 53),
+ (55, 58, 68, 61), (61, 68, 62, 70), (68, 58, 76, 74), (58, 64, 73, 76), (64, 66, 78, 73),
+ (66, 68, 74, 78), (63, 59, 77, 75), (62, 71, 72, 79), (71, 63, 75, 72), (59, 62, 79, 77),
+ (79, 72, 80, 83), (72, 75, 81, 80), (75, 77, 82, 81), (77, 79, 83, 82), (74, 76, 86, 85),
+ (78, 74, 85, 87), (76, 73, 84, 86), (73, 78, 87, 84), (81, 82, 90, 89), (84, 87, 95, 92),
+ (82, 83, 91, 90), (85, 86, 94, 93), (80, 81, 89, 88), (86, 84, 92, 94), (83, 80, 88, 91),
+ (87, 85, 93, 95), (66, 68, 58, 64), (62, 71, 63, 59), (50, 2, 21, 69), (8, 56, 69, 21),
+ (6, 54, 56, 8), (54, 6, 7, 55), (55, 7, 13, 61), (61, 13, 22, 70), (5, 53, 70, 22),
+ (1, 49, 53, 5), (49, 1, 9, 57), (57, 9, 17, 65), (0, 48, 65, 17), (48, 0, 4, 52),
+ (52, 4, 19, 67), (12, 60, 67, 19), (3, 51, 60, 12), (2, 50, 51, 3)]
+
+ return myvertex, myfaces, wf, deep, side
+
+
+# ----------------------------------------------
+# Door model 03
+# ----------------------------------------------
+def door_model_03(frame_size, frame_width, frame_height, frame_thick, openside):
+ gap = 0.002
+ sf = frame_size
+ wf = frame_width - (sf * 2) - (gap * 2)
+ hf = (frame_height / 2) - (gap * 2)
+ deep = (frame_thick * 0.50)
+
+ # ------------------------------------
+ # Mesh data
+ # ------------------------------------
+ # Open to right or left
+ if openside == "1":
+ side = 1
+ minx = wf * -1
+ maxx = 0.0
+ else:
+ side = -1
+ minx = 0.0
+ maxx = wf
+
+ miny = 0.0 # Locked
+
+ maxy = deep
+ minz = -hf
+ maxz = hf - sf - gap
+
+ # Vertex
+ myvertex = [(minx, -1.5599653124809265e-08, maxz),
+ (maxx, -1.5599653124809265e-08, maxz),
+ (minx, maxy, maxz),
+ (maxx, maxy, maxz),
+ (maxx - 0.10429960489273071, -1.5832483768463135e-08, maxz),
+ (minx + 0.10429966449737549, -1.5832483768463135e-08, maxz),
+ (minx + 0.10429966449737549, maxy, maxz),
+ (minx, -1.5628756955266e-08, maxz - 0.5012519359588623),
+ (maxx, -1.5599653124809265e-08, maxz - 0.5012525320053101),
+ (minx, maxy, maxz - 0.5012519359588623),
+ (maxx, maxy, maxz - 0.5012525320053101),
+ (maxx - 0.10429960489273071, -1.5832483768463135e-08, maxz - 0.501252293586731),
+ (minx + 0.10429966449737549, -1.5832483768463135e-08, maxz - 0.5012521147727966),
+ (minx + 0.10429966449737549, maxy, maxz - 0.5012521147727966),
+ (maxx - 0.10429960489273071, maxy, maxz - 0.501252293586731),
+ (minx + 0.11909735202789307, -1.5832483768463135e-08, maxz),
+ (maxx - 0.11909729242324829, -1.5832483768463135e-08, maxz),
+ (minx + 0.11909735202789307, maxy, maxz),
+ (minx + 0.11909735202789307, -1.5832483768463135e-08, maxz - 0.5012521743774414),
+ (maxx - 0.11909729242324829, -1.5832483768463135e-08, maxz - 0.5012522339820862),
+ (minx, -1.5629622041046787e-08, maxz - 0.516154021024704),
+ (maxx, -1.5599653124809265e-08, maxz - 0.5161546468734741),
+ (minx, maxy, maxz - 0.516154021024704),
+ (maxx, maxy, maxz - 0.5161546468734741),
+ (maxx - 0.10429960489273071, -1.5832483768463135e-08, maxz - 0.516154408454895),
+ (minx + 0.10429966449737549, -1.5832483768463135e-08, maxz - 0.5161541998386383),
+ (maxx - 0.10429960489273071, maxy, maxz - 0.516154408454895),
+ (maxx - 0.11909729242324829, -1.5832483768463135e-08, maxz - 0.5161543190479279),
+ (minx + 0.11909735202789307, -1.5832483768463135e-08, maxz - 0.5161542594432831),
+ (minx + 0.11909735202789307, maxy, maxz - 0.5161542594432831),
+ (maxx - 0.10429960489273071, miny + 0.009999999776482582, maxz),
+ (minx + 0.10429966449737549, miny + 0.009999999776482582, maxz),
+ (maxx - 0.10429960489273071, miny + 0.009999999776482582, maxz - 0.501252293586731),
+ (minx + 0.10429966449737549, miny + 0.009999999776482582, maxz - 0.5012521147727966),
+ (minx + 0.11909735202789307, miny + 0.009999999776482582, maxz),
+ (maxx - 0.11909729242324829, miny + 0.009999999776482582, maxz),
+ (minx + 0.11909735202789307, miny + 0.009999999776482582, maxz - 0.5012521743774414),
+ (maxx - 0.11909729242324829, miny + 0.009999999776482582, maxz - 0.5012522339820862),
+ (maxx - 0.10429960489273071, miny + 0.009999999776482582, maxz - 0.516154408454895),
+ (minx + 0.10429966449737549, miny + 0.009999999776482582, maxz - 0.5161541998386383),
+ (maxx - 0.11909729242324829, miny + 0.009999999776482582, maxz - 0.5161543190479279),
+ (minx + 0.11909735202789307, miny + 0.009999999776482582, maxz - 0.5161542594432831),
+ (maxx - 0.11909729242324829, -1.5832483768463135e-08, maxz - 0.992994874715805),
+ (minx + 0.11909735202789307, -1.5832483768463135e-08, maxz - 0.9929947257041931),
+ (minx + 0.11909735202789307, maxy, maxz - 0.9929947257041931),
+ (maxx - 0.11909738183021545, maxy, maxz - 0.992994874715805),
+ (minx, -1.565730833874568e-08, maxz - 0.9929942488670349),
+ (maxx, -1.5599653124809265e-08, maxz - 0.9929954260587692),
+ (minx, maxy, maxz - 0.9929942488670349),
+ (maxx, maxy, maxz - 0.9929954260587692),
+ (maxx - 0.10429960489273071, -1.5832483768463135e-08, maxz - 0.9929950088262558),
+ (minx + 0.10429966449737549, -1.5832483768463135e-08, maxz - 0.9929945915937424),
+ (maxx - 0.10429960489273071, maxy, maxz - 0.9929950088262558),
+ (maxx - 0.10429960489273071, miny + 0.009999999776482582, maxz - 0.9929950088262558),
+ (minx + 0.10429966449737549, miny + 0.009999999776482582, maxz - 0.9929945915937424),
+ (maxx - 0.11909729242324829, miny + 0.009999999776482582, maxz - 0.992994874715805),
+ (minx + 0.11909735202789307, miny + 0.009999999776482582, maxz - 0.9929947257041931),
+ (maxx - 0.11909729242324829, maxy - 0.0004077646881341934, maxz - 0.992994874715805),
+ (maxx - 0.10429960489273071, maxy - 0.0004077646881341934, maxz - 0.9929950088262558),
+ (maxx - 0.10429960489273071, maxy, maxz),
+ (maxx - 0.11909729242324829, maxy, maxz),
+ (maxx - 0.11909738183021545, maxy, maxz - 0.5012522339820862),
+ (minx + 0.11909735202789307, maxy, maxz - 0.5012521743774414),
+ (minx + 0.10429966449737549, maxy, maxz - 0.5161541998386383),
+ (maxx - 0.11909738183021545, maxy, maxz - 0.5161543190479279),
+ (minx + 0.10429966449737549, maxy, maxz - 0.9929945915937424),
+ (maxx - 0.10429960489273071, maxy - 0.008999999612569809, maxz),
+ (minx + 0.10429966449737549, maxy - 0.008999999612569809, maxz),
+ (minx + 0.10429966449737549, maxy - 0.008999999612569809, maxz - 0.5012521147727966),
+ (maxx - 0.10429960489273071, maxy - 0.008999999612569809, maxz - 0.501252293586731),
+ (minx + 0.11909735202789307, maxy - 0.008999999612569809, maxz),
+ (maxx - 0.11909729242324829, maxy - 0.008999999612569809, maxz),
+ (maxx - 0.11909738183021545, maxy - 0.008999999612569809, maxz - 0.5012522339820862),
+ (minx + 0.11909735202789307, maxy - 0.008999999612569809, maxz - 0.5012521743774414),
+ (minx + 0.10429966449737549, maxy - 0.008999999612569809, maxz - 0.5161541998386383),
+ (maxx - 0.10429960489273071, maxy - 0.008999999612569809, maxz - 0.516154408454895),
+ (minx + 0.11909735202789307, maxy - 0.008999999612569809, maxz - 0.5161542594432831),
+ (maxx - 0.11909738183021545, maxy - 0.008999999612569809, maxz - 0.5161543190479279),
+ (minx + 0.11909735202789307, maxy - 0.008999999612569809, maxz - 0.9929947257041931),
+ (maxx - 0.11909738183021545, maxy - 0.008999999612569809, maxz - 0.992994874715805),
+ (minx + 0.10429966449737549, maxy - 0.008999999612569809, maxz - 0.9929945915937424),
+ (maxx - 0.10429960489273071, maxy - 0.008999999612569809, maxz - 0.9929950088262558),
+ (minx, -1.5599653124809265e-08, minz),
+ (maxx, -1.5599653124809265e-08, minz),
+ (minx, maxy, minz),
+ (maxx, maxy, minz),
+ (maxx - 0.10429960489273071, -1.5832483768463135e-08, minz),
+ (minx + 0.10429966449737549, -1.5832483768463135e-08, minz),
+ (minx + 0.10429966449737549, maxy, minz),
+ (minx, -1.5628756955266e-08, minz + 0.5012519359588623),
+ (minx, -1.5657860785722733e-08, minz + 1.0025038719177246),
+ (maxx, -1.5599653124809265e-08, minz + 0.5012525320053101),
+ (maxx, -1.5599653124809265e-08, minz + 1.0025050640106201),
+ (minx, maxy, minz + 0.5012519359588623),
+ (minx, maxy, minz + 1.0025038719177246),
+ (maxx, maxy, minz + 0.5012525320053101),
+ (maxx, maxy, minz + 1.0025050640106201),
+ (maxx - 0.10429960489273071, -1.5832483768463135e-08, minz + 0.501252293586731),
+ (maxx - 0.10429960489273071, -1.5832483768463135e-08, minz + 1.0025046467781067),
+ (minx + 0.10429966449737549, -1.5832483768463135e-08, minz + 0.5012521147727966),
+ (minx + 0.10429966449737549, -1.5832483768463135e-08, minz + 1.0025042295455933),
+ (minx + 0.10429966449737549, maxy, minz + 0.5012521147727966),
+ (minx + 0.10429966449737549, maxy, minz + 1.0025042295455933),
+ (maxx - 0.10429960489273071, maxy, minz + 0.501252293586731),
+ (maxx - 0.10429960489273071, maxy, minz + 1.0025046467781067),
+ (minx + 0.11909735202789307, -1.5832483768463135e-08, minz),
+ (maxx - 0.11909729242324829, -1.5832483768463135e-08, minz),
+ (minx + 0.11909735202789307, maxy, minz),
+ (minx + 0.11909735202789307, -1.5832483768463135e-08, minz + 0.5012521743774414),
+ (maxx - 0.11909729242324829, -1.5832483768463135e-08, minz + 0.5012522339820862),
+ (minx + 0.11909735202789307, maxy, minz + 1.0025043686230788),
+ (minx, -1.5629622041046787e-08, minz + 0.516154021024704),
+ (maxx, -1.5599653124809265e-08, minz + 0.5161546468734741),
+ (minx, maxy, minz + 0.516154021024704),
+ (maxx, maxy, minz + 0.5161546468734741),
+ (maxx - 0.10429960489273071, -1.5832483768463135e-08, minz + 0.516154408454895),
+ (minx + 0.10429966449737549, -1.5832483768463135e-08, minz + 0.5161541998386383),
+ (maxx - 0.10429960489273071, maxy, minz + 0.516154408454895),
+ (maxx - 0.11909729242324829, -1.5832483768463135e-08, minz + 0.5161543190479279),
+ (minx + 0.11909735202789307, -1.5832483768463135e-08, minz + 0.5161542594432831),
+ (minx + 0.11909735202789307, maxy, minz + 0.5161542594432831),
+ (maxx - 0.10429960489273071, miny + 0.009999999776482582, minz),
+ (minx + 0.10429966449737549, miny + 0.009999999776482582, minz),
+ (maxx - 0.10429960489273071, miny + 0.009999999776482582, minz + 0.501252293586731),
+ (maxx - 0.10429960489273071, miny + 0.009999999776482582, minz + 1.0025046467781067),
+ (minx + 0.10429966449737549, miny + 0.009999999776482582, minz + 0.5012521147727966),
+ (minx + 0.10429966449737549, miny + 0.009999999776482582, minz + 1.0025042295455933),
+ (minx + 0.11909735202789307, miny + 0.009999999776482582, minz),
+ (maxx - 0.11909729242324829, miny + 0.009999999776482582, minz),
+ (minx + 0.11909735202789307, miny + 0.009999999776482582, minz + 0.5012521743774414),
+ (maxx - 0.11909729242324829, miny + 0.009999999776482582, minz + 0.5012522339820862),
+ (maxx - 0.10429960489273071, miny + 0.009999999776482582, minz + 0.516154408454895),
+ (minx + 0.10429966449737549, miny + 0.009999999776482582, minz + 0.5161541998386383),
+ (maxx - 0.11909729242324829, miny + 0.009999999776482582, minz + 0.5161543190479279),
+ (minx + 0.11909735202789307, miny + 0.009999999776482582, minz + 0.5161542594432831),
+ (maxx - 0.11909729242324829, -1.5832483768463135e-08, minz + 0.992994874715805),
+ (minx + 0.11909735202789307, -1.5832483768463135e-08, minz + 0.9929947257041931),
+ (minx + 0.11909735202789307, maxy, minz + 0.9929947257041931),
+ (maxx - 0.11909738183021545, maxy, minz + 0.992994874715805),
+ (minx, -1.565730833874568e-08, minz + 0.9929942488670349),
+ (maxx, -1.5599653124809265e-08, minz + 0.9929954260587692),
+ (minx, maxy, minz + 0.9929942488670349),
+ (maxx, maxy, minz + 0.9929954260587692),
+ (maxx - 0.10429960489273071, -1.5832483768463135e-08, minz + 0.9929950088262558),
+ (minx + 0.10429966449737549, -1.5832483768463135e-08, minz + 0.9929945915937424),
+ (maxx - 0.10429960489273071, maxy, minz + 0.9929950088262558),
+ (maxx - 0.10429960489273071, miny + 0.009999999776482582, minz + 0.9929950088262558),
+ (minx + 0.10429966449737549, miny + 0.009999999776482582, minz + 0.9929945915937424),
+ (minx + 0.11909735202789307, miny + 0.009999999776482582, minz + 1.0025043686231356),
+ (maxx - 0.11909729242324829, miny + 0.009999999776482582, minz + 1.0025045077006212),
+ (maxx - 0.10429960489273071, maxy - 0.0004077646881341934, minz + 1.0025046467781067),
+ (maxx - 0.11909729242324829, maxy - 0.0004077646881341934, minz + 1.0025045077006212),
+ (maxx - 0.11909729242324829, miny + 0.009999999776482582, minz + 0.992994874715805),
+ (minx + 0.11909735202789307, miny + 0.009999999776482582, minz + 0.9929947257041931),
+ (maxx - 0.11909729242324829, maxy - 0.0004077646881341934, minz + 0.992994874715805),
+ (maxx - 0.10429960489273071, maxy - 0.0004077646881341934, minz + 0.9929950088262558),
+ (maxx - 0.10429960489273071, maxy, minz),
+ (maxx - 0.11909729242324829, maxy, minz),
+ (maxx - 0.11909738183021545, maxy, minz + 0.5012522339820862),
+ (minx + 0.11909735202789307, maxy, minz + 0.5012521743774414),
+ (maxx - 0.11909738183021545, maxy, minz + 1.0025045077005643),
+ (minx + 0.10429966449737549, maxy, minz + 0.5161541998386383),
+ (maxx - 0.11909738183021545, maxy, minz + 0.5161543190479279),
+ (minx + 0.10429966449737549, maxy, minz + 0.9929945915937424),
+ (maxx - 0.10429960489273071, maxy - 0.008999999612569809, minz),
+ (minx + 0.10429966449737549, maxy - 0.008999999612569809, minz),
+ (minx + 0.10429966449737549, maxy - 0.008999999612569809, minz + 0.5012521147727966),
+ (minx + 0.10429966449737549, maxy - 0.008999999612569809, minz + 1.0025042295455933),
+ (maxx - 0.10429960489273071, maxy - 0.008999999612569809, minz + 0.501252293586731),
+ (maxx - 0.10429960489273071, maxy - 0.008999999612569809, minz + 1.0025046467781067),
+ (minx + 0.11909735202789307, maxy - 0.008999999612569809, minz),
+ (maxx - 0.11909729242324829, maxy - 0.008999999612569809, minz),
+ (maxx - 0.11909738183021545, maxy - 0.008999999612569809, minz + 0.5012522339820862),
+ (minx + 0.11909735202789307, maxy - 0.008999999612569809, minz + 0.5012521743774414),
+ (maxx - 0.11909738183021545, maxy - 0.008999999612569809, minz + 1.0025045077005643),
+ (minx + 0.11909735202789307, maxy - 0.008999999612569809, minz + 1.0025043686230788),
+ (minx + 0.10429966449737549, maxy - 0.008999999612569809, minz + 0.5161541998386383),
+ (maxx - 0.10429960489273071, maxy - 0.008999999612569809, minz + 0.516154408454895),
+ (minx + 0.11909735202789307, maxy - 0.008999999612569809, minz + 0.5161542594432831),
+ (maxx - 0.11909738183021545, maxy - 0.008999999612569809, minz + 0.5161543190479279),
+ (minx + 0.11909735202789307, maxy - 0.008999999612569809, minz + 0.9929947257041931),
+ (maxx - 0.11909738183021545, maxy - 0.008999999612569809, minz + 0.992994874715805),
+ (minx + 0.10429966449737549, maxy - 0.008999999612569809, minz + 0.9929945915937424),
+ (maxx - 0.10429960489273071, maxy - 0.008999999612569809, minz + 0.9929950088262558)]
+
+ # Faces
+ myfaces = [(2, 0, 5, 6), (3, 1, 8, 10), (49, 47, 92, 96), (0, 2, 9, 7), (46, 48, 94, 90),
+ (5, 0, 7, 12), (51, 46, 90, 100), (52, 49, 96, 104), (1, 4, 11, 8), (47, 50, 98, 92),
+ (12, 25, 39, 33), (2, 6, 13, 9), (5, 12, 33, 31), (16, 15, 18, 19), (18, 15, 34, 36),
+ (10, 8, 21, 23), (7, 9, 22, 20), (12, 7, 20, 25), (14, 10, 23, 26), (8, 11, 24, 21),
+ (51, 100, 126, 54), (24, 11, 32, 38), (16, 19, 37, 35), (34, 31, 33, 36), (30, 35, 37, 32),
+ (36, 33, 39, 41), (32, 37, 40, 38), (37, 36, 41, 40), (19, 18, 36, 37), (28, 27, 40, 41),
+ (20, 22, 48, 46), (11, 4, 30, 32), (23, 21, 47, 49), (50, 24, 38, 53), (25, 20, 46, 51),
+ (26, 23, 49, 52), (21, 24, 50, 47), (27, 28, 43, 42), (25, 51, 54, 39), (98, 50, 53, 124),
+ (55, 56, 148, 149), (126, 148, 56, 54), (42, 43, 56, 55), (124, 53, 55, 149), (61, 60, 71, 72),
+ (35, 30, 66, 71), (31, 34, 70, 67), (71, 66, 69, 72), (79, 81, 169, 174), (67, 70, 73, 68),
+ (80, 78, 175, 167), (78, 79, 174, 175), (72, 69, 75, 77), (68, 73, 76, 74), (73, 72, 77, 76),
+ (77, 75, 81, 79), (74, 76, 78, 80), (62, 61, 72, 73), (65, 63, 74, 80), (59, 4, 1, 3),
+ (59, 3, 10, 14), (48, 65, 102, 94), (17, 15, 16, 60), (17, 60, 61, 62), (9, 13, 63, 22),
+ (43, 28, 41, 56), (27, 42, 55, 40), (22, 63, 65, 48), (29, 64, 45, 44), (41, 39, 54, 56),
+ (38, 40, 55, 53), (29, 44, 78, 76), (63, 13, 68, 74), (17, 62, 73, 70), (52, 104, 169, 81),
+ (64, 29, 76, 77), (13, 6, 67, 68), (59, 14, 69, 66), (44, 45, 79, 78), (45, 64, 77, 79),
+ (14, 26, 75, 69), (26, 52, 81, 75), (102, 65, 80, 167), (84, 88, 87, 82), (85, 95, 91, 83),
+ (142, 96, 92, 140), (82, 89, 93, 84), (139, 90, 94, 141), (87, 99, 89, 82), (144, 100, 90, 139),
+ (145, 104, 96, 142), (83, 91, 97, 86), (140, 92, 98, 143), (99, 125, 132, 116), (84, 93, 101, 88),
+ (87, 122, 125, 99), (106, 109, 108, 105), (108, 129, 127, 105), (95, 114, 112, 91), (89, 111, 113, 93),
+ (99, 116, 111, 89), (103, 117, 114, 95), (91, 112, 115, 97), (144, 147, 126, 100), (115, 131, 123, 97),
+ (106, 128, 130, 109), (127, 129, 125, 122), (121, 123, 130, 128), (129, 134, 132, 125),
+ (123, 131, 133, 130),
+ (130, 133, 134, 129), (109, 130, 129, 108), (119, 134, 133, 118), (111, 139, 141, 113),
+ (97, 123, 121, 86),
+ (114, 142, 140, 112), (143, 146, 131, 115), (116, 144, 139, 111), (117, 145, 142, 114),
+ (112, 140, 143, 115),
+ (118, 135, 136, 119), (116, 132, 147, 144), (98, 124, 146, 143), (152, 149, 148, 153),
+ (126, 147, 153, 148),
+ (135, 152, 153, 136), (124, 149, 152, 146), (158, 172, 171, 157), (128, 171, 164, 121),
+ (122, 165, 170, 127),
+ (171, 172, 168, 164), (181, 174, 169, 183), (165, 166, 173, 170), (182, 167, 175, 180),
+ (180, 175, 174, 181),
+ (172, 179, 177, 168), (166, 176, 178, 173), (173, 178, 179, 172), (179, 181, 183, 177),
+ (176, 182, 180, 178),
+ (159, 173, 172, 158), (163, 182, 176, 161), (156, 85, 83, 86), (156, 103, 95, 85), (141, 94, 102, 163),
+ (107, 157, 106, 105), (107, 159, 158, 157), (93, 113, 161, 101), (136, 153, 134, 119),
+ (118, 133, 152, 135),
+ (113, 141, 163, 161), (120, 137, 138, 162), (134, 153, 147, 132), (131, 146, 152, 133),
+ (120, 178, 180, 137),
+ (161, 176, 166, 101), (107, 170, 173, 159), (145, 183, 169, 104), (162, 179, 178, 120),
+ (101, 166, 165, 88),
+ (160, 174, 175, 110), (156, 164, 168, 103), (137, 180, 181, 138), (138, 181, 179, 162),
+ (103, 168, 177, 117),
+ (117, 177, 183, 145), (102, 167, 182, 163)]
+
+ return myvertex, myfaces, wf, deep, side
+
+
+# ----------------------------------------------
+# Door model 04
+# ----------------------------------------------
+def door_model_04(frame_size, frame_width, frame_height, frame_thick, openside):
+ gap = 0.002
+ sf = frame_size
+ wf = frame_width - (sf * 2) - (gap * 2)
+ hf = (frame_height / 2) - (gap * 2)
+ deep = (frame_thick * 0.50)
+
+ # ------------------------------------
+ # Mesh data
+ # ------------------------------------
+ # Open to right or left
+ if openside == "1":
+ side = 1
+ minx = wf * -1
+ maxx = 0.0
+ else:
+ side = -1
+ minx = 0.0
+ maxx = wf
+
+ miny = 0.0 # Locked
+
+ maxy = deep
+ minz = -hf
+ maxz = hf - sf - gap
+
+ # Vertex
+ myvertex = [(minx, -1.57160684466362e-08, minz + 2.384185791015625e-06),
+ (maxx, -1.5599653124809265e-08, minz),
+ (minx, -1.5599653124809265e-08, maxz),
+ (minx, -1.5599653124809265e-08, maxz - 0.12999999523162842),
+ (minx, -1.57160684466362e-08, minz + 0.2500007152557373),
+ (maxx, -1.5599653124809265e-08, minz + 0.25000011920928955),
+ (maxx, -1.5599653124809265e-08, maxz),
+ (maxx, -1.5599653124809265e-08, maxz - 0.12999999523162842),
+ (maxx - 0.11968576163053513, -1.5599653124809265e-08, maxz),
+ (maxx - 0.11968576163053513, -1.5599653124809265e-08, minz),
+ (maxx - 0.11968576163053513, -1.5599653124809265e-08, maxz - 0.12999999523162842),
+ (maxx - 0.11968576163053513, -1.5599653124809265e-08, minz + 0.25000011920928955),
+ (minx + 0.12030857801437378, -1.5832483768463135e-08, minz + 0.25000011920928955),
+ (minx + 0.12030857801437378, -1.5599653124809265e-08, maxz - 0.12999999523162842),
+ (minx + 0.12030857801437378, -1.5832483768463135e-08, minz),
+ (minx + 0.12030857801437378, -1.5599653124809265e-08, maxz),
+ (minx + 0.12030857801437378, -0.010000014677643776, maxz - 0.12999999523162842),
+ (minx + 0.12030857801437378, -0.010000014677643776, minz + 0.25000011920928955),
+ (maxx - 0.11968576163053513, -0.010000014677643776, maxz - 0.12999999523162842),
+ (maxx - 0.11968576163053513, -0.010000014677643776, minz + 0.25000011920928955),
+ (maxx - 0.1353275030851364, -0.009388341568410397, minz + 0.26250016689300537),
+ (maxx - 0.1353275030851364, -0.009388341568410397, maxz - 0.14747536182403564),
+ (minx + 0.13506758213043213, -0.009388341568410397, minz + 0.26250016689300537),
+ (maxx - 0.1353275030851364, -0.008776669390499592, minz + 0.26250016689300537),
+ (minx + 0.13506758213043213, -0.009388341568410397, maxz - 0.14747536182403564),
+ (maxx - 0.1353275030851364, -0.0003883419558405876, minz + 0.26250016689300537),
+ (maxx - 0.1353275030851364, -0.0003883419558405876, maxz - 0.14747536182403564),
+ (minx + 0.13506758213043213, -0.0003883419558405876, minz + 0.26250016689300537),
+ (maxx - 0.1353275030851364, miny + 0.010223344899713993, minz + 0.26250016689300537),
+ (minx + 0.13506758213043213, -0.0003883419558405876, maxz - 0.14747536182403564),
+ (minx, maxy - 0.009999999776482582, minz + 2.384185791015625e-06),
+ (maxx, maxy - 0.009999999776482582, minz),
+ (minx, maxy - 0.009999999776482582, maxz),
+ (minx, maxy - 0.009999999776482582, maxz - 0.12999999523162842),
+ (minx, maxy - 0.009999999776482582, minz + 0.2500007152557373),
+ (maxx, maxy - 0.009999999776482582, minz + 0.25000011920928955),
+ (maxx, maxy - 0.009999999776482582, maxz),
+ (maxx, maxy - 0.009999999776482582, maxz - 0.12999999523162842),
+ (maxx - 0.11968576908111572, maxy - 0.009999999776482582, maxz),
+ (maxx - 0.11968576908111572, maxy - 0.009999999776482582, minz),
+ (maxx - 0.11968576908111572, maxy - 0.009999999776482582, maxz - 0.12999999523162842),
+ (maxx - 0.11968576908111572, maxy - 0.009999999776482582, minz + 0.25000011920928955),
+ (minx + 0.12030857801437378, maxy - 0.009999999776482582, minz + 0.25000011920928955),
+ (minx + 0.12030857801437378, maxy - 0.009999999776482582, maxz - 0.12999999523162842),
+ (minx + 0.12030857801437378, maxy - 0.009999999776482582, minz),
+ (minx + 0.12030857801437378, maxy - 0.009999999776482582, maxz),
+ (minx + 0.12030857801437378, maxy, maxz - 0.12999999523162842),
+ (minx + 0.12030857801437378, maxy, minz + 0.25000011920928955),
+ (maxx - 0.11968576908111572, maxy, maxz - 0.12999999523162842),
+ (maxx - 0.11968576908111572, maxy, minz + 0.25000011920928955),
+ (maxx - 0.1353275179862976, maxy - 0.0006116721779108047, minz + 0.26250016689300537),
+ (maxx - 0.1353275179862976, maxy - 0.0006116721779108047, maxz - 0.14747536182403564),
+ (minx + 0.13506758213043213, maxy - 0.0006116721779108047, minz + 0.26250016689300537),
+ (maxx - 0.1353275179862976, maxy - 0.0012233462184667587, minz + 0.26250016689300537),
+ (minx + 0.13506758213043213, maxy - 0.0006116721779108047, maxz - 0.14747536182403564),
+ (maxx - 0.1353275179862976, maxy - 0.009611671790480614, minz + 0.26250016689300537),
+ (maxx - 0.1353275179862976, maxy - 0.009611671790480614, maxz - 0.14747536182403564),
+ (minx + 0.13506758213043213, maxy - 0.009611671790480614, minz + 0.26250016689300537),
+ (maxx - 0.1353275179862976, maxy - 0.010223345831036568, minz + 0.26250016689300537),
+ (minx + 0.13506758213043213, maxy - 0.009611671790480614, maxz - 0.14747536182403564)]
+
+ # Faces
+ myfaces = [(12, 4, 0, 14), (15, 2, 3, 13), (6, 8, 10, 7), (8, 15, 13, 10), (11, 12, 14, 9),
+ (5, 11, 9, 1), (10, 13, 16, 18), (12, 11, 19, 17), (3, 4, 12, 13), (5, 7, 10, 11),
+ (23, 19, 17, 22), (18, 19, 20, 21), (17, 16, 24, 22), (17, 16, 13, 12), (11, 10, 18, 19),
+ (21, 18, 16, 24), (22, 24, 29, 27), (21, 24, 29, 26), (21, 20, 25, 26), (23, 22, 27, 28),
+ (25, 28, 27, 29, 26), (42, 34, 30, 44), (45, 32, 33, 43), (36, 38, 40, 37), (38, 45, 43, 40),
+ (41, 42, 44, 39), (35, 41, 39, 31), (40, 43, 46, 48), (42, 41, 49, 47), (33, 34, 42, 43),
+ (35, 37, 40, 41), (53, 49, 47, 52), (48, 49, 50, 51), (47, 46, 54, 52), (47, 46, 43, 42),
+ (41, 40, 48, 49), (51, 48, 46, 54), (52, 54, 59, 57), (51, 54, 59, 56), (51, 50, 55, 56),
+ (53, 52, 57, 58), (55, 58, 57, 59, 56), (36, 6, 8, 38), (38, 8, 15, 45), (2, 32, 45, 15),
+ (6, 36, 37, 7), (7, 37, 35, 5), (31, 1, 5, 35), (1, 31, 39, 9), (9, 39, 44, 14),
+ (30, 0, 14, 44), (34, 4, 3, 33), (32, 2, 3, 33), (34, 4, 0, 30)]
+
+ return myvertex, myfaces, wf, deep, side
+
+
+# ----------------------------------------------
+# Handle model 01
+# ----------------------------------------------
+def handle_model_01():
+ # ------------------------------------
+ # Mesh data
+ # ------------------------------------
+ minx = -0.04349547624588013
+ maxx = 0.13793155550956726
+ miny = -0.07251644879579544
+ maxy = 0
+ minz = -0.04352371022105217
+ maxz = 0.04349301755428314
+
+ # Vertex
+ myvertex = [(minx + 0.013302795588970184, maxy - 0.002780601382255554, minz + 0.010707870125770569),
+ (minx + 0.0009496212005615234, maxy - 0.002942140679806471, minz + 0.030204588547348976),
+ (minx, maxy - 0.003071820829063654, maxz - 0.033750676549971104),
+ (minx + 0.010708402842283249, maxy - 0.0031348932534456253, maxz - 0.013303784653544426),
+ (minx + 0.03020550962537527, maxy - 0.003114458406344056, maxz - 0.0009501762688159943),
+ (minx + 0.053267089650034904, maxy - 0.003015991533175111, maxz - 0.0),
+ (minx + 0.07371381670236588, maxy - 0.0028658765368163586, maxz - 0.010707847774028778),
+ (minx + 0.08606699481606483, maxy - 0.0027043374720960855, maxz - 0.030204561538994312),
+ (minx + 0.08701662346720695, maxy - 0.0025746573228389025, minz + 0.03375071194022894),
+ (minx + 0.0763082429766655, maxy - 0.002511584199965, minz + 0.013303810730576515),
+ (minx + 0.05681113991886377, maxy - 0.0025320190470665693, minz + 0.0009501948952674866),
+ (minx + 0.03374955803155899, maxy - 0.0026304861530661583, minz),
+ (minx + 0.014472760260105133, maxy - 0.019589224830269814, minz + 0.011804874986410141),
+ (minx + 0.002567145973443985, maxy - 0.019744910299777985, minz + 0.030595174990594387),
+ (minx + 0.001651916652917862, maxy - 0.019869891926646233, maxz - 0.034195657819509506),
+ (minx + 0.011972300708293915, maxy - 0.019930677488446236, maxz - 0.014489583671092987),
+ (minx + 0.03076297417283058, maxy - 0.019910985603928566, maxz - 0.0025835558772087097),
+ (minx + 0.0529889902099967, maxy - 0.019816085696220398, maxz - 0.0016677752137184143),
+ (minx + 0.07269490510225296, maxy - 0.01967141032218933, maxz - 0.011987630277872086),
+ (minx + 0.0846005342900753, maxy - 0.01951572299003601, maxz - 0.030777926556766033),
+ (minx + 0.08551576733589172, maxy - 0.019390743225812912, minz + 0.03401290811598301),
+ (minx + 0.07519540190696716, maxy - 0.01932995393872261, minz + 0.014306826516985893),
+ (minx + 0.056404732167720795, maxy - 0.01934964768588543, minz + 0.002400781959295273),
+ (minx + 0.03417872078716755, maxy - 0.019444547593593597, minz + 0.001484982669353485),
+ (minx + 0.043508310547622386, maxy - 0.0028232389595359564, maxz - 0.043508357635801076),
+ (minx + 0.029034355655312538, maxy - 0.019612153992056847, minz + 0.027617475017905235),
+ (minx + 0.023084014654159546, maxy - 0.01968996599316597, minz + 0.03700872650370002),
+ (minx + 0.022626593708992004, maxy - 0.01975242979824543, maxz - 0.03889966616407037),
+ (minx + 0.027784643694758415, maxy - 0.019782811403274536, maxz - 0.029050718992948532),
+ (minx + 0.03717608004808426, maxy - 0.019772969186306, maxz - 0.023100173100829124),
+ (minx + 0.048284475691616535, maxy - 0.019725536927580833, maxz - 0.022642474621534348),
+ (minx + 0.058133346028625965, maxy - 0.019653232768177986, maxz - 0.02780025824904442),
+ (minx + 0.06408369168639183, maxy - 0.019575420767068863, maxz - 0.0371915097348392),
+ (minx + 0.06454112380743027, maxy - 0.019512956961989403, minz + 0.03871688432991505),
+ (minx + 0.059383073821663857, maxy - 0.019482573494315147, minz + 0.02886793203651905),
+ (minx + 0.04999163839966059, maxy - 0.019492419436573982, minz + 0.022917380556464195),
+ (minx + 0.038883245550096035, maxy - 0.0195398461073637, minz + 0.022459672763943672),
+ (minx + 0.029087782837450504, maxy - 0.03150090575218201, minz + 0.027552824467420578),
+ (minx + 0.023137442767620087, maxy - 0.03157871589064598, minz + 0.036944076884537935),
+ (minx + 0.022680018097162247, maxy - 0.03164118155837059, maxz - 0.03896431624889374),
+ (minx + 0.027838071808218956, maxy - 0.031671565026044846, maxz - 0.029115368612110615),
+ (minx + 0.0372295081615448, maxy - 0.03166172280907631, maxz - 0.023164819926023483),
+ (minx + 0.04833790427073836, maxy - 0.03161429241299629, maxz - 0.022707123309373856),
+ (minx + 0.05818677507340908, maxy - 0.03154198080301285, maxz - 0.027864910662174225),
+ (minx + 0.06413711979985237, maxy - 0.031464170664548874, maxz - 0.037256159354001284),
+ (minx + 0.06459455192089081, maxy - 0.03140170872211456, minz + 0.038652234710752964),
+ (minx + 0.059436503797769547, maxy - 0.03137132152915001, minz + 0.028803281486034393),
+ (minx + 0.05004506651312113, maxy - 0.031381167471408844, minz + 0.022852730005979538),
+ (minx + 0.038936673663556576, maxy - 0.03142859786748886, minz + 0.022395022213459015),
+ (minx + 0.029038896784186363, maxy - 0.020622700452804565, minz + 0.027611978352069855),
+ (minx + 0.02308855764567852, maxy - 0.02070051059126854, minz + 0.0370032312348485),
+ (minx + 0.02263113297522068, maxy - 0.020762978121638298, maxz - 0.038905161898583174),
+ (minx + 0.02778918668627739, maxy - 0.020793357864022255, maxz - 0.029056214727461338),
+ (minx + 0.037180622573941946, maxy - 0.02078351564705372, maxz - 0.023105667904019356),
+ (minx + 0.04828901821747422, maxy - 0.020736083388328552, maxz - 0.02264796942472458),
+ (minx + 0.05813788715749979, maxy - 0.020663777366280556, maxz - 0.0278057549148798),
+ (minx + 0.0640882346779108, maxy - 0.020585965365171432, maxz - 0.03719700500369072),
+ (minx + 0.06454566307365894, maxy - 0.020523501560091972, minz + 0.0387113899923861),
+ (minx + 0.05938761495053768, maxy - 0.020493119955062866, minz + 0.028862436302006245),
+ (minx + 0.04999618045985699, maxy - 0.020502964034676552, minz + 0.022911883890628815),
+ (minx + 0.03888778714463115, maxy - 0.02055039070546627, minz + 0.02245417609810829),
+ (minx + 0.03133368864655495, maxy - 0.031504075974226, minz + 0.02999168261885643),
+ (minx + 0.02630186453461647, maxy - 0.03156987577676773, minz + 0.03793327230960131),
+ (minx + 0.025915050879120827, maxy - 0.03162270039319992, maxz - 0.039689837489277124),
+ (minx + 0.0302768861874938, maxy - 0.031648389995098114, maxz - 0.03136120364069939),
+ (minx + 0.03821863234043121, maxy - 0.03164006769657135, maxz - 0.026329202577471733),
+ (minx + 0.04761230247095227, maxy - 0.03159996122121811, maxz - 0.025942156091332436),
+ (minx + 0.05594087019562721, maxy - 0.03153881058096886, maxz - 0.030303767882287502),
+ (minx + 0.06097269989550114, maxy - 0.03147301450371742, maxz - 0.038245356641709805),
+ (minx + 0.06135952286422253, maxy - 0.03142019361257553, minz + 0.039377753622829914),
+ (minx + 0.05699768662452698, maxy - 0.03139450028538704, minz + 0.03104911558330059),
+ (minx + 0.049055942334234715, maxy - 0.0314028225839138, minz + 0.02601710893213749),
+ (minx + 0.03966227453202009, maxy - 0.031442929059267044, minz + 0.025630054995417595),
+ (minx + 0.024973656982183456, maxy - 0.009611732326447964, minz + 0.037668352015316486),
+ (minx + 0.030362362042069435, maxy - 0.009541265666484833, minz + 0.029163507744669914),
+ (minx + 0.02455940842628479, maxy - 0.009668299928307533, maxz - 0.03928851708769798),
+ (minx + 0.029230606742203236, maxy - 0.009695813991129398, maxz - 0.030369175598025322),
+ (minx + 0.03773562144488096, maxy - 0.009686900302767754, maxz - 0.02498028054833412),
+ (minx + 0.04779553506523371, maxy - 0.009643946774303913, maxz - 0.02456578239798546),
+ (minx + 0.056714802980422974, maxy - 0.009578464552760124, maxz - 0.02923674415796995),
+ (minx + 0.0621035173535347, maxy - 0.009507997892796993, maxz - 0.037741586565971375),
+ (minx + 0.06251777522265911, maxy - 0.009451429359614849, minz + 0.03921528346836567),
+ (minx + 0.05784657597541809, maxy - 0.009423915296792984, minz + 0.03029593825340271),
+ (minx + 0.0493415636010468, maxy - 0.009432828985154629, minz + 0.02490703947842121),
+ (minx + 0.039281651843339205, maxy - 0.009475781582295895, minz + 0.02449253387749195),
+ (minx + 0.03144440520554781, maxy - 0.02431209199130535, minz + 0.030186276882886887),
+ (minx + 0.02647113800048828, maxy - 0.0243771281093359, minz + 0.038035438396036625),
+ (minx + 0.026088828220963478, maxy - 0.024429334327578545, maxz - 0.03969699679873884),
+ (minx + 0.030399901792407036, maxy - 0.02445472590625286, maxz - 0.031465294770896435),
+ (minx + 0.0382492202334106, maxy - 0.024446498602628708, maxz - 0.026491858065128326),
+ (minx + 0.04753356333822012, maxy - 0.024406857788562775, maxz - 0.02610931731760502),
+ (minx + 0.05576520040631294, maxy - 0.024346424266695976, maxz - 0.03042016737163067),
+ (minx + 0.060738470405340195, maxy - 0.024281391873955727, maxz - 0.03826932841911912),
+ (minx + 0.06112079136073589, maxy - 0.024229183793067932, minz + 0.03946310793980956),
+ (minx + 0.056809717789292336, maxy - 0.024203790351748466, minz + 0.03123140148818493),
+ (minx + 0.04896040167659521, maxy - 0.02421201765537262, minz + 0.026257958263158798),
+ (minx + 0.03967605973593891, maxy - 0.024251656606793404, minz + 0.025875410065054893),
+ (minx + 0.03160235192626715, miny + 0.013056624680757523, minz + 0.02999513689428568),
+ (minx + 0.02662908472120762, miny + 0.012991588562726974, minz + 0.03784429794177413),
+ (minx + 0.026246773079037666, miny + 0.012939386069774628, maxz - 0.039888136787340045),
+ (minx + 0.030557849444448948, miny + 0.012913990765810013, maxz - 0.03165643382817507),
+ (minx + 0.03840716602280736, miny + 0.012922219932079315, maxz - 0.02668299712240696),
+ (minx + 0.04769151005893946, miny + 0.012961860746145248, maxz - 0.02630045637488365),
+ (minx + 0.05592314712703228, miny + 0.013022292405366898, maxz - 0.030611306428909302),
+ (minx + 0.06089641526341438, miny + 0.013087328523397446, maxz - 0.038460468873381615),
+ (minx + 0.06127873808145523, miny + 0.013139534741640091, minz + 0.03927196795120835),
+ (minx + 0.05696766451001167, miny + 0.013164930045604706, minz + 0.031040262430906296),
+ (minx + 0.04911834839731455, miny + 0.013156700879335403, minz + 0.026066819205880165),
+ (minx + 0.0398340062238276, miny + 0.013117063790559769, minz + 0.02568427100777626),
+ (minx + 0.03166038449853659, miny + 0.00014262646436691284, minz + 0.029924907721579075),
+ (minx + 0.026687119156122208, miny + 7.76052474975586e-05, minz + 0.0377740697003901),
+ (minx + 0.026304809376597404, miny + 2.5391578674316406e-05, maxz - 0.039958365727216005),
+ (minx + 0.030615881085395813, miny, maxz - 0.031726663932204247),
+ (minx + 0.0384651985950768, miny + 8.217990398406982e-06, maxz - 0.026753226295113564),
+ (minx + 0.0477495426312089, miny + 4.7869980335235596e-05, maxz - 0.026370685547590256),
+ (minx + 0.05598117969930172, miny + 0.00010830163955688477, maxz - 0.03068153653293848),
+ (minx + 0.06095444969832897, miny + 0.00017333775758743286, maxz - 0.038530697114765644),
+ (minx + 0.06133677065372467, miny + 0.0002255365252494812, minz + 0.039201739244163036),
+ (minx + 0.05702569708228111, miny + 0.00025093555450439453, minz + 0.030970032326877117),
+ (minx + 0.04917638096958399, miny + 0.00024271011352539062, minz + 0.02599659003317356),
+ (minx + 0.039892038563266397, miny + 0.00020306557416915894, minz + 0.025614041835069656),
+ (maxx - 0.012196376919746399, miny + 0.0031514912843704224, minz + 0.03689247788861394),
+ (maxx - 0.011049121618270874, miny + 0.0037728995084762573, minz + 0.04000293998979032),
+ (maxx - 0.010531991720199585, miny + 0.004111833870410919, maxz - 0.041690999176353216),
+ (maxx - 0.010783538222312927, miny + 0.0040774866938591, maxz - 0.035582118667662144),
+ (maxx - 0.011736378073692322, miny + 0.003679051995277405, maxz - 0.030324016697704792),
+ (maxx - 0.013135172426700592, miny + 0.003023289144039154, maxz - 0.027325598523020744),
+ (maxx - 0.013745412230491638, miny + 0.010863490402698517, minz + 0.03701266320422292),
+ (maxx - 0.012598156929016113, miny + 0.011484891176223755, minz + 0.0401231253053993),
+ (maxx - 0.012081027030944824, miny + 0.011823825538158417, maxz - 0.041570812463760376),
+ (maxx - 0.01233258843421936, miny + 0.011789467185735703, maxz - 0.035461933352053165),
+ (maxx - 0.013285413384437561, miny + 0.011391039937734604, maxz - 0.030203829519450665),
+ (maxx - 0.014684207737445831, miny + 0.010735277086496353, maxz - 0.027205411344766617),
+ (maxx - 0.000991135835647583, maxy - 0.01982143148779869, minz + 0.03712343191727996),
+ (maxx - 0.0034268200397491455, maxy - 0.018987802788615227, minz + 0.03702782467007637),
+ (maxx - 0.00027070939540863037, maxy - 0.018310068175196648, minz + 0.040221322793513536),
+ (maxx, maxy - 0.017457325011491776, maxz - 0.04147987486794591),
+ (maxx - 0.00025157630443573, maxy - 0.01749167963862419, maxz - 0.03537099435925484),
+ (maxx - 0.000957980751991272, maxy - 0.018403928726911545, maxz - 0.030105633661150932),
+ (maxx - 0.001929953694343567, maxy - 0.019949644804000854, maxz - 0.02709464356303215),
+ (maxx - 0.0043656229972839355, maxy - 0.01911601796746254, maxz - 0.027190251275897026),
+ (maxx - 0.002706393599510193, maxy - 0.01747644878923893, minz + 0.04012571508064866),
+ (maxx - 0.0024356693029403687, maxy - 0.01662370003759861, maxz - 0.04157548164948821),
+ (maxx - 0.0026872456073760986, maxy - 0.016658056527376175, maxz - 0.03546660114079714),
+ (maxx - 0.0033936500549316406, maxy - 0.017570307478308678, maxz - 0.030201241374015808),
+ (minx + 0.04382078559137881, miny + 0.00012543797492980957, minz + 0.04313003408606164)]
+
+ # Faces
+ myfaces = [(24, 0, 1), (24, 1, 2), (24, 2, 3), (24, 3, 4), (24, 4, 5),
+ (24, 5, 6), (24, 6, 7), (24, 7, 8), (24, 8, 9), (24, 9, 10),
+ (24, 10, 11), (11, 0, 24), (0, 12, 13, 1), (1, 13, 14, 2), (2, 14, 15, 3),
+ (3, 15, 16, 4), (4, 16, 17, 5), (5, 17, 18, 6), (6, 18, 19, 7), (7, 19, 20, 8),
+ (8, 20, 21, 9), (9, 21, 22, 10), (10, 22, 23, 11), (12, 0, 11, 23), (13, 12, 25, 26),
+ (14, 13, 26, 27), (15, 14, 27, 28), (16, 15, 28, 29), (17, 16, 29, 30), (18, 17, 30, 31),
+ (19, 18, 31, 32), (20, 19, 32, 33), (21, 20, 33, 34), (22, 21, 34, 35), (23, 22, 35, 36),
+ (12, 23, 36, 25), (25, 49, 50, 26), (49, 37, 38, 50), (26, 50, 51, 27), (50, 38, 39, 51),
+ (27, 51, 52, 28), (51, 39, 40, 52), (28, 52, 53, 29), (52, 40, 41, 53), (29, 53, 54, 30),
+ (53, 41, 42, 54), (30, 54, 55, 31), (54, 42, 43, 55), (31, 55, 56, 32), (55, 43, 44, 56),
+ (32, 56, 57, 33), (56, 44, 45, 57), (33, 57, 58, 34), (57, 45, 46, 58), (34, 58, 59, 35),
+ (58, 46, 47, 59), (35, 59, 60, 36), (59, 47, 48, 60), (36, 60, 49, 25), (60, 48, 37, 49),
+ (38, 37, 61, 62), (39, 38, 62, 63), (40, 39, 63, 64), (41, 40, 64, 65), (42, 41, 65, 66),
+ (43, 42, 66, 67), (44, 43, 67, 68), (45, 44, 68, 69), (46, 45, 69, 70), (47, 46, 70, 71),
+ (48, 47, 71, 72), (37, 48, 72, 61), (62, 61, 74, 73), (63, 62, 73, 75), (64, 63, 75, 76),
+ (65, 64, 76, 77), (66, 65, 77, 78), (67, 66, 78, 79), (68, 67, 79, 80), (69, 68, 80, 81),
+ (70, 69, 81, 82), (71, 70, 82, 83), (72, 71, 83, 84), (61, 72, 84, 74), (86, 85, 97, 98),
+ (87, 86, 98, 99), (88, 87, 99, 100), (89, 88, 100, 101), (90, 89, 101, 102), (91, 90, 102, 103),
+ (92, 91, 103, 104), (93, 92, 104, 105), (94, 93, 105, 106), (95, 94, 106, 107), (96, 95, 107, 108),
+ (97, 85, 96, 108), (98, 97, 109, 110), (99, 98, 110, 111), (100, 99, 111, 112), (101, 100, 112, 113),
+ (102, 101, 113, 114), (108, 107, 119, 120), (108, 120, 109, 97), (119, 107, 127, 121),
+ (118, 119, 121, 122),
+ (117, 118, 122, 123), (116, 117, 123, 124), (115, 116, 124, 125), (114, 115, 125, 126),
+ (102, 114, 126, 132),
+ (107, 106, 128, 127), (106, 105, 129, 128), (105, 104, 130, 129), (104, 103, 131, 130),
+ (103, 102, 132, 131),
+ (121, 127, 134, 133), (122, 121, 133, 135), (123, 122, 135, 136), (124, 123, 136, 137),
+ (125, 124, 137, 138),
+ (126, 125, 138, 139), (132, 126, 139, 140), (127, 128, 141, 134), (128, 129, 142, 141),
+ (129, 130, 143, 142),
+ (130, 131, 144, 143), (131, 132, 140, 144), (138, 144, 140, 139), (137, 143, 144, 138),
+ (136, 142, 143, 137),
+ (135, 141, 142, 136), (133, 134, 141, 135), (110, 109, 145), (111, 110, 145), (112, 111, 145),
+ (113, 112, 145), (114, 113, 145), (115, 114, 145), (116, 115, 145), (117, 116, 145),
+ (118, 117, 145), (119, 118, 145), (120, 119, 145), (109, 120, 145)]
+
+ return myvertex, myfaces
+
+
+# ----------------------------------------------
+# Handle model 02
+# ----------------------------------------------
+def handle_model_02():
+ # ------------------------------------
+ # Mesh data
+ # ------------------------------------
+ minx = -0.04349547624588013
+ maxx = 0.04352114722132683
+ miny = -0.08959200233221054
+ maxy = 0
+ minz = -0.04352371022105217
+ maxz = 0.04349301755428314
+
+ # Vertex
+ myvertex = [(minx + 0.013302795588970184, maxy - 0.002780601382255554, minz + 0.010707870125770569),
+ (minx + 0.0009496212005615234, maxy - 0.002942140679806471, minz + 0.030204588547348976),
+ (minx, maxy - 0.003071820829063654, maxz - 0.033750676549971104),
+ (minx + 0.010708402842283249, maxy - 0.0031348932534456253, maxz - 0.013303784653544426),
+ (minx + 0.03020550962537527, maxy - 0.003114458406344056, maxz - 0.0009501762688159943),
+ (maxx - 0.03374953381717205, maxy - 0.003015991533175111, maxz),
+ (maxx - 0.01330280676484108, maxy - 0.0028658765368163586, maxz - 0.010707847774028778),
+ (maxx - 0.0009496286511421204, maxy - 0.0027043374720960855, maxz - 0.030204561538994312),
+ (maxx, maxy - 0.0025746573228389025, minz + 0.03375071194022894),
+ (maxx - 0.010708380490541458, maxy - 0.002511584199965, minz + 0.013303810730576515),
+ (maxx - 0.03020548354834318, maxy - 0.0025320190470665693, minz + 0.0009501948952674866),
+ (minx + 0.03374955803155899, maxy - 0.0026304861530661583, minz),
+ (minx + 0.014472760260105133, maxy - 0.019589224830269814, minz + 0.011804874986410141),
+ (minx + 0.002567145973443985, maxy - 0.019744910299777985, minz + 0.030595174990594387),
+ (minx + 0.001651916652917862, maxy - 0.019869891926646233, maxz - 0.034195657819509506),
+ (minx + 0.011972300708293915, maxy - 0.019930677488446236, maxz - 0.014489583671092987),
+ (minx + 0.03076297417283058, maxy - 0.019910985603928566, maxz - 0.0025835558772087097),
+ (maxx - 0.034027633257210255, maxy - 0.019816085696220398, maxz - 0.0016677752137184143),
+ (maxx - 0.014321718364953995, maxy - 0.01967141032218933, maxz - 0.011987630277872086),
+ (maxx - 0.002416089177131653, maxy - 0.01951572299003601, maxz - 0.030777926556766033),
+ (maxx - 0.0015008561313152313, maxy - 0.019390743225812912, minz + 0.03401290811598301),
+ (maxx - 0.011821221560239792, maxy - 0.01932995393872261, minz + 0.014306826516985893),
+ (maxx - 0.03061189129948616, maxy - 0.01934964768588543, minz + 0.002400781959295273),
+ (minx + 0.03417872078716755, maxy - 0.019444547593593597, minz + 0.001484982669353485),
+ (minx + 0.043508310547622386, maxy - 0.005668943747878075, maxz - 0.043508357635801076),
+ (minx + 0.029034355655312538, maxy - 0.019612153992056847, minz + 0.027617475017905235),
+ (minx + 0.023084014654159546, maxy - 0.01968996599316597, minz + 0.03700872650370002),
+ (minx + 0.022626593708992004, maxy - 0.01975242979824543, maxz - 0.03889966616407037),
+ (minx + 0.027784643694758415, maxy - 0.019782811403274536, maxz - 0.029050718992948532),
+ (minx + 0.03717608004808426, maxy - 0.019772969186306, maxz - 0.023100173100829124),
+ (maxx - 0.03873214777559042, maxy - 0.019725536927580833, maxz - 0.022642474621534348),
+ (maxx - 0.02888327743858099, maxy - 0.019653232768177986, maxz - 0.02780025824904442),
+ (maxx - 0.022932931780815125, maxy - 0.019575420767068863, maxz - 0.0371915097348392),
+ (maxx - 0.022475499659776688, maxy - 0.019512956961989403, minz + 0.03871688432991505),
+ (maxx - 0.0276335496455431, maxy - 0.019482573494315147, minz + 0.02886793203651905),
+ (maxx - 0.03702498506754637, maxy - 0.019492419436573982, minz + 0.022917380556464195),
+ (minx + 0.038883245550096035, maxy - 0.0195398461073637, minz + 0.022459672763943672),
+ (minx + 0.029087782837450504, maxy - 0.03150090575218201, minz + 0.027552824467420578),
+ (minx + 0.023137442767620087, maxy - 0.03157871589064598, minz + 0.036944076884537935),
+ (minx + 0.022680018097162247, maxy - 0.03164118155837059, maxz - 0.03896431624889374),
+ (minx + 0.027838071808218956, maxy - 0.031671565026044846, maxz - 0.029115368612110615),
+ (minx + 0.0372295081615448, maxy - 0.03166172280907631, maxz - 0.023164819926023483),
+ (maxx - 0.03867871919646859, maxy - 0.03161429241299629, maxz - 0.022707123309373856),
+ (maxx - 0.028829848393797874, maxy - 0.03154198080301285, maxz - 0.027864910662174225),
+ (maxx - 0.022879503667354584, maxy - 0.031464170664548874, maxz - 0.037256159354001284),
+ (maxx - 0.022422071546316147, maxy - 0.03140170872211456, minz + 0.038652234710752964),
+ (maxx - 0.02758011966943741, maxy - 0.03137132152915001, minz + 0.028803281486034393),
+ (maxx - 0.03697155695408583, maxy - 0.031381167471408844, minz + 0.022852730005979538),
+ (minx + 0.038936673663556576, maxy - 0.03142859786748886, minz + 0.022395022213459015),
+ (minx + 0.029038896784186363, maxy - 0.020622700452804565, minz + 0.027611978352069855),
+ (minx + 0.02308855764567852, maxy - 0.02070051059126854, minz + 0.0370032312348485),
+ (minx + 0.02263113297522068, maxy - 0.020762978121638298, maxz - 0.038905161898583174),
+ (minx + 0.02778918668627739, maxy - 0.020793357864022255, maxz - 0.029056214727461338),
+ (minx + 0.037180622573941946, maxy - 0.02078351564705372, maxz - 0.023105667904019356),
+ (maxx - 0.03872760524973273, maxy - 0.020736083388328552, maxz - 0.02264796942472458),
+ (maxx - 0.028878736309707165, maxy - 0.020663777366280556, maxz - 0.0278057549148798),
+ (maxx - 0.02292838878929615, maxy - 0.020585965365171432, maxz - 0.03719700500369072),
+ (maxx - 0.022470960393548012, maxy - 0.020523501560091972, minz + 0.0387113899923861),
+ (maxx - 0.027629008516669273, maxy - 0.020493119955062866, minz + 0.028862436302006245),
+ (maxx - 0.03702044300734997, maxy - 0.020502964034676552, minz + 0.022911883890628815),
+ (minx + 0.03888778714463115, maxy - 0.02055039070546627, minz + 0.02245417609810829),
+ (minx + 0.03503026906400919, maxy - 0.0326739065349102, minz + 0.03399384953081608),
+ (minx + 0.03150810860097408, maxy - 0.032719966024160385, minz + 0.03955277753993869),
+ (minx + 0.03123734798282385, maxy - 0.03275693953037262, maxz - 0.04088863683864474),
+ (minx + 0.034290531650185585, maxy - 0.032774921506643295, maxz - 0.035058788023889065),
+ (minx + 0.039849569322541356, maxy - 0.0327690951526165, maxz - 0.03153650462627411),
+ (maxx - 0.04059170465916395, maxy - 0.03274102136492729, maxz - 0.03126558102667332),
+ (maxx - 0.03476190101355314, maxy - 0.032698217779397964, maxz - 0.03431860730051994),
+ (maxx - 0.031239738687872887, maxy - 0.03265216201543808, maxz - 0.039877534145489335),
+ (maxx - 0.03096897155046463, maxy - 0.032615188509225845, minz + 0.040563880698755383),
+ (maxx - 0.03402215428650379, maxy - 0.03259720280766487, minz + 0.03473402839154005),
+ (maxx - 0.03958118986338377, maxy - 0.032603029161691666, minz + 0.03121174033731222),
+ (minx + 0.04086008481681347, maxy - 0.032631102949380875, minz + 0.030940811149775982),
+ (minx + 0.026877090334892273, maxy - 0.04475956782698631, minz + 0.02504805289208889),
+ (minx + 0.020004114136099815, miny + 0.044742558151483536, minz + 0.03589546587318182),
+ (minx + 0.019475765526294708, miny + 0.044670410454273224, maxz - 0.03829052206128836),
+ (minx + 0.025433603674173355, miny + 0.04463531821966171, maxz - 0.0269144456833601),
+ (minx + 0.03628123179078102, miny + 0.04464668035507202, maxz - 0.020041238516569138),
+ (maxx - 0.0379045819863677, miny + 0.0447014644742012, maxz - 0.01951257325708866),
+ (maxx - 0.02652859501540661, miny + 0.044784992933273315, maxz - 0.02547009475529194),
+ (maxx - 0.01965562254190445, maxy - 0.04471714794635773, maxz - 0.036317508202046156),
+ (maxx - 0.019127257168293, maxy - 0.04464499279856682, minz + 0.03786848206073046),
+ (maxx - 0.02508508786559105, maxy - 0.04460989683866501, minz + 0.026492400094866753),
+ (maxx - 0.03593271458521485, maxy - 0.044621266424655914, minz + 0.019619181752204895),
+ (minx + 0.03825310105457902, maxy - 0.044676050543785095, minz + 0.01909050904214382),
+ (minx + 0.01721818558871746, miny + 0.00031135231256484985, minz + 0.01437518559396267),
+ (minx + 0.006362196058034897, miny + 0.00016936659812927246, minz + 0.03150887507945299),
+ (minx + 0.005527656525373459, miny + 5.542486906051636e-05, maxz - 0.03524145483970642),
+ (minx + 0.014938175678253174, miny, maxz - 0.017272725701332092),
+ (minx + 0.032072206027805805, miny + 1.7955899238586426e-05, maxz - 0.006416358053684235),
+ (maxx - 0.03467791061848402, miny + 0.00010447949171066284, maxz - 0.0055813267827034),
+ (maxx - 0.016709323972463608, miny + 0.00023641437292099, maxz - 0.01499134860932827),
+ (maxx - 0.005853328853845596, miny + 0.00037835538387298584, maxz - 0.032125042751431465),
+ (maxx - 0.0050187669694423676, miny + 0.0004923418164253235, minz + 0.03462529182434082),
+ (maxx - 0.014429278671741486, miny + 0.0005477666854858398, minz + 0.016656557098031044),
+ (maxx - 0.03156330715864897, miny + 0.0005298107862472534, minz + 0.005800176411867142),
+ (minx + 0.03518681041896343, miny + 0.000443287193775177, minz + 0.0049651265144348145),
+ (minx + 0.02942624967545271, miny + 0.0012636110186576843, minz + 0.027632080018520355),
+ (minx + 0.023563016206026077, miny + 0.0011869296431541443, minz + 0.03688584640622139),
+ (minx + 0.023112289607524872, miny + 0.0011253878474235535, maxz - 0.039185164496302605),
+ (minx + 0.028194833546876907, miny + 0.0010954588651657104, maxz - 0.029480399563908577),
+ (minx + 0.037448784336447716, miny + 0.0011051595211029053, maxz - 0.023616963997483253),
+ (maxx - 0.038622063118964434, miny + 0.0011518821120262146, maxz - 0.023165971040725708),
+ (maxx - 0.028917375952005386, miny + 0.001223146915435791, maxz - 0.02824824769049883),
+ (maxx - 0.02305414155125618, miny + 0.0012998059391975403, maxz - 0.0375020164065063),
+ (maxx - 0.02260340191423893, miny + 0.0013613700866699219, minz + 0.03856899822130799),
+ (maxx - 0.027685942128300667, miny + 0.001391299068927765, minz + 0.028864230029284954),
+ (maxx - 0.0369398919865489, miny + 0.001381605863571167, minz + 0.023000789806246758),
+ (minx + 0.03913095686584711, miny + 0.0013348758220672607, minz + 0.022549785673618317),
+ (minx + 0.03738117218017578, miny + 0.0037613436579704285, minz + 0.03627043403685093),
+ (minx + 0.03477128129452467, miny + 0.0037272050976753235, minz + 0.04038954642601311),
+ (minx + 0.034570650197565556, miny + 0.0036998093128204346, maxz - 0.041754934238269925),
+ (minx + 0.03683303436264396, miny + 0.0036864876747131348, maxz - 0.03743506921455264),
+ (minx + 0.040952228708192706, miny + 0.0036908015608787537, maxz - 0.03482509031891823),
+ (maxx - 0.0411921211052686, miny + 0.003711603581905365, maxz - 0.03462434001266956),
+ (maxx - 0.03687229100614786, miny + 0.0037433207035064697, maxz - 0.03688660357147455),
+ (maxx - 0.034262401051819324, miny + 0.003777444362640381, maxz - 0.04100571759045124),
+ (maxx - 0.03406176343560219, miny + 0.0038048475980758667, minz + 0.0411387647036463),
+ (maxx - 0.036324144806712866, miny + 0.0038181766867637634, minz + 0.03681889921426773),
+ (maxx - 0.04044333938509226, miny + 0.0038138628005981445, minz + 0.03420891519635916),
+ (minx + 0.04170101135969162, miny + 0.003793060779571533, minz + 0.034008161164820194),
+ (maxx - 0.043253868410829455, miny + 0.00480072945356369, minz + 0.04320027763606049),
+ (minx + 0.03971285093575716, maxy - 0.041327137500047684, maxz - 0.031046375632286072),
+ (maxx - 0.03359287604689598, maxy - 0.04114784672856331, minz + 0.03433086443692446),
+ (minx + 0.03072980046272278, maxy - 0.04131445661187172, maxz - 0.040801193099468946),
+ (minx + 0.031012218445539474, maxy - 0.04127589240670204, minz + 0.03935709968209267),
+ (minx + 0.04076687735505402, maxy - 0.04118320718407631, minz + 0.030374319292604923),
+ (minx + 0.034451283514499664, maxy - 0.03338594362139702, minz + 0.033365121111273766),
+ (minx + 0.030692334286868572, maxy - 0.03343509882688522, minz + 0.039297766517847776),
+ (minx + 0.03040337096899748, maxy - 0.03347455710172653, maxz - 0.040701600490137935),
+ (minx + 0.03366181440651417, maxy - 0.03349374979734421, maxz - 0.03447982110083103),
+ (minx + 0.03959457715973258, maxy - 0.033487528562545776, maxz - 0.03072074055671692),
+ (maxx - 0.040404647355899215, maxy - 0.033457569777965546, maxz - 0.030431604012846947),
+ (maxx - 0.03418291546404362, maxy - 0.03341188654303551, maxz - 0.03368987888097763),
+ (maxx - 0.030423964373767376, maxy - 0.0333627350628376, maxz - 0.03962252289056778),
+ (maxx - 0.030134993605315685, maxy - 0.03332327678799629, minz + 0.04037684458307922),
+ (maxx - 0.033393437042832375, maxy - 0.03330408036708832, minz + 0.03415506146848202),
+ (maxx - 0.03932619746774435, maxy - 0.03331030160188675, minz + 0.030395975336432457),
+ (minx + 0.040673027746379375, maxy - 0.03334026038646698, minz + 0.030106833204627037),
+ (minx + 0.030282274819910526, maxy - 0.005427400581538677, maxz - 0.0011750981211662292),
+ (minx + 0.013463903218507767, maxy - 0.005095209460705519, minz + 0.0108589306473732),
+ (minx + 0.010882444679737091, maxy - 0.005447734147310257, maxz - 0.013467073440551758),
+ (minx + 0.0011723600327968597, maxy - 0.005255943164229393, minz + 0.030258373357355595),
+ (minx + 0.0002274736762046814, maxy - 0.005384976044297218, maxz - 0.033811951987445354),
+ (maxx - 0.0134431142359972, maxy - 0.005180059932172298, maxz - 0.010884080082178116),
+ (maxx - 0.033787828870117664, maxy - 0.005329424981027842, maxz - 0.00022966042160987854),
+ (maxx - 0.0302614476531744, maxy - 0.004847868345677853, minz + 0.0011499449610710144),
+ (maxx - 0.00020667165517807007, maxy - 0.004890293348580599, minz + 0.03378681745380163),
+ (maxx - 0.0011515654623508453, maxy - 0.0050193266943097115, maxz - 0.03028351627290249),
+ (minx + 0.033808655105531216, maxy - 0.004945843946188688, minz + 0.0002044886350631714),
+ (maxx - 0.010861624032258987, maxy - 0.004827534779906273, minz + 0.013441929593682289),
+ (minx + 0.03468604106456041, maxy - 0.04122784733772278, minz + 0.033558815717697144),
+ (minx + 0.033914451487362385, maxy - 0.041333213448524475, maxz - 0.03472032118588686),
+ (maxx - 0.04044530005194247, maxy - 0.04129785671830177, maxz - 0.03076378908008337),
+ (maxx - 0.034364476799964905, maxy - 0.04125320911407471, maxz - 0.03394827153533697),
+ (maxx - 0.03069065511226654, maxy - 0.04120517522096634, maxz - 0.03974655526690185),
+ (maxx - 0.030408228747546673, maxy - 0.04116660729050636, minz + 0.04041173937730491),
+ (maxx - 0.03939127502962947, maxy - 0.0411539226770401, minz + 0.030656912364065647),
+ (minx + 0.03147818427532911, maxy - 0.033236272633075714, minz + 0.03954096930101514),
+ (minx + 0.031206720508635044, maxy - 0.03327333927154541, maxz - 0.04088335996493697),
+ (minx + 0.034267837181687355, maxy - 0.033291369676589966, maxz - 0.03503836318850517),
+ (minx + 0.03984131896868348, maxy - 0.03328552842140198, maxz - 0.03150692768394947),
+ (maxx - 0.040582869900390506, maxy - 0.0332573801279068, maxz - 0.03123530000448227),
+ (maxx - 0.03473791852593422, maxy - 0.033214468508958817, maxz - 0.03429625928401947),
+ (maxx - 0.031206604093313217, maxy - 0.03316829353570938, maxz - 0.03986963024362922),
+ (maxx - 0.030935133807361126, maxy - 0.03313122317194939, minz + 0.040554699720814824),
+ (maxx - 0.03399624954909086, maxy - 0.03311318904161453, minz + 0.03470969945192337),
+ (maxx - 0.03956972947344184, maxy - 0.03311903029680252, minz + 0.031178259290754795),
+ (minx + 0.04085446032695472, maxy - 0.0331471785902977, minz + 0.030906626023352146),
+ (minx + 0.035009496845304966, maxy - 0.03319009393453598, minz + 0.03396759741008282)]
+
+ # Faces
+ myfaces = [(24, 0, 1), (24, 1, 2), (24, 2, 3), (24, 3, 4), (24, 4, 5),
+ (24, 5, 6), (24, 6, 7), (24, 7, 8), (24, 8, 9), (24, 9, 10),
+ (24, 10, 11), (11, 0, 24), (140, 12, 13, 142), (142, 13, 14, 143), (143, 14, 15, 141),
+ (141, 15, 16, 139), (139, 16, 17, 145), (145, 17, 18, 144), (144, 18, 19, 148), (148, 19, 20, 147),
+ (147, 20, 21, 150), (150, 21, 22, 146), (146, 22, 23, 149), (140, 0, 11, 149), (13, 12, 25, 26),
+ (14, 13, 26, 27), (15, 14, 27, 28), (16, 15, 28, 29), (17, 16, 29, 30), (18, 17, 30, 31),
+ (19, 18, 31, 32), (20, 19, 32, 33), (21, 20, 33, 34), (22, 21, 34, 35), (23, 22, 35, 36),
+ (12, 23, 36, 25), (25, 49, 50, 26), (49, 37, 38, 50), (26, 50, 51, 27), (50, 38, 39, 51),
+ (27, 51, 52, 28), (51, 39, 40, 52), (28, 52, 53, 29), (52, 40, 41, 53), (29, 53, 54, 30),
+ (53, 41, 42, 54), (30, 54, 55, 31), (54, 42, 43, 55), (31, 55, 56, 32), (55, 43, 44, 56),
+ (32, 56, 57, 33), (56, 44, 45, 57), (33, 57, 58, 34), (57, 45, 46, 58), (34, 58, 59, 35),
+ (58, 46, 47, 59), (35, 59, 60, 36), (59, 47, 48, 60), (36, 60, 49, 25), (60, 48, 37, 49),
+ (38, 37, 61, 62), (39, 38, 62, 63), (40, 39, 63, 64), (41, 40, 64, 65), (42, 41, 65, 66),
+ (43, 42, 66, 67), (44, 43, 67, 68), (45, 44, 68, 69), (46, 45, 69, 70), (47, 46, 70, 71),
+ (48, 47, 71, 72), (37, 48, 72, 61), (124, 125, 74, 75), (74, 73, 85, 86), (79, 78, 90, 91),
+ (80, 79, 91, 92), (77, 76, 88, 89), (82, 81, 93, 94), (76, 75, 87, 88), (81, 80, 92, 93),
+ (73, 84, 96, 85), (84, 83, 95, 96), (83, 82, 94, 95), (78, 77, 89, 90), (75, 74, 86, 87),
+ (90, 89, 101, 102), (86, 85, 97, 98), (93, 92, 104, 105), (96, 95, 107, 108), (85, 96, 108, 97),
+ (89, 88, 100, 101), (91, 90, 102, 103), (88, 87, 99, 100), (92, 91, 103, 104), (95, 94, 106, 107),
+ (94, 93, 105, 106), (87, 86, 98, 99), (105, 104, 116, 117), (108, 107, 119, 120), (97, 108, 120, 109),
+ (101, 100, 112, 113), (103, 102, 114, 115), (100, 99, 111, 112), (104, 103, 115, 116),
+ (107, 106, 118, 119),
+ (106, 105, 117, 118), (99, 98, 110, 111), (102, 101, 113, 114), (98, 97, 109, 110), (120, 119, 121),
+ (109, 120, 121), (113, 112, 121), (115, 114, 121), (112, 111, 121), (116, 115, 121),
+ (119, 118, 121), (118, 117, 121), (111, 110, 121), (114, 113, 121), (110, 109, 121),
+ (117, 116, 121), (169, 158, 62, 61), (158, 159, 63, 62), (159, 160, 64, 63), (160, 161, 65, 64),
+ (161, 162, 66, 65), (162, 163, 67, 66), (163, 164, 68, 67), (164, 165, 69, 68), (165, 166, 70, 69),
+ (166, 167, 71, 70), (167, 168, 72, 71), (168, 169, 61, 72), (72, 138, 127, 61), (63, 129, 130, 64),
+ (67, 133, 134, 68), (64, 130, 131, 65), (61, 127, 128, 62), (69, 135, 136, 70), (66, 132, 133, 67),
+ (65, 131, 132, 66), (71, 137, 138, 72), (70, 136, 137, 71), (62, 128, 129, 63), (68, 134, 135, 69),
+ (0, 140, 142, 1), (1, 142, 143, 2), (2, 143, 141, 3), (3, 141, 139, 4), (4, 139, 145, 5),
+ (5, 145, 144, 6), (6, 144, 148, 7), (7, 148, 147, 8), (8, 147, 150, 9), (9, 150, 146, 10),
+ (10, 146, 149, 11), (12, 140, 149, 23), (153, 154, 163, 162), (154, 155, 164, 163), (155, 156, 165, 164),
+ (125, 151, 73, 74), (152, 124, 75, 76), (122, 152, 76, 77), (153, 122, 77, 78), (154, 153, 78, 79),
+ (155, 154, 79, 80), (156, 155, 80, 81), (123, 156, 81, 82), (157, 123, 82, 83), (126, 157, 83, 84),
+ (73, 151, 126, 84), (151, 125, 158, 169), (125, 124, 159, 158), (124, 152, 160, 159),
+ (152, 122, 161, 160),
+ (122, 153, 162, 161), (156, 123, 166, 165), (123, 157, 167, 166), (157, 126, 168, 167),
+ (126, 151, 169, 168)]
+
+ return myvertex, myfaces
+
+
+# ----------------------------------------------
+# Handle model 03
+# ----------------------------------------------
+def handle_model_03():
+ # ------------------------------------
+ # Mesh data
+ # ------------------------------------
+ minx = -0.04349547624588013
+ maxx = 0.04352114722132683
+ miny = -0.09871400892734528
+ maxy = 0
+ minz = -0.04352371022105217
+ maxz = 0.04349301755428314
+
+ # Vertex
+ myvertex = [(minx + 0.013302795588970184, maxy - 0.002780601382255554, minz + 0.010707870125770569),
+ (minx + 0.0009496212005615234, maxy - 0.002942140679806471, minz + 0.030204588547348976),
+ (minx, maxy - 0.003071820829063654, maxz - 0.033750676549971104),
+ (minx + 0.010708402842283249, maxy - 0.0031348932534456253, maxz - 0.013303784653544426),
+ (minx + 0.03020550962537527, maxy - 0.003114458406344056, maxz - 0.0009501762688159943),
+ (maxx - 0.03374953381717205, maxy - 0.003015991533175111, maxz),
+ (maxx - 0.01330280676484108, maxy - 0.0028658765368163586, maxz - 0.010707847774028778),
+ (maxx - 0.0009496286511421204, maxy - 0.0027043374720960855, maxz - 0.030204561538994312),
+ (maxx, maxy - 0.0025746573228389025, minz + 0.03375071194022894),
+ (maxx - 0.010708380490541458, maxy - 0.002511584199965, minz + 0.013303810730576515),
+ (maxx - 0.03020548354834318, maxy - 0.0025320190470665693, minz + 0.0009501948952674866),
+ (minx + 0.03374955803155899, maxy - 0.0026304861530661583, minz),
+ (minx + 0.014472760260105133, maxy - 0.019589224830269814, minz + 0.011804874986410141),
+ (minx + 0.002567145973443985, maxy - 0.019744910299777985, minz + 0.030595174990594387),
+ (minx + 0.001651916652917862, maxy - 0.019869891926646233, maxz - 0.034195657819509506),
+ (minx + 0.011972300708293915, maxy - 0.019930677488446236, maxz - 0.014489583671092987),
+ (minx + 0.03076297417283058, maxy - 0.019910985603928566, maxz - 0.0025835558772087097),
+ (maxx - 0.034027633257210255, maxy - 0.019816085696220398, maxz - 0.0016677752137184143),
+ (maxx - 0.014321718364953995, maxy - 0.01967141032218933, maxz - 0.011987630277872086),
+ (maxx - 0.002416089177131653, maxy - 0.01951572299003601, maxz - 0.030777926556766033),
+ (maxx - 0.0015008561313152313, maxy - 0.019390743225812912, minz + 0.03401290811598301),
+ (maxx - 0.011821221560239792, maxy - 0.01932995393872261, minz + 0.014306826516985893),
+ (maxx - 0.03061189129948616, maxy - 0.01934964768588543, minz + 0.002400781959295273),
+ (minx + 0.03417872078716755, maxy - 0.019444547593593597, minz + 0.001484982669353485),
+ (minx + 0.043508310547622386, maxy - 0.005668943747878075, maxz - 0.043508357635801076),
+ (minx + 0.029034355655312538, maxy - 0.019612153992056847, minz + 0.027617475017905235),
+ (minx + 0.023084014654159546, maxy - 0.01968996599316597, minz + 0.03700872650370002),
+ (minx + 0.022626593708992004, maxy - 0.01975242979824543, maxz - 0.03889966616407037),
+ (minx + 0.027784643694758415, maxy - 0.019782811403274536, maxz - 0.029050718992948532),
+ (minx + 0.03717608004808426, maxy - 0.019772969186306, maxz - 0.023100173100829124),
+ (maxx - 0.03873214777559042, maxy - 0.019725536927580833, maxz - 0.022642474621534348),
+ (maxx - 0.02888327743858099, maxy - 0.019653232768177986, maxz - 0.02780025824904442),
+ (maxx - 0.022932931780815125, maxy - 0.019575420767068863, maxz - 0.0371915097348392),
+ (maxx - 0.022475499659776688, maxy - 0.019512956961989403, minz + 0.03871688432991505),
+ (maxx - 0.0276335496455431, maxy - 0.019482573494315147, minz + 0.02886793203651905),
+ (maxx - 0.03702498506754637, maxy - 0.019492419436573982, minz + 0.022917380556464195),
+ (minx + 0.038883245550096035, maxy - 0.0195398461073637, minz + 0.022459672763943672),
+ (minx + 0.029087782837450504, maxy - 0.03150090575218201, minz + 0.027552824467420578),
+ (minx + 0.023137442767620087, maxy - 0.03157871589064598, minz + 0.036944076884537935),
+ (minx + 0.022680018097162247, maxy - 0.03164118155837059, maxz - 0.03896431624889374),
+ (minx + 0.027838071808218956, maxy - 0.031671565026044846, maxz - 0.029115368612110615),
+ (minx + 0.0372295081615448, maxy - 0.03166172280907631, maxz - 0.023164819926023483),
+ (maxx - 0.03867871919646859, maxy - 0.03161429241299629, maxz - 0.022707123309373856),
+ (maxx - 0.028829848393797874, maxy - 0.03154198080301285, maxz - 0.027864910662174225),
+ (maxx - 0.022879503667354584, maxy - 0.031464170664548874, maxz - 0.037256159354001284),
+ (maxx - 0.022422071546316147, maxy - 0.03140170872211456, minz + 0.038652234710752964),
+ (maxx - 0.02758011966943741, maxy - 0.03137132152915001, minz + 0.028803281486034393),
+ (maxx - 0.03697155695408583, maxy - 0.031381167471408844, minz + 0.022852730005979538),
+ (minx + 0.038936673663556576, maxy - 0.03142859786748886, minz + 0.022395022213459015),
+ (minx + 0.029038896784186363, maxy - 0.020622700452804565, minz + 0.027611978352069855),
+ (minx + 0.02308855764567852, maxy - 0.02070051059126854, minz + 0.0370032312348485),
+ (minx + 0.02263113297522068, maxy - 0.020762978121638298, maxz - 0.038905161898583174),
+ (minx + 0.02778918668627739, maxy - 0.020793357864022255, maxz - 0.029056214727461338),
+ (minx + 0.037180622573941946, maxy - 0.02078351564705372, maxz - 0.023105667904019356),
+ (maxx - 0.03872760524973273, maxy - 0.020736083388328552, maxz - 0.02264796942472458),
+ (maxx - 0.028878736309707165, maxy - 0.020663777366280556, maxz - 0.0278057549148798),
+ (maxx - 0.02292838878929615, maxy - 0.020585965365171432, maxz - 0.03719700500369072),
+ (maxx - 0.022470960393548012, maxy - 0.020523501560091972, minz + 0.0387113899923861),
+ (maxx - 0.027629008516669273, maxy - 0.020493119955062866, minz + 0.028862436302006245),
+ (maxx - 0.03702044300734997, maxy - 0.020502964034676552, minz + 0.022911883890628815),
+ (minx + 0.03888778714463115, maxy - 0.02055039070546627, minz + 0.02245417609810829),
+ (minx + 0.03503026906400919, maxy - 0.0326739065349102, minz + 0.03399384953081608),
+ (minx + 0.03150810860097408, maxy - 0.032719966024160385, minz + 0.03955277753993869),
+ (minx + 0.03123734798282385, maxy - 0.03275693953037262, maxz - 0.04088863683864474),
+ (minx + 0.034290531650185585, maxy - 0.032774921506643295, maxz - 0.035058788023889065),
+ (minx + 0.039849569322541356, maxy - 0.0327690951526165, maxz - 0.03153650462627411),
+ (maxx - 0.04059170465916395, maxy - 0.03274102136492729, maxz - 0.03126558102667332),
+ (maxx - 0.03476190101355314, maxy - 0.032698217779397964, maxz - 0.03431860730051994),
+ (maxx - 0.031239738687872887, maxy - 0.03265216201543808, maxz - 0.039877534145489335),
+ (maxx - 0.03096897155046463, maxy - 0.032615188509225845, minz + 0.040563880698755383),
+ (maxx - 0.03402215428650379, maxy - 0.03259720280766487, minz + 0.03473402839154005),
+ (maxx - 0.03958118986338377, maxy - 0.032603029161691666, minz + 0.03121174033731222),
+ (minx + 0.04086008481681347, maxy - 0.032631102949380875, minz + 0.030940811149775982),
+ (minx + 0.026877090334892273, maxy - 0.04475956782698631, minz + 0.02504805289208889),
+ (minx + 0.020004114136099815, maxy - 0.044849444180727005, minz + 0.03589546587318182),
+ (minx + 0.019475765526294708, maxy - 0.04492159187793732, maxz - 0.03829052206128836),
+ (minx + 0.025433603674173355, maxy - 0.04495668411254883, maxz - 0.0269144456833601),
+ (minx + 0.03628123179078102, maxy - 0.04494532197713852, maxz - 0.020041238516569138),
+ (maxx - 0.0379045819863677, maxy - 0.04489053785800934, maxz - 0.01951257325708866),
+ (maxx - 0.02652859501540661, maxy - 0.044807009398937225, maxz - 0.02547009475529194),
+ (maxx - 0.01965562254190445, maxy - 0.04471714794635773, maxz - 0.036317508202046156),
+ (maxx - 0.019127257168293, maxy - 0.04464499279856682, minz + 0.03786848206073046),
+ (maxx - 0.02508508786559105, maxy - 0.04460989683866501, minz + 0.026492400094866753),
+ (maxx - 0.03593271458521485, maxy - 0.044621266424655914, minz + 0.019619181752204895),
+ (minx + 0.03825310105457902, maxy - 0.044676050543785095, minz + 0.01909050904214382),
+ (minx + 0.021551070734858513, miny + 0.00942724198102951, minz + 0.01908031851053238),
+ (minx + 0.01246710866689682, miny + 0.009308435022830963, minz + 0.03341726865619421),
+ (minx + 0.011768791824579239, miny + 0.009213089942932129, maxz - 0.03664115583524108),
+ (minx + 0.019643226638436317, miny + 0.009166710078716278, maxz - 0.0216054730117321),
+ (minx + 0.033980460837483406, miny + 0.009181737899780273, maxz - 0.012521196156740189),
+ (maxx - 0.036077769473195076, miny + 0.009254135191440582, maxz - 0.011822465807199478),
+ (maxx - 0.021042203530669212, miny + 0.0093645378947258, maxz - 0.019696485251188278),
+ (maxx - 0.011958237737417221, miny + 0.009483307600021362, maxz - 0.03403343725949526),
+ (maxx - 0.011259902268648148, miny + 0.009578689932823181, minz + 0.03602499142289162),
+ (maxx - 0.01913433149456978, miny + 0.009625062346458435, minz + 0.020989302545785904),
+ (maxx - 0.03347156383097172, miny + 0.009610041975975037, minz + 0.011905014514923096),
+ (minx + 0.03658666601404548, miny + 0.00953763723373413, minz + 0.011206269264221191),
+ (minx + 0.02942624967545271, miny + 0.001430809497833252, minz + 0.027632080018520355),
+ (minx + 0.023563016206026077, miny + 0.001354128122329712, minz + 0.03688584640622139),
+ (minx + 0.023112289607524872, miny + 0.001292586326599121, maxz - 0.039185164496302605),
+ (minx + 0.028194833546876907, miny + 0.001262657344341278, maxz - 0.029480399563908577),
+ (minx + 0.037448784336447716, miny + 0.001272358000278473, maxz - 0.023616963997483253),
+ (maxx - 0.038622063118964434, miny + 0.0013190805912017822, maxz - 0.023165971040725708),
+ (maxx - 0.028917375952005386, miny + 0.0013903453946113586, maxz - 0.02824824769049883),
+ (maxx - 0.02305414155125618, miny + 0.001467004418373108, maxz - 0.0375020164065063),
+ (maxx - 0.02260340191423893, miny + 0.0015285685658454895, minz + 0.03856899822130799),
+ (maxx - 0.027685942128300667, miny + 0.0015584975481033325, minz + 0.028864230029284954),
+ (maxx - 0.0369398919865489, miny + 0.0015488043427467346, minz + 0.023000789806246758),
+ (minx + 0.03913095686584711, miny + 0.0015020743012428284, minz + 0.022549785673618317),
+ (minx + 0.03738117218017578, miny + 0.001003175973892212, minz + 0.03627043403685093),
+ (minx + 0.03477128129452467, miny + 0.0009690374135971069, minz + 0.04038954642601311),
+ (minx + 0.034570650197565556, miny + 0.000941641628742218, maxz - 0.041754934238269925),
+ (minx + 0.03683303436264396, miny + 0.0009283199906349182, maxz - 0.03743506921455264),
+ (minx + 0.040952228708192706, miny + 0.0009326338768005371, maxz - 0.03482509031891823),
+ (maxx - 0.0411921211052686, miny + 0.0009534358978271484, maxz - 0.03462434001266956),
+ (maxx - 0.03687229100614786, miny + 0.0009851530194282532, maxz - 0.03688660357147455),
+ (maxx - 0.034262401051819324, miny + 0.0010192766785621643, maxz - 0.04100571759045124),
+ (maxx - 0.03406176343560219, miny + 0.0010466799139976501, minz + 0.0411387647036463),
+ (maxx - 0.036324144806712866, miny + 0.0010600090026855469, minz + 0.03681889921426773),
+ (maxx - 0.04044333938509226, miny + 0.001055695116519928, minz + 0.03420891519635916),
+ (minx + 0.04170101135969162, miny + 0.0010348930954933167, minz + 0.034008161164820194),
+ (maxx - 0.043253868410829455, miny, minz + 0.04320027763606049),
+ (minx + 0.03971285093575716, maxy - 0.041327137500047684, maxz - 0.031046375632286072),
+ (maxx - 0.03359287604689598, maxy - 0.04114784672856331, minz + 0.03433086443692446),
+ (minx + 0.03072980046272278, maxy - 0.04131445661187172, maxz - 0.040801193099468946),
+ (minx + 0.031012218445539474, maxy - 0.04127589240670204, minz + 0.03935709968209267),
+ (minx + 0.04076687735505402, maxy - 0.04118320718407631, minz + 0.030374319292604923),
+ (minx + 0.034451283514499664, maxy - 0.03338594362139702, minz + 0.033365121111273766),
+ (minx + 0.030692334286868572, maxy - 0.03343509882688522, minz + 0.039297766517847776),
+ (minx + 0.03040337096899748, maxy - 0.03347455710172653, maxz - 0.040701600490137935),
+ (minx + 0.03366181440651417, maxy - 0.03349374979734421, maxz - 0.03447982110083103),
+ (minx + 0.03959457715973258, maxy - 0.033487528562545776, maxz - 0.03072074055671692),
+ (maxx - 0.040404647355899215, maxy - 0.033457569777965546, maxz - 0.030431604012846947),
+ (maxx - 0.03418291546404362, maxy - 0.03341188654303551, maxz - 0.03368987888097763),
+ (maxx - 0.030423964373767376, maxy - 0.0333627350628376, maxz - 0.03962252289056778),
+ (maxx - 0.030134993605315685, maxy - 0.03332327678799629, minz + 0.04037684458307922),
+ (maxx - 0.033393437042832375, maxy - 0.03330408036708832, minz + 0.03415506146848202),
+ (maxx - 0.03932619746774435, maxy - 0.03331030160188675, minz + 0.030395975336432457),
+ (minx + 0.040673027746379375, maxy - 0.03334026038646698, minz + 0.030106833204627037),
+ (minx + 0.030282274819910526, maxy - 0.005427400581538677, maxz - 0.0011750981211662292),
+ (minx + 0.013463903218507767, maxy - 0.005095209460705519, minz + 0.0108589306473732),
+ (minx + 0.010882444679737091, maxy - 0.005447734147310257, maxz - 0.013467073440551758),
+ (minx + 0.0011723600327968597, maxy - 0.005255943164229393, minz + 0.030258373357355595),
+ (minx + 0.0002274736762046814, maxy - 0.005384976044297218, maxz - 0.033811951987445354),
+ (maxx - 0.0134431142359972, maxy - 0.005180059932172298, maxz - 0.010884080082178116),
+ (maxx - 0.033787828870117664, maxy - 0.005329424981027842, maxz - 0.00022966042160987854),
+ (maxx - 0.0302614476531744, maxy - 0.004847868345677853, minz + 0.0011499449610710144),
+ (maxx - 0.00020667165517807007, maxy - 0.004890293348580599, minz + 0.03378681745380163),
+ (maxx - 0.0011515654623508453, maxy - 0.0050193266943097115, maxz - 0.03028351627290249),
+ (minx + 0.033808655105531216, maxy - 0.004945843946188688, minz + 0.0002044886350631714),
+ (maxx - 0.010861624032258987, maxy - 0.004827534779906273, minz + 0.013441929593682289),
+ (minx + 0.03468604106456041, maxy - 0.04122784733772278, minz + 0.033558815717697144),
+ (minx + 0.033914451487362385, maxy - 0.041333213448524475, maxz - 0.03472032118588686),
+ (maxx - 0.04044530005194247, maxy - 0.04129785671830177, maxz - 0.03076378908008337),
+ (maxx - 0.034364476799964905, maxy - 0.04125320911407471, maxz - 0.03394827153533697),
+ (maxx - 0.03069065511226654, maxy - 0.04120517522096634, maxz - 0.03974655526690185),
+ (maxx - 0.030408228747546673, maxy - 0.04116660729050636, minz + 0.04041173937730491),
+ (maxx - 0.03939127502962947, maxy - 0.0411539226770401, minz + 0.030656912364065647),
+ (minx + 0.03147818427532911, maxy - 0.033236272633075714, minz + 0.03954096930101514),
+ (minx + 0.031206720508635044, maxy - 0.03327333927154541, maxz - 0.04088335996493697),
+ (minx + 0.034267837181687355, maxy - 0.033291369676589966, maxz - 0.03503836318850517),
+ (minx + 0.03984131896868348, maxy - 0.03328552842140198, maxz - 0.03150692768394947),
+ (maxx - 0.040582869900390506, maxy - 0.0332573801279068, maxz - 0.03123530000448227),
+ (maxx - 0.03473791852593422, maxy - 0.033214468508958817, maxz - 0.03429625928401947),
+ (maxx - 0.031206604093313217, maxy - 0.03316829353570938, maxz - 0.03986963024362922),
+ (maxx - 0.030935133807361126, maxy - 0.03313122317194939, minz + 0.040554699720814824),
+ (maxx - 0.03399624954909086, maxy - 0.03311318904161453, minz + 0.03470969945192337),
+ (maxx - 0.03956972947344184, maxy - 0.03311903029680252, minz + 0.031178259290754795),
+ (minx + 0.04085446032695472, maxy - 0.0331471785902977, minz + 0.030906626023352146),
+ (minx + 0.035009496845304966, maxy - 0.03319009393453598, minz + 0.03396759741008282),
+ (minx + 0.019410474225878716, miny + 0.020503833889961243, minz + 0.016801605001091957),
+ (minx + 0.009459223598241806, miny + 0.020373672246932983, minz + 0.032507372088730335),
+ (maxx - 0.03541257046163082, miny + 0.02031419426202774, maxz - 0.008743710815906525),
+ (maxx - 0.0189414881169796, miny + 0.02043512463569641, maxz - 0.017369499430060387),
+ (maxx - 0.008990231901407242, miny + 0.02056524157524109, maxz - 0.03307527117431164),
+ (minx + 0.017320478335022926, miny + 0.02021842449903488, maxz - 0.01946074701845646),
+ (minx + 0.03302655927836895, miny + 0.02023487538099289, maxz - 0.009509153664112091),
+ (maxx - 0.008225221186876297, miny + 0.02066972106695175, minz + 0.0353640653192997),
+ (maxx - 0.016851460561156273, miny + 0.020720526576042175, minz + 0.018892847001552582),
+ (minx + 0.008694231510162354, miny + 0.020269230008125305, maxz - 0.03593196161091328),
+ (minx + 0.035881591495126486, miny + 0.020624756813049316, minz + 0.008175786584615707),
+ (maxx - 0.032557537779212, miny + 0.020704075694084167, minz + 0.008941244333982468),
+ (minx + 0.008214566856622696, miny + 0.023270338773727417, minz + 0.03213237784802914),
+ (maxx - 0.018073920160531998, miny + 0.023333996534347534, maxz - 0.016406163573265076),
+ (maxx - 0.007764074951410294, miny + 0.023468807339668274, maxz - 0.03267789073288441),
+ (minx + 0.03263115230947733, miny + 0.023126527667045593, maxz - 0.008262567222118378),
+ (maxx - 0.015908580273389816, miny + 0.023629695177078247, minz + 0.018027253448963165),
+ (minx + 0.01852441392838955, miny + 0.023405179381370544, minz + 0.015860654413700104),
+ (maxx - 0.03513853810727596, miny + 0.023208707571029663, maxz - 0.007469546049833298),
+ (minx + 0.016359103843569756, miny + 0.02310948073863983, maxz - 0.018572768196463585),
+ (maxx - 0.006971497088670731, miny + 0.023577049374580383, minz + 0.0350920120254159),
+ (minx + 0.007422015070915222, miny + 0.023162126541137695, maxz - 0.03563752118498087),
+ (minx + 0.035589066334068775, miny + 0.023530468344688416, minz + 0.00692400336265564),
+ (maxx - 0.032180625945329666, miny + 0.023612648248672485, minz + 0.0077170394361019135),
+ (minx + 0.021761823445558548, miny + 0.020728543400764465, minz + 0.019355909898877144),
+ (minx + 0.012772375717759132, miny + 0.020610973238945007, minz + 0.03354368917644024),
+ (maxx - 0.03617278253659606, miny + 0.020557239651679993, maxz - 0.012130718678236008),
+ (maxx - 0.021293656900525093, miny + 0.020666487514972687, maxz - 0.019922811537981033),
+ (maxx - 0.012304211035370827, miny + 0.02078402042388916, maxz - 0.03411059454083443),
+ (minx + 0.019873831421136856, miny + 0.020470723509788513, maxz - 0.021811936050653458),
+ (minx + 0.034061891958117485, miny + 0.020485587418079376, maxz - 0.01282217912375927),
+ (maxx - 0.011613138020038605, miny + 0.020878411829471588, minz + 0.0361242787912488),
+ (maxx - 0.019405635073781013, miny + 0.02092430740594864, minz + 0.02124503068625927),
+ (minx + 0.012081325054168701, miny + 0.020516619086265564, maxz - 0.03669118043035269),
+ (minx + 0.03664098121225834, miny + 0.02083779126405716, minz + 0.01156378909945488),
+ (maxx - 0.03359369467943907, miny + 0.020909443497657776, minz + 0.012255258858203888),
+ (minx + 0.01420576497912407, miny + 0.023059040307998657, minz + 0.03400459885597229),
+ (maxx - 0.022325390949845314, miny + 0.023111969232559204, maxz - 0.021023839712142944),
+ (maxx - 0.013754449784755707, miny + 0.02322402596473694, maxz - 0.034551107324659824),
+ (minx + 0.034504144452512264, miny + 0.022939488291740417, maxz - 0.014253776520490646),
+ (maxx - 0.020525267347693443, miny + 0.023357778787612915, minz + 0.02227850630879402),
+ (minx + 0.022776709869503975, miny + 0.023171141743659973, minz + 0.020477334037423134),
+ (maxx - 0.036511816550046206, miny + 0.023007795214653015, maxz - 0.013594510033726692),
+ (minx + 0.020976610481739044, miny + 0.02292531728744507, maxz - 0.02282501384615898),
+ (maxx - 0.013095550239086151, miny + 0.02331402897834778, minz + 0.03646504878997803),
+ (minx + 0.013546885922551155, miny + 0.0229690819978714, maxz - 0.037011553067713976),
+ (minx + 0.03696316387504339, miny + 0.023275285959243774, minz + 0.013047976419329643),
+ (maxx - 0.03405279852449894, miny + 0.023343607783317566, minz + 0.013707255944609642)]
+
+ # Faces
+ myfaces = [(24, 0, 1), (24, 1, 2), (24, 2, 3), (24, 3, 4), (24, 4, 5),
+ (24, 5, 6), (24, 6, 7), (24, 7, 8), (24, 8, 9), (24, 9, 10),
+ (24, 10, 11), (11, 0, 24), (140, 12, 13, 142), (142, 13, 14, 143), (143, 14, 15, 141),
+ (141, 15, 16, 139), (139, 16, 17, 145), (145, 17, 18, 144), (144, 18, 19, 148), (148, 19, 20, 147),
+ (147, 20, 21, 150), (150, 21, 22, 146), (146, 22, 23, 149), (140, 0, 11, 149), (13, 12, 25, 26),
+ (14, 13, 26, 27), (15, 14, 27, 28), (16, 15, 28, 29), (17, 16, 29, 30), (18, 17, 30, 31),
+ (19, 18, 31, 32), (20, 19, 32, 33), (21, 20, 33, 34), (22, 21, 34, 35), (23, 22, 35, 36),
+ (12, 23, 36, 25), (25, 49, 50, 26), (49, 37, 38, 50), (26, 50, 51, 27), (50, 38, 39, 51),
+ (27, 51, 52, 28), (51, 39, 40, 52), (28, 52, 53, 29), (52, 40, 41, 53), (29, 53, 54, 30),
+ (53, 41, 42, 54), (30, 54, 55, 31), (54, 42, 43, 55), (31, 55, 56, 32), (55, 43, 44, 56),
+ (32, 56, 57, 33), (56, 44, 45, 57), (33, 57, 58, 34), (57, 45, 46, 58), (34, 58, 59, 35),
+ (58, 46, 47, 59), (35, 59, 60, 36), (59, 47, 48, 60), (36, 60, 49, 25), (60, 48, 37, 49),
+ (38, 37, 61, 62), (39, 38, 62, 63), (40, 39, 63, 64), (41, 40, 64, 65), (42, 41, 65, 66),
+ (43, 42, 66, 67), (44, 43, 67, 68), (45, 44, 68, 69), (46, 45, 69, 70), (47, 46, 70, 71),
+ (48, 47, 71, 72), (37, 48, 72, 61), (124, 125, 74, 75), (171, 170, 85, 86), (173, 172, 90, 91),
+ (174, 173, 91, 92), (176, 175, 88, 89), (178, 177, 93, 94), (175, 179, 87, 88), (177, 174, 92, 93),
+ (170, 180, 96, 85), (180, 181, 95, 96), (181, 178, 94, 95), (172, 176, 89, 90), (179, 171, 86, 87),
+ (90, 89, 101, 102), (86, 85, 97, 98), (93, 92, 104, 105), (96, 95, 107, 108), (85, 96, 108, 97),
+ (89, 88, 100, 101), (91, 90, 102, 103), (88, 87, 99, 100), (92, 91, 103, 104), (95, 94, 106, 107),
+ (94, 93, 105, 106), (87, 86, 98, 99), (105, 104, 116, 117), (108, 107, 119, 120), (97, 108, 120, 109),
+ (101, 100, 112, 113), (103, 102, 114, 115), (100, 99, 111, 112), (104, 103, 115, 116),
+ (107, 106, 118, 119),
+ (106, 105, 117, 118), (99, 98, 110, 111), (102, 101, 113, 114), (98, 97, 109, 110), (120, 119, 121),
+ (109, 120, 121), (113, 112, 121), (115, 114, 121), (112, 111, 121), (116, 115, 121),
+ (119, 118, 121), (118, 117, 121), (111, 110, 121), (114, 113, 121), (110, 109, 121),
+ (117, 116, 121), (169, 158, 62, 61), (158, 159, 63, 62), (159, 160, 64, 63), (160, 161, 65, 64),
+ (161, 162, 66, 65), (162, 163, 67, 66), (163, 164, 68, 67), (164, 165, 69, 68), (165, 166, 70, 69),
+ (166, 167, 71, 70), (167, 168, 72, 71), (168, 169, 61, 72), (72, 138, 127, 61), (63, 129, 130, 64),
+ (67, 133, 134, 68), (64, 130, 131, 65), (61, 127, 128, 62), (69, 135, 136, 70), (66, 132, 133, 67),
+ (65, 131, 132, 66), (71, 137, 138, 72), (70, 136, 137, 71), (62, 128, 129, 63), (68, 134, 135, 69),
+ (0, 140, 142, 1), (1, 142, 143, 2), (2, 143, 141, 3), (3, 141, 139, 4), (4, 139, 145, 5),
+ (5, 145, 144, 6), (6, 144, 148, 7), (7, 148, 147, 8), (8, 147, 150, 9), (9, 150, 146, 10),
+ (10, 146, 149, 11), (12, 140, 149, 23), (153, 154, 163, 162), (154, 155, 164, 163), (155, 156, 165, 164),
+ (125, 151, 73, 74), (152, 124, 75, 76), (122, 152, 76, 77), (153, 122, 77, 78), (154, 153, 78, 79),
+ (155, 154, 79, 80), (156, 155, 80, 81), (123, 156, 81, 82), (157, 123, 82, 83), (126, 157, 83, 84),
+ (73, 151, 126, 84), (151, 125, 158, 169), (125, 124, 159, 158), (124, 152, 160, 159),
+ (152, 122, 161, 160),
+ (122, 153, 162, 161), (156, 123, 166, 165), (123, 157, 167, 166), (157, 126, 168, 167),
+ (126, 151, 169, 168),
+ (185, 189, 213, 209), (192, 193, 217, 216), (172, 173, 197, 196), (174, 177, 201, 198),
+ (171, 179, 203, 195),
+ (184, 183, 207, 208), (187, 192, 216, 211), (170, 171, 195, 194), (179, 175, 199, 203),
+ (176, 172, 196, 200),
+ (183, 188, 212, 207), (190, 184, 208, 214), (74, 73, 187, 182), (79, 78, 188, 183), (80, 79, 183, 184),
+ (77, 76, 189, 185), (82, 81, 190, 186), (76, 75, 191, 189), (81, 80, 184, 190), (73, 84, 192, 187),
+ (84, 83, 193, 192), (83, 82, 186, 193), (78, 77, 185, 188), (75, 74, 182, 191), (206, 211, 194, 195),
+ (207, 212, 196, 197), (208, 207, 197, 198), (209, 213, 199, 200), (210, 214, 201, 202),
+ (213, 215, 203, 199),
+ (214, 208, 198, 201), (211, 216, 204, 194), (216, 217, 205, 204), (217, 210, 202, 205),
+ (212, 209, 200, 196),
+ (215, 206, 195, 203), (180, 170, 194, 204), (173, 174, 198, 197), (193, 186, 210, 217),
+ (186, 190, 214, 210),
+ (181, 180, 204, 205), (175, 176, 200, 199), (188, 185, 209, 212), (189, 191, 215, 213),
+ (182, 187, 211, 206),
+ (178, 181, 205, 202), (177, 178, 202, 201), (191, 182, 206, 215)]
+
+ return myvertex, myfaces
+
+
+# ----------------------------------------------
+# Handle model 04
+# ----------------------------------------------
+def handle_model_04():
+ # ------------------------------------
+ # Mesh data
+ # ------------------------------------
+ minx = -0.04349547624588013
+ maxx = 0.04352114722132683
+ miny = -0.07034946978092194
+ maxy = 0
+ minz = -0.12514087557792664
+ maxz = 0.12514087557792664
+
+ # Vertex
+ myvertex = [(minx + 0.013302795588970184, maxy - 0.002780601382255554, minz + 0.010707870125770569),
+ (minx + 0.0009496212005615234, maxy - 0.002942140679806471, minz + 0.030204586684703827),
+ (minx, maxy - 0.003071820829063654, minz + 0.053266048431396484),
+ (minx + 0.010708402842283249, maxy - 0.0031348932534456253, minz + 0.07371294498443604),
+ (minx + 0.03020550962537527, maxy - 0.003114458406344056, minz + 0.08606655150651932),
+ (maxx - 0.03374953381717205, maxy - 0.003015991533175111, minz + 0.08701672777533531),
+ (maxx - 0.01330280676484108, maxy - 0.0028658765368163586, minz + 0.07630888000130653),
+ (maxx - 0.0009496286511421204, maxy - 0.0027043374720960855, minz + 0.056812167167663574),
+ (maxx, maxy - 0.0025746573228389025, minz + 0.033750712871551514),
+ (maxx - 0.010708380490541458, maxy - 0.002511584199965, minz + 0.013303808867931366),
+ (maxx - 0.03020548354834318, maxy - 0.0025320190470665693, minz + 0.0009501948952674866),
+ (minx + 0.03374955803155899, maxy - 0.0026304861530661583, minz),
+ (minx + 0.014472760260105133, maxy - 0.019589224830269814, minz + 0.01180487871170044),
+ (minx + 0.002567145973443985, maxy - 0.019744910299777985, minz + 0.03059517592191696),
+ (minx + 0.001651916652917862, maxy - 0.019869891926646233, minz + 0.052821069955825806),
+ (minx + 0.011972300708293915, maxy - 0.019930677488446236, minz + 0.07252714410424232),
+ (minx + 0.03076297417283058, maxy - 0.019910985603928566, minz + 0.0844331718981266),
+ (maxx - 0.034027633257210255, maxy - 0.019816085696220398, minz + 0.0853489525616169),
+ (maxx - 0.014321718364953995, maxy - 0.01967141032218933, minz + 0.07502909749746323),
+ (maxx - 0.002416089177131653, maxy - 0.01951572299003601, minz + 0.056238800287246704),
+ (maxx - 0.0015008561313152313, maxy - 0.019390743225812912, minz + 0.03401290625333786),
+ (maxx - 0.011821221560239792, maxy - 0.01932995393872261, minz + 0.014306828379631042),
+ (maxx - 0.03061189129948616, maxy - 0.01934964768588543, minz + 0.0024007856845855713),
+ (minx + 0.03417872078716755, maxy - 0.019444547593593597, minz + 0.001484982669353485),
+ (minx + 0.043508310547622386, maxy - 0.005668943747878075, minz + 0.043508365750312805),
+ (minx + 0.029034355655312538, maxy - 0.019612153992056847, minz + 0.027617476880550385),
+ (minx + 0.023084014654159546, maxy - 0.01968996599316597, minz + 0.037008725106716156),
+ (minx + 0.022626593708992004, maxy - 0.01975242979824543, minz + 0.048117056488990784),
+ (minx + 0.027784643694758415, maxy - 0.019782811403274536, minz + 0.05796600878238678),
+ (minx + 0.03717608004808426, maxy - 0.019772969186306, minz + 0.06391655653715134),
+ (maxx - 0.03873214777559042, maxy - 0.019725536927580833, minz + 0.06437425315380096),
+ (maxx - 0.02888327743858099, maxy - 0.019653232768177986, minz + 0.059216469526290894),
+ (maxx - 0.022932931780815125, maxy - 0.019575420767068863, minz + 0.04982522130012512),
+ (maxx - 0.022475499659776688, maxy - 0.019512956961989403, minz + 0.0387168824672699),
+ (maxx - 0.0276335496455431, maxy - 0.019482573494315147, minz + 0.0288679301738739),
+ (maxx - 0.03702498506754637, maxy - 0.019492419436573982, minz + 0.022917382419109344),
+ (minx + 0.038883245550096035, maxy - 0.0195398461073637, minz + 0.022459670901298523),
+ (minx + 0.029087782837450504, maxy - 0.03150090575218201, minz + 0.027552828192710876),
+ (minx + 0.023137442767620087, maxy - 0.03157871589064598, minz + 0.03694407641887665),
+ (minx + 0.022680018097162247, maxy - 0.03164118155837059, minz + 0.04805241525173187),
+ (minx + 0.027838071808218956, maxy - 0.031671565026044846, minz + 0.05790136009454727),
+ (minx + 0.0372295081615448, maxy - 0.03166172280907631, minz + 0.06385190784931183),
+ (maxx - 0.03867871919646859, maxy - 0.03161429241299629, minz + 0.06430960446596146),
+ (maxx - 0.028829848393797874, maxy - 0.03154198080301285, minz + 0.05915181338787079),
+ (maxx - 0.022879503667354584, maxy - 0.031464170664548874, minz + 0.04976056516170502),
+ (maxx - 0.022422071546316147, maxy - 0.03140170872211456, minz + 0.03865223377943039),
+ (maxx - 0.02758011966943741, maxy - 0.03137132152915001, minz + 0.028803281486034393),
+ (maxx - 0.03697155695408583, maxy - 0.031381167471408844, minz + 0.022852733731269836),
+ (minx + 0.038936673663556576, maxy - 0.03142859786748886, minz + 0.022395022213459015),
+ (minx + 0.029038896784186363, maxy - 0.020622700452804565, minz + 0.027611978352069855),
+ (minx + 0.02308855764567852, maxy - 0.02070051059126854, minz + 0.03700323402881622),
+ (minx + 0.02263113297522068, maxy - 0.020762978121638298, minz + 0.04811156541109085),
+ (minx + 0.02778918668627739, maxy - 0.020793357864022255, minz + 0.05796051025390625),
+ (minx + 0.037180622573941946, maxy - 0.02078351564705372, minz + 0.0639110580086708),
+ (maxx - 0.03872760524973273, maxy - 0.020736083388328552, minz + 0.06436875835061073),
+ (maxx - 0.028878736309707165, maxy - 0.020663777366280556, minz + 0.059210970997810364),
+ (maxx - 0.02292838878929615, maxy - 0.020585965365171432, minz + 0.04981972277164459),
+ (maxx - 0.022470960393548012, maxy - 0.020523501560091972, minz + 0.038711391389369965),
+ (maxx - 0.027629008516669273, maxy - 0.020493119955062866, minz + 0.02886243909597397),
+ (maxx - 0.03702044300734997, maxy - 0.020502964034676552, minz + 0.022911883890628815),
+ (minx + 0.03888778714463115, maxy - 0.02055039070546627, minz + 0.022454172372817993),
+ (minx + 0.03503026906400919, maxy - 0.0326739065349102, minz + 0.03399384766817093),
+ (minx + 0.03150810860097408, maxy - 0.032719966024160385, minz + 0.039552778005599976),
+ (minx + 0.03123734798282385, maxy - 0.03275693953037262, minz + 0.04612809419631958),
+ (minx + 0.034290531650185585, maxy - 0.032774921506643295, minz + 0.051957935094833374),
+ (minx + 0.039849569322541356, maxy - 0.0327690951526165, minz + 0.0554802268743515),
+ (maxx - 0.04059170465916395, maxy - 0.03274102136492729, minz + 0.055751144886016846),
+ (maxx - 0.03476190101355314, maxy - 0.032698217779397964, minz + 0.05269812047481537),
+ (maxx - 0.031239738687872887, maxy - 0.03265216201543808, minz + 0.04713919758796692),
+ (maxx - 0.03096897155046463, maxy - 0.032615188509225845, minz + 0.040563881397247314),
+ (maxx - 0.03402215428650379, maxy - 0.03259720280766487, minz + 0.03473402559757233),
+ (maxx - 0.03958118986338377, maxy - 0.032603029161691666, minz + 0.031211741268634796),
+ (minx + 0.04086008481681347, maxy - 0.032631102949380875, minz + 0.030940808355808258),
+ (minx + 0.03971285093575716, miny + 0.029022332280874252, minz + 0.05597035586833954),
+ (maxx - 0.03359287604689598, miny + 0.029201623052358627, minz + 0.034330859780311584),
+ (minx + 0.03072980046272278, miny + 0.029035013169050217, minz + 0.04621553421020508),
+ (minx + 0.031012218445539474, miny + 0.029073577374219894, minz + 0.03935709595680237),
+ (minx + 0.04076687735505402, miny + 0.029166262596845627, minz + 0.03037431836128235),
+ (minx + 0.034451283514499664, maxy - 0.03338594362139702, minz + 0.033365122973918915),
+ (minx + 0.030692334286868572, maxy - 0.03343509882688522, minz + 0.039297766983509064),
+ (minx + 0.03040337096899748, maxy - 0.03347455710172653, minz + 0.04631512612104416),
+ (minx + 0.03366181440651417, maxy - 0.03349374979734421, minz + 0.05253690481185913),
+ (minx + 0.03959457715973258, maxy - 0.033487528562545776, minz + 0.05629599094390869),
+ (maxx - 0.040404647355899215, maxy - 0.033457569777965546, minz + 0.056585125625133514),
+ (maxx - 0.03418291546404362, maxy - 0.03341188654303551, minz + 0.05332684516906738),
+ (maxx - 0.030423964373767376, maxy - 0.0333627350628376, minz + 0.047394201159477234),
+ (maxx - 0.030134993605315685, maxy - 0.03332327678799629, minz + 0.04037684202194214),
+ (maxx - 0.033393437042832375, maxy - 0.03330408036708832, minz + 0.03415506333112717),
+ (maxx - 0.03932619746774435, maxy - 0.03331030160188675, minz + 0.030395977199077606),
+ (minx + 0.040673027746379375, maxy - 0.03334026038646698, minz + 0.030106835067272186),
+ (minx + 0.030282274819910526, maxy - 0.005427400581538677, minz + 0.08584162965416908),
+ (minx + 0.013463903218507767, maxy - 0.005095209460705519, minz + 0.0108589306473732),
+ (minx + 0.010882444679737091, maxy - 0.005447734147310257, minz + 0.07354965433478355),
+ (minx + 0.0011723600327968597, maxy - 0.005255943164229393, minz + 0.03025837242603302),
+ (minx + 0.0002274736762046814, maxy - 0.005384976044297218, minz + 0.05320477485656738),
+ (maxx - 0.0134431142359972, maxy - 0.005180059932172298, minz + 0.0761326476931572),
+ (maxx - 0.033787828870117664, maxy - 0.005329424981027842, minz + 0.08678706735372543),
+ (maxx - 0.0302614476531744, maxy - 0.004847868345677853, minz + 0.0011499449610710144),
+ (maxx - 0.00020667165517807007, maxy - 0.004890293348580599, minz + 0.03378681838512421),
+ (maxx - 0.0011515654623508453, maxy - 0.0050193266943097115, minz + 0.05673321336507797),
+ (minx + 0.033808655105531216, maxy - 0.004945843946188688, minz + 0.0002044886350631714),
+ (maxx - 0.010861624032258987, maxy - 0.004827534779906273, minz + 0.01344192773103714),
+ (minx + 0.03468604106456041, miny + 0.029121622443199158, minz + 0.033558815717697144),
+ (minx + 0.033914451487362385, miny + 0.02901625633239746, minz + 0.05229640752077103),
+ (maxx - 0.04044530005194247, miny + 0.029051613062620163, minz + 0.056252941489219666),
+ (maxx - 0.034364476799964905, miny + 0.02909626066684723, minz + 0.053068459033966064),
+ (maxx - 0.03069065511226654, miny + 0.029144294559955597, minz + 0.04727017134428024),
+ (maxx - 0.030408228747546673, miny + 0.029182862490415573, minz + 0.04041174054145813),
+ (maxx - 0.03939127502962947, miny + 0.029195547103881836, minz + 0.030656911432743073),
+ (minx + 0.03147818427532911, maxy - 0.033236272633075714, minz + 0.03954096883535385),
+ (minx + 0.031206720508635044, maxy - 0.03327333927154541, minz + 0.0461333692073822),
+ (minx + 0.034267837181687355, maxy - 0.033291369676589966, minz + 0.05197836458683014),
+ (minx + 0.03984131896868348, maxy - 0.03328552842140198, minz + 0.05550979822874069),
+ (maxx - 0.040582869900390506, maxy - 0.0332573801279068, minz + 0.055781424045562744),
+ (maxx - 0.03473791852593422, maxy - 0.033214468508958817, minz + 0.05272047221660614),
+ (maxx - 0.031206604093313217, maxy - 0.03316829353570938, minz + 0.04714709520339966),
+ (maxx - 0.030935133807361126, maxy - 0.03313122317194939, minz + 0.040554702281951904),
+ (maxx - 0.03399624954909086, maxy - 0.03311318904161453, minz + 0.03470969945192337),
+ (maxx - 0.03956972947344184, maxy - 0.03311903029680252, minz + 0.03117825835943222),
+ (minx + 0.04085446032695472, maxy - 0.0331471785902977, minz + 0.03090662509202957),
+ (minx + 0.035009496845304966, maxy - 0.03319009393453598, minz + 0.033967599272727966),
+ (maxx - 0.03939127502962947, miny + 0.0002205297350883484, minz + 0.0343027338385582),
+ (maxx - 0.030408228747546673, miny + 0.007109262049198151, minz + 0.04120940715074539),
+ (maxx - 0.03069065511226654, miny + 0.011931635439395905, minz + 0.046086326241493225),
+ (maxx - 0.034364476799964905, miny + 0.01599767804145813, minz + 0.050220295786857605),
+ (maxx - 0.04044530005194247, miny + 0.01821787655353546, minz + 0.05250363051891327),
+ (minx + 0.033914451487362385, miny + 0.015395186841487885, minz + 0.04973094165325165),
+ (minx + 0.03468604106456041, miny + 0.0022202134132385254, minz + 0.03640696406364441),
+ (minx + 0.04076687735505402, miny, minz + 0.03412361443042755),
+ (minx + 0.031012218445539474, miny + 0.006286241114139557, minz + 0.040540941059589386),
+ (minx + 0.03072980046272278, miny + 0.011108621954917908, minz + 0.04541786015033722),
+ (maxx - 0.03359287604689598, miny + 0.002822697162628174, minz + 0.036896318197250366),
+ (minx + 0.03971285093575716, miny + 0.01799735426902771, minz + 0.05232451856136322),
+ (minx + 0.0343002462759614, miny + 0.015705399215221405, maxz - 0.10733164101839066),
+ (minx + 0.030871009454131126, miny + 0.011495128273963928, maxz - 0.10745517536997795),
+ (minx + 0.030871009454131126, miny + 0.006645478308200836, maxz - 0.1074824407696724),
+ (minx + 0.0343002462759614, miny + 0.0024559199810028076, maxz - 0.10740615427494049),
+ (minx + 0.04023986402899027, miny + 4.902482032775879e-05, maxz - 0.10724674165248871),
+ (maxx - 0.03991828765720129, miny + 6.973743438720703e-05, maxz - 0.10704692453145981),
+ (maxx - 0.03397867642343044, miny + 0.0025124847888946533, maxz - 0.10686022788286209),
+ (maxx - 0.030549442395567894, miny + 0.00672275573015213, maxz - 0.1067366972565651),
+ (maxx - 0.030549442395567894, miny + 0.011572405695915222, maxz - 0.10670943185687065),
+ (maxx - 0.03397867642343044, miny + 0.015761971473693848, maxz - 0.10678572952747345),
+ (maxx - 0.03991828765720129, miny + 0.0181688591837883, maxz - 0.10694513842463493),
+ (minx + 0.04023986402899027, miny + 0.018148154020309448, maxz - 0.10714496672153473),
+ (minx + 0.013302795588970184, maxy - 0.002780601382255554, maxz - 0.010707870125770569),
+ (minx + 0.0009496212005615234, maxy - 0.002942140679806471, maxz - 0.030204586684703827),
+ (minx, maxy - 0.003071820829063654, maxz - 0.053266048431396484),
+ (minx + 0.010708402842283249, maxy - 0.0031348932534456253, maxz - 0.07371294498443604),
+ (minx + 0.03020550962537527, maxy - 0.003114458406344056, maxz - 0.08606655150651932),
+ (maxx - 0.03374953381717205, maxy - 0.003015991533175111, maxz - 0.08701672777533531),
+ (maxx - 0.01330280676484108, maxy - 0.0028658765368163586, maxz - 0.07630888000130653),
+ (maxx - 0.0009496286511421204, maxy - 0.0027043374720960855, maxz - 0.056812167167663574),
+ (maxx, maxy - 0.0025746573228389025, maxz - 0.033750712871551514),
+ (maxx - 0.010708380490541458, maxy - 0.002511584199965, maxz - 0.013303808867931366),
+ (maxx - 0.03020548354834318, maxy - 0.0025320190470665693, maxz - 0.0009501948952674866),
+ (minx + 0.03374955803155899, maxy - 0.0026304861530661583, maxz),
+ (minx + 0.014472760260105133, maxy - 0.019589224830269814, maxz - 0.01180487871170044),
+ (minx + 0.002567145973443985, maxy - 0.019744910299777985, maxz - 0.03059517592191696),
+ (minx + 0.001651916652917862, maxy - 0.019869891926646233, maxz - 0.052821069955825806),
+ (minx + 0.011972300708293915, maxy - 0.019930677488446236, maxz - 0.07252714410424232),
+ (minx + 0.03076297417283058, maxy - 0.019910985603928566, maxz - 0.0844331718981266),
+ (maxx - 0.034027633257210255, maxy - 0.019816085696220398, maxz - 0.0853489525616169),
+ (maxx - 0.014321718364953995, maxy - 0.01967141032218933, maxz - 0.07502909749746323),
+ (maxx - 0.002416089177131653, maxy - 0.01951572299003601, maxz - 0.056238800287246704),
+ (maxx - 0.0015008561313152313, maxy - 0.019390743225812912, maxz - 0.03401290625333786),
+ (maxx - 0.011821221560239792, maxy - 0.01932995393872261, maxz - 0.014306828379631042),
+ (maxx - 0.03061189129948616, maxy - 0.01934964768588543, maxz - 0.0024007856845855713),
+ (minx + 0.03417872078716755, maxy - 0.019444547593593597, maxz - 0.001484982669353485),
+ (minx + 0.043508310547622386, maxy - 0.005668943747878075, maxz - 0.043508365750312805),
+ (minx + 0.029034355655312538, maxy - 0.019612153992056847, maxz - 0.027617476880550385),
+ (minx + 0.023084014654159546, maxy - 0.01968996599316597, maxz - 0.037008725106716156),
+ (minx + 0.022626593708992004, maxy - 0.01975242979824543, maxz - 0.048117056488990784),
+ (minx + 0.027784643694758415, maxy - 0.019782811403274536, maxz - 0.05796600878238678),
+ (minx + 0.03717608004808426, maxy - 0.019772969186306, maxz - 0.06391655653715134),
+ (maxx - 0.03873214777559042, maxy - 0.019725536927580833, maxz - 0.06437425315380096),
+ (maxx - 0.02888327743858099, maxy - 0.019653232768177986, maxz - 0.059216469526290894),
+ (maxx - 0.022932931780815125, maxy - 0.019575420767068863, maxz - 0.04982522130012512),
+ (maxx - 0.022475499659776688, maxy - 0.019512956961989403, maxz - 0.0387168824672699),
+ (maxx - 0.0276335496455431, maxy - 0.019482573494315147, maxz - 0.0288679301738739),
+ (maxx - 0.03702498506754637, maxy - 0.019492419436573982, maxz - 0.022917382419109344),
+ (minx + 0.038883245550096035, maxy - 0.0195398461073637, maxz - 0.022459670901298523),
+ (minx + 0.029087782837450504, maxy - 0.03150090575218201, maxz - 0.027552828192710876),
+ (minx + 0.023137442767620087, maxy - 0.03157871589064598, maxz - 0.03694407641887665),
+ (minx + 0.022680018097162247, maxy - 0.03164118155837059, maxz - 0.04805241525173187),
+ (minx + 0.027838071808218956, maxy - 0.031671565026044846, maxz - 0.05790136009454727),
+ (minx + 0.0372295081615448, maxy - 0.03166172280907631, maxz - 0.06385190784931183),
+ (maxx - 0.03867871919646859, maxy - 0.03161429241299629, maxz - 0.06430960446596146),
+ (maxx - 0.028829848393797874, maxy - 0.03154198080301285, maxz - 0.05915181338787079),
+ (maxx - 0.022879503667354584, maxy - 0.031464170664548874, maxz - 0.04976056516170502),
+ (maxx - 0.022422071546316147, maxy - 0.03140170872211456, maxz - 0.03865223377943039),
+ (maxx - 0.02758011966943741, maxy - 0.03137132152915001, maxz - 0.028803281486034393),
+ (maxx - 0.03697155695408583, maxy - 0.031381167471408844, maxz - 0.022852733731269836),
+ (minx + 0.038936673663556576, maxy - 0.03142859786748886, maxz - 0.022395022213459015),
+ (minx + 0.029038896784186363, maxy - 0.020622700452804565, maxz - 0.027611978352069855),
+ (minx + 0.02308855764567852, maxy - 0.02070051059126854, maxz - 0.03700323402881622),
+ (minx + 0.02263113297522068, maxy - 0.020762978121638298, maxz - 0.04811156541109085),
+ (minx + 0.02778918668627739, maxy - 0.020793357864022255, maxz - 0.05796051025390625),
+ (minx + 0.037180622573941946, maxy - 0.02078351564705372, maxz - 0.0639110580086708),
+ (maxx - 0.03872760524973273, maxy - 0.020736083388328552, maxz - 0.06436875835061073),
+ (maxx - 0.028878736309707165, maxy - 0.020663777366280556, maxz - 0.059210970997810364),
+ (maxx - 0.02292838878929615, maxy - 0.020585965365171432, maxz - 0.04981972277164459),
+ (maxx - 0.022470960393548012, maxy - 0.020523501560091972, maxz - 0.038711391389369965),
+ (maxx - 0.027629008516669273, maxy - 0.020493119955062866, maxz - 0.02886243909597397),
+ (maxx - 0.03702044300734997, maxy - 0.020502964034676552, maxz - 0.022911883890628815),
+ (minx + 0.03888778714463115, maxy - 0.02055039070546627, maxz - 0.022454172372817993),
+ (minx + 0.03503026906400919, maxy - 0.0326739065349102, maxz - 0.03399384766817093),
+ (minx + 0.03150810860097408, maxy - 0.032719966024160385, maxz - 0.039552778005599976),
+ (minx + 0.03123734798282385, maxy - 0.03275693953037262, maxz - 0.04612809419631958),
+ (minx + 0.034290531650185585, maxy - 0.032774921506643295, maxz - 0.051957935094833374),
+ (minx + 0.039849569322541356, maxy - 0.0327690951526165, maxz - 0.0554802268743515),
+ (maxx - 0.04059170465916395, maxy - 0.03274102136492729, maxz - 0.055751144886016846),
+ (maxx - 0.03476190101355314, maxy - 0.032698217779397964, maxz - 0.05269812047481537),
+ (maxx - 0.031239738687872887, maxy - 0.03265216201543808, maxz - 0.04713919758796692),
+ (maxx - 0.03096897155046463, maxy - 0.032615188509225845, maxz - 0.040563881397247314),
+ (maxx - 0.03402215428650379, maxy - 0.03259720280766487, maxz - 0.03473402559757233),
+ (maxx - 0.03958118986338377, maxy - 0.032603029161691666, maxz - 0.031211741268634796),
+ (minx + 0.04086008481681347, maxy - 0.032631102949380875, maxz - 0.030940808355808258),
+ (minx + 0.03971285093575716, miny + 0.029022332280874252, maxz - 0.05597035586833954),
+ (maxx - 0.03359287604689598, miny + 0.029201623052358627, maxz - 0.034330859780311584),
+ (minx + 0.03072980046272278, miny + 0.029035013169050217, maxz - 0.04621553421020508),
+ (minx + 0.031012218445539474, miny + 0.029073577374219894, maxz - 0.03935709595680237),
+ (minx + 0.04076687735505402, miny + 0.029166262596845627, maxz - 0.03037431836128235),
+ (minx + 0.034451283514499664, maxy - 0.03338594362139702, maxz - 0.033365122973918915),
+ (minx + 0.030692334286868572, maxy - 0.03343509882688522, maxz - 0.039297766983509064),
+ (minx + 0.03040337096899748, maxy - 0.03347455710172653, maxz - 0.04631512612104416),
+ (minx + 0.03366181440651417, maxy - 0.03349374979734421, maxz - 0.05253690481185913),
+ (minx + 0.03959457715973258, maxy - 0.033487528562545776, maxz - 0.05629599094390869),
+ (maxx - 0.040404647355899215, maxy - 0.033457569777965546, maxz - 0.056585125625133514),
+ (maxx - 0.03418291546404362, maxy - 0.03341188654303551, maxz - 0.05332684516906738),
+ (maxx - 0.030423964373767376, maxy - 0.0333627350628376, maxz - 0.047394201159477234),
+ (maxx - 0.030134993605315685, maxy - 0.03332327678799629, maxz - 0.04037684202194214),
+ (maxx - 0.033393437042832375, maxy - 0.03330408036708832, maxz - 0.03415506333112717),
+ (maxx - 0.03932619746774435, maxy - 0.03331030160188675, maxz - 0.030395977199077606),
+ (minx + 0.040673027746379375, maxy - 0.03334026038646698, maxz - 0.030106835067272186),
+ (minx + 0.030282274819910526, maxy - 0.005427400581538677, maxz - 0.08584162965416908),
+ (minx + 0.013463903218507767, maxy - 0.005095209460705519, maxz - 0.0108589306473732),
+ (minx + 0.010882444679737091, maxy - 0.005447734147310257, maxz - 0.07354965433478355),
+ (minx + 0.0011723600327968597, maxy - 0.005255943164229393, maxz - 0.03025837242603302),
+ (minx + 0.0002274736762046814, maxy - 0.005384976044297218, maxz - 0.05320477485656738),
+ (maxx - 0.0134431142359972, maxy - 0.005180059932172298, maxz - 0.0761326476931572),
+ (maxx - 0.033787828870117664, maxy - 0.005329424981027842, maxz - 0.08678706735372543),
+ (maxx - 0.0302614476531744, maxy - 0.004847868345677853, maxz - 0.0011499449610710144),
+ (maxx - 0.00020667165517807007, maxy - 0.004890293348580599, maxz - 0.03378681838512421),
+ (maxx - 0.0011515654623508453, maxy - 0.0050193266943097115, maxz - 0.05673321336507797),
+ (minx + 0.033808655105531216, maxy - 0.004945843946188688, maxz - 0.0002044886350631714),
+ (maxx - 0.010861624032258987, maxy - 0.004827534779906273, maxz - 0.01344192773103714),
+ (minx + 0.03468604106456041, miny + 0.029121622443199158, maxz - 0.033558815717697144),
+ (minx + 0.033914451487362385, miny + 0.02901625633239746, maxz - 0.05229640752077103),
+ (maxx - 0.04044530005194247, miny + 0.029051613062620163, maxz - 0.056252941489219666),
+ (maxx - 0.034364476799964905, miny + 0.02909626066684723, maxz - 0.053068459033966064),
+ (maxx - 0.03069065511226654, miny + 0.029144294559955597, maxz - 0.04727017134428024),
+ (maxx - 0.030408228747546673, miny + 0.029182862490415573, maxz - 0.04041174054145813),
+ (maxx - 0.03939127502962947, miny + 0.029195547103881836, maxz - 0.030656911432743073),
+ (minx + 0.03147818427532911, maxy - 0.033236272633075714, maxz - 0.03954096883535385),
+ (minx + 0.031206720508635044, maxy - 0.03327333927154541, maxz - 0.0461333692073822),
+ (minx + 0.034267837181687355, maxy - 0.033291369676589966, maxz - 0.05197836458683014),
+ (minx + 0.03984131896868348, maxy - 0.03328552842140198, maxz - 0.05550979822874069),
+ (maxx - 0.040582869900390506, maxy - 0.0332573801279068, maxz - 0.055781424045562744),
+ (maxx - 0.03473791852593422, maxy - 0.033214468508958817, maxz - 0.05272047221660614),
+ (maxx - 0.031206604093313217, maxy - 0.03316829353570938, maxz - 0.04714709520339966),
+ (maxx - 0.030935133807361126, maxy - 0.03313122317194939, maxz - 0.040554702281951904),
+ (maxx - 0.03399624954909086, maxy - 0.03311318904161453, maxz - 0.03470969945192337),
+ (maxx - 0.03956972947344184, maxy - 0.03311903029680252, maxz - 0.03117825835943222),
+ (minx + 0.04085446032695472, maxy - 0.0331471785902977, maxz - 0.03090662509202957),
+ (minx + 0.035009496845304966, maxy - 0.03319009393453598, maxz - 0.033967599272727966),
+ (maxx - 0.03939127502962947, miny + 0.0002205297350883484, maxz - 0.0343027338385582),
+ (maxx - 0.030408228747546673, miny + 0.007109262049198151, maxz - 0.04120940715074539),
+ (maxx - 0.03069065511226654, miny + 0.011931635439395905, maxz - 0.046086326241493225),
+ (maxx - 0.034364476799964905, miny + 0.01599767804145813, maxz - 0.050220295786857605),
+ (maxx - 0.04044530005194247, miny + 0.01821787655353546, maxz - 0.05250363051891327),
+ (minx + 0.033914451487362385, miny + 0.015395186841487885, maxz - 0.04973094165325165),
+ (minx + 0.03468604106456041, miny + 0.0022202134132385254, maxz - 0.03640696406364441),
+ (minx + 0.04076687735505402, miny, maxz - 0.03412361443042755),
+ (minx + 0.031012218445539474, miny + 0.006286241114139557, maxz - 0.040540941059589386),
+ (minx + 0.03072980046272278, miny + 0.011108621954917908, maxz - 0.04541786015033722),
+ (maxx - 0.03359287604689598, miny + 0.002822697162628174, maxz - 0.036896318197250366),
+ (minx + 0.03971285093575716, miny + 0.01799735426902771, maxz - 0.05232451856136322),
+ (minx + 0.0343002462759614, miny + 0.015705399215221405, minz + 0.10733164101839066),
+ (minx + 0.030871009454131126, miny + 0.011495128273963928, minz + 0.10745517536997795),
+ (minx + 0.030871009454131126, miny + 0.006645478308200836, minz + 0.1074824407696724),
+ (minx + 0.0343002462759614, miny + 0.0024559199810028076, minz + 0.10740615427494049),
+ (minx + 0.04023986402899027, miny + 4.902482032775879e-05, minz + 0.10724674165248871),
+ (maxx - 0.03991828765720129, miny + 6.973743438720703e-05, minz + 0.10704692453145981),
+ (maxx - 0.03397867642343044, miny + 0.0025124847888946533, minz + 0.10686022788286209),
+ (maxx - 0.030549442395567894, miny + 0.00672275573015213, minz + 0.1067366972565651),
+ (maxx - 0.030549442395567894, miny + 0.011572405695915222, minz + 0.10670943185687065),
+ (maxx - 0.03397867642343044, miny + 0.015761971473693848, minz + 0.10678572952747345),
+ (maxx - 0.03991828765720129, miny + 0.0181688591837883, minz + 0.10694513842463493),
+ (minx + 0.04023986402899027, miny + 0.018148154020309448, minz + 0.10714496672153473)]
+
+ # Faces
+ myfaces = [(24, 0, 1), (24, 1, 2), (24, 2, 3), (24, 3, 4), (24, 4, 5),
+ (24, 5, 6), (24, 6, 7), (24, 7, 8), (24, 8, 9), (24, 9, 10),
+ (24, 10, 11), (11, 0, 24), (91, 12, 13, 93), (93, 13, 14, 94), (94, 14, 15, 92),
+ (92, 15, 16, 90), (90, 16, 17, 96), (96, 17, 18, 95), (95, 18, 19, 99), (99, 19, 20, 98),
+ (98, 20, 21, 101), (101, 21, 22, 97), (97, 22, 23, 100), (91, 0, 11, 100), (13, 12, 25, 26),
+ (14, 13, 26, 27), (15, 14, 27, 28), (16, 15, 28, 29), (17, 16, 29, 30), (18, 17, 30, 31),
+ (19, 18, 31, 32), (20, 19, 32, 33), (21, 20, 33, 34), (22, 21, 34, 35), (23, 22, 35, 36),
+ (12, 23, 36, 25), (25, 49, 50, 26), (49, 37, 38, 50), (26, 50, 51, 27), (50, 38, 39, 51),
+ (27, 51, 52, 28), (51, 39, 40, 52), (28, 52, 53, 29), (52, 40, 41, 53), (29, 53, 54, 30),
+ (53, 41, 42, 54), (30, 54, 55, 31), (54, 42, 43, 55), (31, 55, 56, 32), (55, 43, 44, 56),
+ (32, 56, 57, 33), (56, 44, 45, 57), (33, 57, 58, 34), (57, 45, 46, 58), (34, 58, 59, 35),
+ (58, 46, 47, 59), (35, 59, 60, 36), (59, 47, 48, 60), (36, 60, 49, 25), (60, 48, 37, 49),
+ (38, 37, 61, 62), (39, 38, 62, 63), (40, 39, 63, 64), (41, 40, 64, 65), (42, 41, 65, 66),
+ (43, 42, 66, 67), (44, 43, 67, 68), (45, 44, 68, 69), (46, 45, 69, 70), (47, 46, 70, 71),
+ (48, 47, 71, 72), (37, 48, 72, 61), (120, 109, 62, 61), (109, 110, 63, 62), (110, 111, 64, 63),
+ (111, 112, 65, 64), (112, 113, 66, 65), (113, 114, 67, 66), (114, 115, 68, 67), (115, 116, 69, 68),
+ (116, 117, 70, 69), (117, 118, 71, 70), (118, 119, 72, 71), (119, 120, 61, 72), (72, 89, 78, 61),
+ (63, 80, 81, 64), (67, 84, 85, 68), (64, 81, 82, 65), (61, 78, 79, 62), (69, 86, 87, 70),
+ (66, 83, 84, 67), (65, 82, 83, 66), (71, 88, 89, 72), (70, 87, 88, 71), (62, 79, 80, 63),
+ (68, 85, 86, 69), (0, 91, 93, 1), (1, 93, 94, 2), (2, 94, 92, 3), (3, 92, 90, 4),
+ (4, 90, 96, 5), (5, 96, 95, 6), (6, 95, 99, 7), (7, 99, 98, 8), (8, 98, 101, 9),
+ (9, 101, 97, 10), (10, 97, 100, 11), (12, 91, 100, 23), (104, 105, 114, 113), (105, 106, 115, 114),
+ (106, 107, 116, 115), (102, 76, 109, 120), (76, 75, 110, 109), (75, 103, 111, 110), (103, 73, 112, 111),
+ (73, 104, 113, 112), (107, 74, 117, 116), (74, 108, 118, 117), (108, 77, 119, 118), (77, 102, 120, 119),
+ (74, 107, 122, 131), (107, 106, 123, 122), (104, 73, 132, 125), (106, 105, 124, 123), (75, 76, 129, 130),
+ (73, 103, 126, 132), (105, 104, 125, 124), (102, 77, 128, 127), (103, 75, 130, 126), (77, 108, 121, 128),
+ (76, 102, 127, 129), (108, 74, 131, 121), (126, 130, 134, 133), (130, 129, 135, 134),
+ (129, 127, 136, 135),
+ (127, 128, 137, 136), (128, 121, 138, 137), (121, 131, 139, 138), (131, 122, 140, 139),
+ (122, 123, 141, 140),
+ (123, 124, 142, 141), (124, 125, 143, 142), (125, 132, 144, 143), (132, 126, 133, 144),
+ (169, 146, 145),
+ (169, 147, 146), (169, 148, 147), (169, 149, 148), (169, 150, 149), (169, 151, 150),
+ (169, 152, 151), (169, 153, 152), (169, 154, 153), (169, 155, 154), (169, 156, 155),
+ (156, 169, 145), (236, 238, 158, 157), (238, 239, 159, 158), (239, 237, 160, 159), (237, 235, 161, 160),
+ (235, 241, 162, 161), (241, 240, 163, 162), (240, 244, 164, 163), (244, 243, 165, 164),
+ (243, 246, 166, 165),
+ (246, 242, 167, 166), (242, 245, 168, 167), (236, 245, 156, 145), (158, 171, 170, 157),
+ (159, 172, 171, 158),
+ (160, 173, 172, 159), (161, 174, 173, 160), (162, 175, 174, 161), (163, 176, 175, 162),
+ (164, 177, 176, 163),
+ (165, 178, 177, 164), (166, 179, 178, 165), (167, 180, 179, 166), (168, 181, 180, 167),
+ (157, 170, 181, 168),
+ (170, 171, 195, 194), (194, 195, 183, 182), (171, 172, 196, 195), (195, 196, 184, 183),
+ (172, 173, 197, 196),
+ (196, 197, 185, 184), (173, 174, 198, 197), (197, 198, 186, 185), (174, 175, 199, 198),
+ (198, 199, 187, 186),
+ (175, 176, 200, 199), (199, 200, 188, 187), (176, 177, 201, 200), (200, 201, 189, 188),
+ (177, 178, 202, 201),
+ (201, 202, 190, 189), (178, 179, 203, 202), (202, 203, 191, 190), (179, 180, 204, 203),
+ (203, 204, 192, 191),
+ (180, 181, 205, 204), (204, 205, 193, 192), (181, 170, 194, 205), (205, 194, 182, 193),
+ (183, 207, 206, 182),
+ (184, 208, 207, 183), (185, 209, 208, 184), (186, 210, 209, 185), (187, 211, 210, 186),
+ (188, 212, 211, 187),
+ (189, 213, 212, 188), (190, 214, 213, 189), (191, 215, 214, 190), (192, 216, 215, 191),
+ (193, 217, 216, 192),
+ (182, 206, 217, 193), (265, 206, 207, 254), (254, 207, 208, 255), (255, 208, 209, 256),
+ (256, 209, 210, 257),
+ (257, 210, 211, 258), (258, 211, 212, 259), (259, 212, 213, 260), (260, 213, 214, 261),
+ (261, 214, 215, 262),
+ (262, 215, 216, 263), (263, 216, 217, 264), (264, 217, 206, 265), (217, 206, 223, 234),
+ (208, 209, 226, 225),
+ (212, 213, 230, 229), (209, 210, 227, 226), (206, 207, 224, 223), (214, 215, 232, 231),
+ (211, 212, 229, 228),
+ (210, 211, 228, 227), (216, 217, 234, 233), (215, 216, 233, 232), (207, 208, 225, 224),
+ (213, 214, 231, 230),
+ (145, 146, 238, 236), (146, 147, 239, 238), (147, 148, 237, 239), (148, 149, 235, 237),
+ (149, 150, 241, 235),
+ (150, 151, 240, 241), (151, 152, 244, 240), (152, 153, 243, 244), (153, 154, 246, 243),
+ (154, 155, 242, 246),
+ (155, 156, 245, 242), (157, 168, 245, 236), (249, 258, 259, 250), (250, 259, 260, 251),
+ (251, 260, 261, 252),
+ (247, 265, 254, 221), (221, 254, 255, 220), (220, 255, 256, 248), (248, 256, 257, 218),
+ (218, 257, 258, 249),
+ (252, 261, 262, 219), (219, 262, 263, 253), (253, 263, 264, 222), (222, 264, 265, 247),
+ (219, 276, 267, 252),
+ (252, 267, 268, 251), (249, 270, 277, 218), (251, 268, 269, 250), (220, 275, 274, 221),
+ (218, 277, 271, 248),
+ (250, 269, 270, 249), (247, 272, 273, 222), (248, 271, 275, 220), (222, 273, 266, 253),
+ (221, 274, 272, 247),
+ (253, 266, 276, 219), (271, 278, 279, 275), (275, 279, 280, 274), (274, 280, 281, 272),
+ (272, 281, 282, 273),
+ (273, 282, 283, 266), (266, 283, 284, 276), (276, 284, 285, 267), (267, 285, 286, 268),
+ (268, 286, 287, 269),
+ (269, 287, 288, 270), (270, 288, 289, 277), (277, 289, 278, 271)]
+
+ return myvertex, myfaces
diff --git a/archimesh/achm_gltools.py b/archimesh/achm_gltools.py
new file mode 100644
index 00000000..57eab974
--- /dev/null
+++ b/archimesh/achm_gltools.py
@@ -0,0 +1,696 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+# ----------------------------------------------------------
+# support routines for OpenGL
+# Author: Antonio Vazquez (antonioya)
+#
+# ----------------------------------------------------------
+# noinspection PyUnresolvedReferences
+import bpy
+# noinspection PyUnresolvedReferences
+import bgl
+# noinspection PyUnresolvedReferences
+import blf
+import math
+# noinspection PyUnresolvedReferences
+import mathutils
+# noinspection PyUnresolvedReferences
+from bpy_extras import view3d_utils
+from achm_room_maker import get_wall_points
+
+
+# -------------------------------------------------------------
+# Handle all draw routines (OpenGL main entry point)
+#
+# -------------------------------------------------------------
+def draw_main(context):
+ region = context.region
+ rv3d = context.space_data.region_3d
+ scene = context.scene
+
+ rgb = scene.archimesh_text_color
+ rgbw = scene.archimesh_walltext_color
+ fsize = scene.archimesh_font_size
+ wfsize = scene.archimesh_wfont_size
+ space = scene.archimesh_hint_space
+ measure = scene.archimesh_gl_measure
+ dspname = scene.archimesh_gl_name
+ # Get visible layers
+ layers = []
+ for x in range(0, 20):
+ if context.scene.layers[x] is True:
+ layers.extend([x])
+
+ bgl.glEnable(bgl.GL_BLEND)
+ # Display selected or all
+ if scene.archimesh_gl_ghost is False:
+ objlist = context.selected_objects
+ else:
+ objlist = context.scene.objects
+ # ---------------------------------------
+ # Generate all OpenGL calls
+ # ---------------------------------------
+ for myobj in objlist:
+ if myobj.hide is False:
+ # verify visible layer
+ for x in range(0, 20):
+ if myobj.layers[x] is True:
+ if x in layers:
+ # -----------------------------------------------------
+ # Rooms
+ # -----------------------------------------------------
+ if 'RoomGenerator' in myobj:
+ op = myobj.RoomGenerator[0]
+ draw_room_data(myobj, op, region, rv3d, rgb, rgbw, fsize, wfsize, space, measure, dspname)
+
+ # -----------------------------------------------------
+ # Doors
+ # -----------------------------------------------------
+ if 'DoorObjectGenerator' in myobj:
+ op = myobj.DoorObjectGenerator[0]
+ draw_door_data(myobj, op, region, rv3d, rgb, fsize, space, measure)
+
+ # -----------------------------------------------------
+ # Window (Rail)
+ # -----------------------------------------------------
+ if 'WindowObjectGenerator' in myobj:
+ op = myobj.WindowObjectGenerator[0]
+ draw_window_rail_data(myobj, op, region, rv3d, rgb, fsize, space, measure)
+
+ # -----------------------------------------------------
+ # Window (Panel)
+ # -----------------------------------------------------
+ if 'WindowPanelGenerator' in myobj:
+ op = myobj.WindowPanelGenerator[0]
+ draw_window_panel_data(myobj, op, region, rv3d, rgb, fsize, space, measure)
+ break # avoid unnecessary loops
+ # -----------------------
+ # restore opengl defaults
+ # -----------------------
+ bgl.glLineWidth(1)
+ bgl.glDisable(bgl.GL_BLEND)
+ bgl.glColor4f(0.0, 0.0, 0.0, 1.0)
+
+
+# -------------------------------------------------------------
+# Create OpenGL text
+#
+# right: Align to right
+# -------------------------------------------------------------
+def draw_text(x_pos, y_pos, display_text, rgb, fsize, right=False):
+ gap = 12
+ font_id = 0
+ blf.size(font_id, fsize, 72)
+
+ text_width, text_height = blf.dimensions(font_id, display_text)
+ if right is True:
+ newx = x_pos - text_width - gap
+ else:
+ newx = x_pos
+ blf.position(font_id, newx, y_pos, 0)
+ bgl.glColor4f(rgb[0], rgb[1], rgb[2], rgb[3])
+ blf.draw(font_id, display_text)
+ return
+
+
+# -------------------------------------------------------------
+# Draw an OpenGL line
+#
+# -------------------------------------------------------------
+def draw_line(v1, v2):
+ # noinspection PyBroadException
+ try:
+ if v1 is not None and v2 is not None:
+ bgl.glBegin(bgl.GL_LINES)
+ bgl.glVertex2f(*v1)
+ bgl.glVertex2f(*v2)
+ bgl.glEnd()
+ except:
+ pass
+
+
+# -------------------------------------------------------------
+# Draw room information
+#
+# rgb: Color
+# fsize: Font size
+# -------------------------------------------------------------
+def draw_room_data(myobj, op, region, rv3d, rgb, rgbw, fsize, wfsize, space, measure, dspname):
+
+ verts, activefaces, activenormals = get_wall_points(myobj)
+
+ # --------------------------
+ # Get line points and draw
+ # --------------------------
+ for face in activefaces:
+ a1 = None
+ b1 = None
+ a2 = None
+ b2 = None
+ # Bottom
+ for e in face:
+ if verts[e][2] == 0:
+ if a1 is None:
+ a1 = e
+ else:
+ b1 = e
+ # Top
+ for e in face:
+ if verts[e][2] != 0:
+ if verts[a1][0] == verts[e][0] and verts[a1][1] == verts[e][1]:
+ a2 = e
+ else:
+ b2 = e
+ # Points
+ # a1_p = get_point((verts[a1][0], verts[a1][1], verts[a1][2]), myobj) # bottom
+ a2_p = get_point((verts[a2][0], verts[a2][1], verts[a2][2] + space), myobj) # top
+ a2_s1 = get_point((verts[a2][0], verts[a2][1], verts[a2][2]), myobj) # vertical line
+ a2_s2 = get_point((verts[a2][0], verts[a2][1], verts[a2][2] + space + fsize / 200), myobj) # vertical line
+
+ # b1_p = get_point((verts[b1][0], verts[b1][1], verts[b1][2]), myobj) # bottom
+ b2_p = get_point((verts[b2][0], verts[b2][1], verts[b2][2] + space), myobj) # top
+ b2_s1 = get_point((verts[b2][0], verts[b2][1], verts[b2][2]), myobj) # vertical line
+ b2_s2 = get_point((verts[b2][0], verts[b2][1], verts[b2][2] + space + fsize / 200), myobj) # vertical line
+
+ # converting to screen coordinates
+ screen_point_a = view3d_utils.location_3d_to_region_2d(region, rv3d, a2_p)
+ screen_point_b = view3d_utils.location_3d_to_region_2d(region, rv3d, b2_p)
+ screen_point_a1 = view3d_utils.location_3d_to_region_2d(region, rv3d, a2_s1)
+ screen_point_b1 = view3d_utils.location_3d_to_region_2d(region, rv3d, b2_s1)
+ screen_point_a2 = view3d_utils.location_3d_to_region_2d(region, rv3d, a2_s2)
+ screen_point_b2 = view3d_utils.location_3d_to_region_2d(region, rv3d, b2_s2)
+
+ # colour + line setup
+ bgl.glEnable(bgl.GL_BLEND)
+ bgl.glLineWidth(1)
+ bgl.glColor4f(rgb[0], rgb[1], rgb[2], rgb[3])
+
+ # --------------------------------
+ # Measures
+ # --------------------------------
+ if measure is True:
+ # Draw text
+ dist = distance(a2_p, b2_p)
+ txtpoint3d = interpolate3d(a2_p, b2_p, math.fabs(dist / 2))
+ # add a gap
+ gap3d = (txtpoint3d[0], txtpoint3d[1], txtpoint3d[2] + 0.05)
+
+ txtpoint2d = view3d_utils.location_3d_to_region_2d(region, rv3d, gap3d)
+
+ draw_text(txtpoint2d[0], txtpoint2d[1], "%6.2f" % dist, rgb, fsize)
+
+ # Draw horizontal line
+ draw_line(screen_point_a, screen_point_b)
+ # Draw vertical line 1 (upper vertical)
+ draw_line(screen_point_a1, screen_point_a2)
+ # Draw vertical line 2 (upper vertical)
+ draw_line(screen_point_b1, screen_point_b2)
+ # Draw vertical line 1
+ draw_line(screen_point_a, screen_point_a1)
+ # Draw vertical line 2
+ draw_line(screen_point_b, screen_point_b1)
+
+ # --------------------------------
+ # Wall Number
+ # --------------------------------
+ if dspname is True:
+ for i in range(0, op.wall_num):
+ ap = get_point((op.walls[i].glpoint_a[0], op.walls[i].glpoint_a[1], op.walls[i].glpoint_a[2]), myobj)
+ bp = get_point((op.walls[i].glpoint_b[0], op.walls[i].glpoint_b[1], op.walls[i].glpoint_b[2]), myobj)
+
+ dist = distance(ap, bp)
+ txtpoint3d = interpolate3d(ap, bp, math.fabs(dist / 2))
+ # add a gap
+ gap3d = (txtpoint3d[0], txtpoint3d[1], txtpoint3d[2]) # + op.room_height / 2)
+ txtpoint2d = view3d_utils.location_3d_to_region_2d(region, rv3d, gap3d)
+ txt = "Wall: "
+ if op.walls[i].a is True:
+ txt = "Advance: "
+ if op.walls[i].curved is True:
+ txt = "Curved: "
+
+ draw_text(txtpoint2d[0], txtpoint2d[1], txt + str(i + 1), rgbw, wfsize)
+
+ return
+
+
+# -------------------------------------------------------------
+# Draw door information
+#
+# rgb: Color
+# fsize: Font size
+# -------------------------------------------------------------
+def draw_door_data(myobj, op, region, rv3d, rgb, fsize, space, measure):
+
+ # Points
+ a_p1 = get_point(op.glpoint_a, myobj)
+ a_p2 = get_point((op.glpoint_a[0] - space, op.glpoint_a[1], op.glpoint_a[2]), myobj)
+ a_p3 = get_point((op.glpoint_a[0] - space - fsize / 200, op.glpoint_a[1], op.glpoint_a[2]), myobj)
+
+ t_p1 = get_point(op.glpoint_b, myobj)
+ t_p2 = get_point((op.glpoint_b[0] - space, op.glpoint_b[1], op.glpoint_b[2]), myobj)
+ t_p3 = get_point((op.glpoint_b[0] - space - fsize / 200, op.glpoint_b[1], op.glpoint_b[2]), myobj)
+
+ b_p1 = get_point(op.glpoint_b, myobj)
+ b_p2 = get_point((op.glpoint_b[0], op.glpoint_b[1], op.glpoint_b[2] + space), myobj)
+ b_p3 = get_point((op.glpoint_b[0], op.glpoint_b[1], op.glpoint_b[2] + space + fsize / 200), myobj)
+
+ c_p1 = get_point(op.glpoint_c, myobj)
+ c_p2 = get_point((op.glpoint_c[0], op.glpoint_c[1], op.glpoint_c[2] + space), myobj)
+ c_p3 = get_point((op.glpoint_c[0], op.glpoint_c[1], op.glpoint_c[2] + space + fsize / 200), myobj)
+
+ d_p1 = get_point(op.glpoint_d, myobj)
+ d_p2 = get_point((op.glpoint_d[0], op.glpoint_d[1], op.glpoint_b[2] + space + fsize / 300), myobj)
+ d_p3 = get_point((op.glpoint_d[0], op.glpoint_d[1], op.glpoint_d[2] - fsize / 250), myobj)
+
+ e_p1 = get_point(op.glpoint_e, myobj)
+ e_p2 = get_point((op.glpoint_e[0], op.glpoint_e[1], op.glpoint_b[2] + space + fsize / 300), myobj)
+ e_p3 = get_point((op.glpoint_e[0], op.glpoint_e[1], op.glpoint_e[2] - fsize / 250), myobj)
+
+ # converting to screen coordinates
+ screen_point_ap1 = view3d_utils.location_3d_to_region_2d(region, rv3d, a_p1)
+ screen_point_bp1 = view3d_utils.location_3d_to_region_2d(region, rv3d, b_p1)
+ screen_point_cp1 = view3d_utils.location_3d_to_region_2d(region, rv3d, c_p1)
+ screen_point_tp1 = view3d_utils.location_3d_to_region_2d(region, rv3d, t_p1)
+
+ screen_point_ap2 = view3d_utils.location_3d_to_region_2d(region, rv3d, a_p2)
+ screen_point_bp2 = view3d_utils.location_3d_to_region_2d(region, rv3d, b_p2)
+ screen_point_cp2 = view3d_utils.location_3d_to_region_2d(region, rv3d, c_p2)
+ screen_point_tp2 = view3d_utils.location_3d_to_region_2d(region, rv3d, t_p2)
+
+ screen_point_ap3 = view3d_utils.location_3d_to_region_2d(region, rv3d, a_p3)
+ screen_point_bp3 = view3d_utils.location_3d_to_region_2d(region, rv3d, b_p3)
+ screen_point_cp3 = view3d_utils.location_3d_to_region_2d(region, rv3d, c_p3)
+ screen_point_tp3 = view3d_utils.location_3d_to_region_2d(region, rv3d, t_p3)
+
+ screen_point_dp1 = view3d_utils.location_3d_to_region_2d(region, rv3d, d_p1)
+ screen_point_dp2 = view3d_utils.location_3d_to_region_2d(region, rv3d, d_p2)
+ screen_point_dp3 = view3d_utils.location_3d_to_region_2d(region, rv3d, d_p3)
+
+ screen_point_ep1 = view3d_utils.location_3d_to_region_2d(region, rv3d, e_p1)
+ screen_point_ep2 = view3d_utils.location_3d_to_region_2d(region, rv3d, e_p2)
+ screen_point_ep3 = view3d_utils.location_3d_to_region_2d(region, rv3d, e_p3)
+
+ # colour + line setup
+ bgl.glEnable(bgl.GL_BLEND)
+ bgl.glLineWidth(1)
+ bgl.glColor4f(rgb[0], rgb[1], rgb[2], rgb[3])
+
+ # --------------------------------
+ # Measures
+ # --------------------------------
+ if measure is True:
+ # Vertical
+ dist = distance(a_p1, t_p1)
+ txtpoint3d = interpolate3d(a_p1, t_p1, math.fabs(dist / 2))
+ gap3d = (a_p2[0], txtpoint3d[1], txtpoint3d[2])
+ txtpoint2d = view3d_utils.location_3d_to_region_2d(region, rv3d, gap3d)
+ draw_text(txtpoint2d[0], txtpoint2d[1], "%6.2f" % dist, rgb, fsize, True)
+
+ draw_line(screen_point_ap2, screen_point_tp2)
+ draw_line(screen_point_ap3, screen_point_ap1)
+ draw_line(screen_point_tp3, screen_point_tp1)
+
+ # Horizontal
+ dist = distance(b_p1, c_p1)
+ txtpoint3d = interpolate3d(b_p1, c_p1, math.fabs(dist / 2))
+ gap3d = (txtpoint3d[0], txtpoint3d[1], b_p2[2] + 0.02)
+ txtpoint2d = view3d_utils.location_3d_to_region_2d(region, rv3d, gap3d)
+ draw_text(txtpoint2d[0], txtpoint2d[1], "%6.2f" % dist, rgb, fsize)
+
+ draw_line(screen_point_bp2, screen_point_cp2)
+ draw_line(screen_point_bp3, screen_point_bp1)
+ draw_line(screen_point_cp3, screen_point_cp1)
+
+ # Door size
+ dist = distance(d_p1, e_p1)
+ txtpoint3d = interpolate3d(d_p1, e_p1, math.fabs(dist / 2))
+ gap3d = (txtpoint3d[0], txtpoint3d[1], txtpoint3d[2] + 0.02)
+ txtpoint2d = view3d_utils.location_3d_to_region_2d(region, rv3d, gap3d)
+ draw_text(txtpoint2d[0], txtpoint2d[1], "%6.2f" % dist, rgb, fsize)
+
+ draw_line(screen_point_dp1, screen_point_ep1)
+ draw_line(screen_point_dp2, screen_point_dp3)
+ draw_line(screen_point_ep2, screen_point_ep3)
+ return
+
+
+# -------------------------------------------------------------
+# Draw window rail information
+#
+# rgb: Color
+# fsize: Font size
+# -------------------------------------------------------------
+def draw_window_rail_data(myobj, op, region, rv3d, rgb, fsize, space, measure):
+
+ # Points
+ a_p1 = get_point(op.glpoint_a, myobj)
+ a_p2 = get_point((op.glpoint_a[0] - space, op.glpoint_a[1], op.glpoint_a[2]), myobj)
+ a_p3 = get_point((op.glpoint_a[0] - space - fsize / 200, op.glpoint_a[1], op.glpoint_a[2]), myobj)
+
+ t_p1 = get_point(op.glpoint_b, myobj)
+ t_p2 = get_point((op.glpoint_b[0] - space, op.glpoint_b[1], op.glpoint_b[2]), myobj)
+ t_p3 = get_point((op.glpoint_b[0] - space - fsize / 200, op.glpoint_b[1], op.glpoint_b[2]), myobj)
+
+ b_p1 = get_point(op.glpoint_b, myobj)
+ b_p2 = get_point((op.glpoint_b[0], op.glpoint_b[1], op.glpoint_b[2] + space), myobj)
+ b_p3 = get_point((op.glpoint_b[0], op.glpoint_b[1], op.glpoint_b[2] + space + fsize / 200), myobj)
+
+ c_p1 = get_point(op.glpoint_c, myobj)
+ c_p2 = get_point((op.glpoint_c[0], op.glpoint_c[1], op.glpoint_c[2] + space), myobj)
+ c_p3 = get_point((op.glpoint_c[0], op.glpoint_c[1], op.glpoint_c[2] + space + fsize / 200), myobj)
+
+ # converting to screen coordinates
+ screen_point_ap1 = view3d_utils.location_3d_to_region_2d(region, rv3d, a_p1)
+ screen_point_bp1 = view3d_utils.location_3d_to_region_2d(region, rv3d, b_p1)
+ screen_point_cp1 = view3d_utils.location_3d_to_region_2d(region, rv3d, c_p1)
+ screen_point_tp1 = view3d_utils.location_3d_to_region_2d(region, rv3d, t_p1)
+
+ screen_point_ap2 = view3d_utils.location_3d_to_region_2d(region, rv3d, a_p2)
+ screen_point_bp2 = view3d_utils.location_3d_to_region_2d(region, rv3d, b_p2)
+ screen_point_cp2 = view3d_utils.location_3d_to_region_2d(region, rv3d, c_p2)
+ screen_point_tp2 = view3d_utils.location_3d_to_region_2d(region, rv3d, t_p2)
+
+ screen_point_ap3 = view3d_utils.location_3d_to_region_2d(region, rv3d, a_p3)
+ screen_point_bp3 = view3d_utils.location_3d_to_region_2d(region, rv3d, b_p3)
+ screen_point_cp3 = view3d_utils.location_3d_to_region_2d(region, rv3d, c_p3)
+ screen_point_tp3 = view3d_utils.location_3d_to_region_2d(region, rv3d, t_p3)
+
+ # colour + line setup
+ bgl.glEnable(bgl.GL_BLEND)
+ bgl.glLineWidth(1)
+ bgl.glColor4f(rgb[0], rgb[1], rgb[2], rgb[3])
+
+ # --------------------------------
+ # Measures
+ # --------------------------------
+ if measure is True:
+ # Vertical
+ dist = distance(a_p1, t_p1)
+ txtpoint3d = interpolate3d(a_p1, t_p1, math.fabs(dist / 2))
+ gap3d = (a_p2[0], txtpoint3d[1], txtpoint3d[2])
+ txtpoint2d = view3d_utils.location_3d_to_region_2d(region, rv3d, gap3d)
+ draw_text(txtpoint2d[0], txtpoint2d[1], "%6.2f" % dist, rgb, fsize, True)
+
+ draw_line(screen_point_ap2, screen_point_tp2)
+ draw_line(screen_point_ap3, screen_point_ap1)
+ draw_line(screen_point_tp3, screen_point_tp1)
+
+ # Horizontal
+ dist = distance(b_p1, c_p1)
+ txtpoint3d = interpolate3d(b_p1, c_p1, math.fabs(dist / 2))
+ gap3d = (txtpoint3d[0], txtpoint3d[1], b_p2[2] + 0.02)
+ txtpoint2d = view3d_utils.location_3d_to_region_2d(region, rv3d, gap3d)
+ draw_text(txtpoint2d[0], txtpoint2d[1], "%6.2f" % dist, rgb, fsize)
+
+ draw_line(screen_point_bp2, screen_point_cp2)
+ draw_line(screen_point_bp3, screen_point_bp1)
+ draw_line(screen_point_cp3, screen_point_cp1)
+
+ return
+
+
+# -------------------------------------------------------------
+# Draw window panel information
+#
+# rgb: Color
+# fsize: Font size
+# -------------------------------------------------------------
+def draw_window_panel_data(myobj, op, region, rv3d, rgb, fsize, space, measure):
+
+ # Points
+ a_p1 = get_point(op.glpoint_a, myobj)
+ a_p2 = get_point((op.glpoint_a[0] - space, op.glpoint_a[1], op.glpoint_a[2]), myobj)
+ a_p3 = get_point((op.glpoint_a[0] - space - fsize / 200, op.glpoint_a[1], op.glpoint_a[2]), myobj)
+
+ f_p1 = get_point((op.glpoint_c[0], op.glpoint_c[1], op.glpoint_a[2]), myobj)
+ f_p2 = get_point((op.glpoint_c[0] + space, op.glpoint_c[1], op.glpoint_a[2]), myobj)
+ f_p3 = get_point((op.glpoint_c[0] + space + fsize / 200, op.glpoint_c[1], op.glpoint_a[2]), myobj)
+
+ t_p1 = get_point(op.glpoint_b, myobj)
+ t_p2 = get_point((op.glpoint_b[0] - space, op.glpoint_b[1], op.glpoint_b[2]), myobj)
+ t_p3 = get_point((op.glpoint_b[0] - space - fsize / 200, op.glpoint_b[1], op.glpoint_b[2]), myobj)
+
+ b_p1 = get_point(op.glpoint_b, myobj)
+ b_p2 = get_point((op.glpoint_b[0], op.glpoint_b[1], op.glpoint_b[2] + space), myobj)
+ b_p3 = get_point((op.glpoint_b[0], op.glpoint_b[1], op.glpoint_b[2] + space + fsize / 200), myobj)
+
+ c_p1 = get_point(op.glpoint_c, myobj)
+ c_p2 = get_point((op.glpoint_c[0], op.glpoint_c[1], op.glpoint_c[2] + space), myobj)
+ c_p3 = get_point((op.glpoint_c[0], op.glpoint_c[1], op.glpoint_c[2] + space + fsize / 200), myobj)
+
+ d_p1 = get_point(op.glpoint_c, myobj)
+ d_p2 = get_point((op.glpoint_c[0] + space, op.glpoint_c[1], op.glpoint_c[2]), myobj)
+ d_p3 = get_point((op.glpoint_c[0] + space + fsize / 200, op.glpoint_c[1], op.glpoint_c[2]), myobj)
+
+ g_p2 = get_point((op.glpoint_d[0], op.glpoint_d[1], 0), myobj)
+ g_p3 = get_point((op.glpoint_d[0], op.glpoint_d[1], op.glpoint_d[2]), myobj)
+ g_p4 = get_point((op.glpoint_d[0], op.glpoint_d[1], op.glpoint_d[2] + space), myobj)
+ g_p5 = get_point((op.glpoint_d[0], op.glpoint_d[1], op.glpoint_d[2] + space + fsize / 200), myobj)
+
+ h_p1 = get_point((op.glpoint_a[0], op.glpoint_a[1], op.glpoint_a[2] - space), myobj)
+ h_p2 = get_point((op.glpoint_a[0], op.glpoint_a[1], op.glpoint_a[2] - space - fsize / 200), myobj)
+
+ h_p3 = get_point((op.glpoint_c[0], op.glpoint_a[1], op.glpoint_a[2]), myobj)
+ h_p4 = get_point((op.glpoint_c[0], op.glpoint_a[1], op.glpoint_a[2] - space), myobj)
+ h_p5 = get_point((op.glpoint_c[0], op.glpoint_a[1], op.glpoint_a[2] - space - fsize / 200), myobj)
+
+ # converting to screen coordinates
+ screen_point_ap1 = view3d_utils.location_3d_to_region_2d(region, rv3d, a_p1)
+ screen_point_bp1 = view3d_utils.location_3d_to_region_2d(region, rv3d, b_p1)
+ screen_point_cp1 = view3d_utils.location_3d_to_region_2d(region, rv3d, c_p1)
+ screen_point_tp1 = view3d_utils.location_3d_to_region_2d(region, rv3d, t_p1)
+
+ screen_point_ap2 = view3d_utils.location_3d_to_region_2d(region, rv3d, a_p2)
+ screen_point_bp2 = view3d_utils.location_3d_to_region_2d(region, rv3d, b_p2)
+ screen_point_cp2 = view3d_utils.location_3d_to_region_2d(region, rv3d, c_p2)
+ screen_point_tp2 = view3d_utils.location_3d_to_region_2d(region, rv3d, t_p2)
+
+ screen_point_ap3 = view3d_utils.location_3d_to_region_2d(region, rv3d, a_p3)
+ screen_point_bp3 = view3d_utils.location_3d_to_region_2d(region, rv3d, b_p3)
+ screen_point_cp3 = view3d_utils.location_3d_to_region_2d(region, rv3d, c_p3)
+ screen_point_tp3 = view3d_utils.location_3d_to_region_2d(region, rv3d, t_p3)
+
+ screen_point_dp1 = view3d_utils.location_3d_to_region_2d(region, rv3d, d_p1)
+ screen_point_dp2 = view3d_utils.location_3d_to_region_2d(region, rv3d, d_p2)
+ screen_point_dp3 = view3d_utils.location_3d_to_region_2d(region, rv3d, d_p3)
+
+ screen_point_fp1 = view3d_utils.location_3d_to_region_2d(region, rv3d, f_p1)
+ screen_point_fp2 = view3d_utils.location_3d_to_region_2d(region, rv3d, f_p2)
+ screen_point_fp3 = view3d_utils.location_3d_to_region_2d(region, rv3d, f_p3)
+
+ screen_point_gp2 = view3d_utils.location_3d_to_region_2d(region, rv3d, g_p2)
+ screen_point_gp3 = view3d_utils.location_3d_to_region_2d(region, rv3d, g_p3)
+ screen_point_gp4 = view3d_utils.location_3d_to_region_2d(region, rv3d, g_p4)
+ screen_point_gp5 = view3d_utils.location_3d_to_region_2d(region, rv3d, g_p5)
+ # colour + line setup
+ bgl.glEnable(bgl.GL_BLEND)
+ bgl.glLineWidth(1)
+ bgl.glColor4f(rgb[0], rgb[1], rgb[2], rgb[3])
+
+ # --------------------------------
+ # Measures
+ # --------------------------------
+ if measure is True:
+ # Vertical (right)
+ dist = distance(a_p1, t_p1)
+ txtpoint3d = interpolate3d(a_p1, t_p1, math.fabs(dist / 2))
+ gap3d = (a_p2[0], txtpoint3d[1], txtpoint3d[2])
+ txtpoint2d = view3d_utils.location_3d_to_region_2d(region, rv3d, gap3d)
+ draw_text(txtpoint2d[0], txtpoint2d[1], "%6.2f" % dist, rgb, fsize, True)
+
+ draw_line(screen_point_ap2, screen_point_tp2)
+ draw_line(screen_point_ap3, screen_point_ap1)
+ draw_line(screen_point_tp3, screen_point_tp1)
+
+ # Vertical (Left)
+ dist = distance(f_p1, d_p1)
+ txtpoint3d = interpolate3d(f_p1, d_p1, math.fabs(dist / 2))
+ gap3d = (f_p2[0], txtpoint3d[1], txtpoint3d[2])
+ txtpoint2d = view3d_utils.location_3d_to_region_2d(region, rv3d, gap3d)
+ draw_text(txtpoint2d[0], txtpoint2d[1], "%6.2f" % dist, rgb, fsize)
+
+ draw_line(screen_point_fp2, screen_point_dp2)
+ draw_line(screen_point_fp1, screen_point_fp3)
+ draw_line(screen_point_dp1, screen_point_dp3)
+
+ # Horizontal (not triangle nor arch)
+ if op.UST != "4" and op.UST != "2":
+ dist = distance(b_p1, c_p1)
+ txtpoint3d = interpolate3d(b_p2, c_p2, math.fabs(dist / 2))
+ gap3d = (txtpoint3d[0], txtpoint3d[1], txtpoint3d[2] + 0.05)
+ txtpoint2d = view3d_utils.location_3d_to_region_2d(region, rv3d, gap3d)
+ draw_text(txtpoint2d[0], txtpoint2d[1], "%6.2f" % dist, rgb, fsize)
+
+ draw_line(screen_point_bp2, screen_point_cp2)
+ draw_line(screen_point_bp3, screen_point_bp1)
+ draw_line(screen_point_cp3, screen_point_cp1)
+ else:
+ dist = distance(b_p1, g_p3)
+ txtpoint3d = interpolate3d(b_p2, g_p4, math.fabs(dist / 2))
+ gap3d = (txtpoint3d[0], txtpoint3d[1], txtpoint3d[2] + 0.05)
+ txtpoint2d = view3d_utils.location_3d_to_region_2d(region, rv3d, gap3d)
+ draw_text(txtpoint2d[0], txtpoint2d[1], "%6.2f" % dist, rgb, fsize, True)
+
+ dist = distance(g_p3, c_p1)
+ txtpoint3d = interpolate3d(g_p4, c_p2, math.fabs(dist / 2))
+ gap3d = (txtpoint3d[0], txtpoint3d[1], txtpoint3d[2] + 0.05)
+ txtpoint2d = view3d_utils.location_3d_to_region_2d(region, rv3d, gap3d)
+ draw_text(txtpoint2d[0], txtpoint2d[1], "%6.2f" % dist, rgb, fsize)
+
+ draw_line(screen_point_bp2, screen_point_gp4)
+ draw_line(screen_point_gp4, screen_point_cp2)
+ draw_line(screen_point_bp3, screen_point_bp1)
+ draw_line(screen_point_cp3, screen_point_cp1)
+ draw_line(screen_point_gp3, screen_point_gp5)
+
+ # Only for Triangle or arch
+ if op.UST == "2" or op.UST == "4":
+ dist = distance(g_p2, g_p3)
+ txtpoint3d = interpolate3d(g_p2, g_p3, math.fabs(dist / 2))
+ gap3d = (txtpoint3d[0] + 0.05, txtpoint3d[1], txtpoint3d[2])
+ txtpoint2d = view3d_utils.location_3d_to_region_2d(region, rv3d, gap3d)
+ draw_text(txtpoint2d[0], txtpoint2d[1], "%6.2f" % dist, rgb, fsize)
+
+ draw_line(screen_point_gp2, screen_point_gp3)
+
+ # Only for Triangle and Inclines or arch
+ if op.UST == "3" or op.UST == "4" or op.UST == "2":
+ screen_point_hp1 = view3d_utils.location_3d_to_region_2d(region, rv3d, h_p1)
+ screen_point_hp2 = view3d_utils.location_3d_to_region_2d(region, rv3d, h_p2)
+ screen_point_hp3 = view3d_utils.location_3d_to_region_2d(region, rv3d, h_p3)
+ screen_point_hp4 = view3d_utils.location_3d_to_region_2d(region, rv3d, h_p4)
+ screen_point_hp5 = view3d_utils.location_3d_to_region_2d(region, rv3d, h_p5)
+
+ dist = distance(h_p1, h_p3)
+ txtpoint3d = interpolate3d(h_p1, h_p3, math.fabs(dist / 2))
+ gap3d = (txtpoint3d[0], txtpoint3d[1], txtpoint3d[2] - space - 0.05)
+ txtpoint2d = view3d_utils.location_3d_to_region_2d(region, rv3d, gap3d)
+ draw_text(txtpoint2d[0], txtpoint2d[1], "%6.2f" % dist, rgb, fsize)
+
+ draw_line(screen_point_ap1, screen_point_hp2)
+ draw_line(screen_point_hp3, screen_point_hp5)
+ draw_line(screen_point_hp1, screen_point_hp4)
+
+ return
+
+
+# --------------------------------------------------------------------
+# Distance between 2 points in 3D space
+# v1: first point
+# v2: second point
+# return: distance
+# --------------------------------------------------------------------
+def distance(v1, v2):
+ return math.sqrt((v2[0] - v1[0]) ** 2 + (v2[1] - v1[1]) ** 2 + (v2[2] - v1[2]) ** 2)
+
+
+# --------------------------------------------------------------------
+# Interpolate 2 points in 3D space
+# v1: first point
+# v2: second point
+# d1: distance
+# return: interpolate point
+# --------------------------------------------------------------------
+def interpolate3d(v1, v2, d1):
+ # calculate vector
+ v = (v2[0] - v1[0], v2[1] - v1[1], v2[2] - v1[2])
+ # calculate distance between points
+ d0 = distance(v1, v2)
+ # calculate interpolate factor (distance from origin / distance total)
+ # if d1 > d0, the point is projected in 3D space
+ if d0 > 0:
+ x = d1 / d0
+ else:
+ x = d1
+
+ final = (v1[0] + (v[0] * x), v1[1] + (v[1] * x), v1[2] + (v[2] * x))
+ return final
+
+
+# --------------------------------------------------------------------
+# Get point rotated and relative to parent
+# v1: point
+# mainobject
+# --------------------------------------------------------------------
+def get_point(v1, mainobject):
+
+ # Using World Matrix
+ vt = mathutils.Vector((v1[0], v1[1], v1[2], 1))
+ m4 = mainobject.matrix_world
+ vt2 = m4 * vt
+ v2 = [vt2[0], vt2[1], vt2[2]]
+
+ return v2
+
+
+# --------------------------------------------------------------------
+# rotate point EULER X
+# v1: point
+# rad: Angles of rotation in Radians
+# --------------------------------------------------------------------
+def rotate_x(v1, rot):
+ v2 = [0, 0, 0]
+
+ radx = rot[0]
+
+ # X axis
+ v2[0] = v1[0]
+ v2[1] = v1[1] * math.cos(radx) - v1[2] * math.sin(radx)
+ v2[2] = v1[1] * math.sin(radx) + v1[2] * math.cos(radx)
+
+ return v2
+
+
+# --------------------------------------------------------------------
+# rotate point EULER Y
+# v1: point
+# rad: Angles of rotation in Radians
+# --------------------------------------------------------------------
+def rotate_y(v1, rot):
+ v2 = [0, 0, 0]
+
+ rady = rot[1]
+
+ # Y axis
+ v2[0] = v1[0] * math.cos(rady) + v1[2] * math.sin(rady)
+ v2[1] = v1[1]
+ v2[2] = v1[2] * math.cos(rady) - v1[0] * math.sin(rady)
+
+ return v2
+
+
+# --------------------------------------------------------------------
+# rotate point EULER Z
+# v1: point
+# rad: Angles of rotation in Radians
+# --------------------------------------------------------------------
+def rotate_z(v1, rot):
+ v2 = [0, 0, 0]
+
+ radz = rot[2]
+
+ # Z axis
+ v2[0] = v1[0] * math.cos(radz) - v1[1] * math.sin(radz)
+ v2[1] = v1[0] * math.sin(radz) + v1[1] * math.cos(radz)
+ v2[2] = v1[2]
+
+ return v2
diff --git a/archimesh/achm_kitchen_maker.py b/archimesh/achm_kitchen_maker.py
new file mode 100644
index 00000000..bad0de5c
--- /dev/null
+++ b/archimesh/achm_kitchen_maker.py
@@ -0,0 +1,2614 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+# ----------------------------------------------------------
+# Automatic generation of kitchen cabinet
+# Author: Antonio Vazquez (antonioya)
+#
+# ----------------------------------------------------------
+import bpy
+import math
+import copy
+import sys
+import datetime
+import time
+from achm_tools import *
+from bpy_extras.io_utils import ExportHelper
+
+# ----------------------------------------------------------
+# Define rotation types
+# ----------------------------------------------------------
+RotationType_Default = 9
+RotationType_R90CW = 1
+RotationType_R90CCW = 2
+RotationType_R180 = 3
+
+
+# ----------------------------------------------------------
+# Export menu UI
+# ----------------------------------------------------------
+class AchmExportInventory(bpy.types.Operator, ExportHelper):
+ bl_idname = "io_export.kitchen_inventory"
+ bl_description = 'Export kitchen inventory (.txt)'
+ bl_category = 'Archimesh'
+ bl_label = "Export"
+
+ # From ExportHelper. Filter filenames.
+ filename_ext = ".txt"
+ filter_glob = bpy.props.StringProperty(
+ default="*.txt",
+ options={'HIDDEN'},
+ )
+
+ filepath = bpy.props.StringProperty(
+ name="File Path",
+ description="File path used for exporting room data file",
+ maxlen=1024, default="",
+ )
+
+# ----------------------------------------------------------
+# Execute
+# ----------------------------------------------------------
+ # noinspection PyUnusedLocal
+ def execute(self, context):
+ # noinspection PyBroadException
+ try:
+ # -------------------------------
+ # extract path and filename
+ # -------------------------------
+ (filepath, filename) = os.path.split(self.properties.filepath)
+ print('Exporting %s' % filename)
+ # -------------------------------
+ # Open output file
+ # -------------------------------
+ realpath = os.path.realpath(os.path.expanduser(self.properties.filepath))
+ fout = open(realpath, 'w')
+
+ st = datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S')
+ fout.write("# Archimesh kitchen inventory\n")
+ fout.write("# " + st + "\n")
+ mylist = getinventory()
+ for e in mylist:
+ fout.write(e + "\n")
+
+ fout.close()
+ self.report({'INFO'}, realpath + "successfully exported")
+ except:
+ e = sys.exc_info()[0]
+ self.report({'ERROR'}, "Unable to export inventory " + e)
+
+ return {'FINISHED'}
+
+
+# ----------------------------------------------------------
+# Generate inventory list
+# ----------------------------------------------------------
+def getinventory():
+ # Get List of boxes in the scene
+ unitobj = []
+ for obj in bpy.context.scene.objects:
+ # noinspection PyBroadException
+ try:
+ if obj["archimesh.sku"] is not None:
+ unitobj.extend([obj["archimesh.sku"]])
+ except:
+ pass
+ # ----------------------------------------
+ # Get number of unit structures (boxes)
+ # ----------------------------------------
+ boxes = []
+ boxestot = []
+ for u in unitobj:
+ key = u[:1] + u[8:28]
+ if key not in boxes:
+ boxes.extend([key])
+ boxestot.extend([1])
+ else:
+ x = boxes.index(key)
+ boxestot[x] += 1
+ # ----------------------------------------
+ # Get number of doors and drawer fronts
+ # ----------------------------------------
+ door = []
+ doortot = []
+ handles = 0
+ for u in unitobj:
+ if u[1:2] != "W":
+ w = float(u[36:42])
+ key = u[1:2] + "%06.3f" % w + u[22:28]
+ else: # Drawers
+ # calculate separation
+ sz = float(u[22:28])
+ gap = 0.001
+ dist = sz - (gap * int(u[2:4]))
+ space = dist / int(u[2:4])
+ key = u[1:2] + u[8:15] + "%06.3f" % space
+
+ n = int(u[2:4])
+ # handles
+ if u[4:5] == "1":
+ handles += n
+ if key not in door:
+ door.extend([key])
+ doortot.extend([n])
+ else:
+ x = door.index(key)
+ doortot[x] += n
+ # ----------------------------------------
+ # Get number of Shelves
+ # ----------------------------------------
+ shelves = []
+ shelvestot = []
+ for u in unitobj:
+ if int(u[5:7]) > 0:
+ w = float(u[8:14])
+ n = int(u[5:7])
+ th = float(u[29:35])
+
+ key = "%0.2f x %0.2f x %0.3f" % (w - (th * 2), float(u[15:21]) - th, th) # subtract board thickness
+
+ if key not in shelves:
+ shelves.extend([key])
+ shelvestot.extend([n])
+ else:
+ x = shelves.index(key)
+ shelvestot[x] += n
+
+ # ----------------------------------------
+ # Get Countertop size
+ # "T%06.3fx%06.3fx%06.3f-%06.3f"
+ # ----------------------------------------
+ t = 0
+ z = 0
+ for obj in bpy.context.scene.objects:
+ # noinspection PyBroadException
+ try:
+ if obj["archimesh.top_sku"] is not None:
+ u = obj["archimesh.top_sku"]
+ t += float(u[1:7])
+ z += float(u[22:28])
+ except:
+ pass
+
+ # ----------------------------------------
+ # Get Baseboard size
+ # ----------------------------------------
+ b = 0
+ btxt = None
+ for obj in bpy.context.scene.objects:
+ # noinspection PyBroadException
+ try:
+ if obj["archimesh.base_sku"] is not None:
+ u = obj["archimesh.base_sku"]
+ b += float(u[1:6])
+ btxt = "%0.3f x %0.3f" % (float(u[8:14]), float(u[15:21]))
+ except:
+ pass
+
+ # ----------------------------------------
+ # Prepare output data
+ # ----------------------------------------
+ output = []
+ output.extend(["Units\tDescription\tDimensions"])
+ for i in range(0, len(boxes)):
+ if boxes[i][:1] == "F":
+ typ = "Floor unit\t"
+ else:
+ typ = "Wall unit\t"
+
+ txt = "%0.2f x %0.2f x %0.2f" % (float(boxes[i][1:7]), float(boxes[i][8:14]), float(boxes[i][15:21]))
+ output.extend([str(boxestot[i]) + "\t" + typ + txt])
+
+ for i in range(0, len(door)):
+ if door[i][:1] == "D" or door[i][:1] == "L":
+ typ = "Solid door\t"
+ elif door[i][:1] == "G":
+ typ = "Glass door\t"
+ elif door[i][:1] == "W":
+ typ = "Drawer front\t"
+ else:
+ typ = "????\t"
+
+ txt = "%0.3f x %0.3f" % (float(door[i][1:7]), float(door[i][8:14]))
+ output.extend([str(doortot[i]) + "\t" + typ + txt])
+
+ for i in range(0, len(shelves)):
+ output.extend([str(shelvestot[i]) + "\tShelf\t" + shelves[i]])
+
+ output.extend([str(handles) + "\tHandle"])
+ if t > 0:
+ output.extend([str(round(t, 2)) + "\tCountertop (linear length)"])
+ if z > 0:
+ output.extend([str(round(z, 2)) + "\tCountertop wall piece(linear length)"])
+ if b > 0:
+ output.extend([str(round(b, 2)) + "\tBaseboard (linear length) " + btxt])
+
+ return output
+
+
+# ------------------------------------------------------------------
+# Define property group class for cabinet properties
+# This is managed as an array of objects
+# ------------------------------------------------------------------
+class CabinetProperties(bpy.types.PropertyGroup):
+ # Cabinet width
+ sX = bpy.props.FloatProperty(
+ name='width', min=0.001, max=10, default=0.60, precision=3,
+ description='Cabinet width',
+ )
+ wY = bpy.props.FloatProperty(
+ name='', min=-10, max=10, default=0, precision=3,
+ description='Modify depth size',
+ )
+ wZ = bpy.props.FloatProperty(
+ name='', min=-10, max=10, default=0, precision=3,
+ description='Modify height size',
+ )
+
+ # Cabinet position shift
+ pX = bpy.props.FloatProperty(
+ name='', min=-10, max=10, default=0, precision=3,
+ description='Position x shift',
+ )
+ pY = bpy.props.FloatProperty(
+ name='', min=-10, max=10, default=0, precision=3,
+ description='Position y shift',
+ )
+ pZ = bpy.props.FloatProperty(
+ name='', min=-10, max=10, default=0, precision=3,
+ description='Position z shift',
+ )
+
+ # Door type
+ dType = bpy.props.EnumProperty(
+ items=(
+ ('1', "Single R", ""),
+ ('2', "Single L", ""),
+ ('3', "Single T", ""),
+ ('4', "Glass R", ""),
+ ('5', "Glass L", ""),
+ ('6', "Glass T", ""),
+ ('7', "Drawers", ""),
+ ('8', "Double", ""),
+ ('11', "Double Glass", ""),
+ ('10', "Corner R", ""),
+ ('9', "Corner L", ""),
+ ('99', "None", "")),
+ name="Door",
+ description="Type of front door or drawers",
+ )
+
+ # Shelves
+ sNum = bpy.props.IntProperty(
+ name='Shelves', min=0, max=10, default=1,
+ description='Number total of shelves',
+ )
+ # Drawers
+ dNum = bpy.props.IntProperty(
+ name='Num', min=1, max=10, default=3,
+ description='Number total of drawers',
+ )
+ # Glass Factor
+ gF = bpy.props.FloatProperty(
+ name='', min=0.001, max=1, default=0.1, precision=3,
+ description='Glass ratio',
+ )
+ # Handle flag
+ hand = bpy.props.BoolProperty(
+ name="Handle",
+ description="Create a handle", default=True,
+ )
+ # Left baseboard
+ bL = bpy.props.BoolProperty(
+ name="Left Baseboard",
+ description="Create a left baseboard", default=False,
+ )
+ # Right baseboard
+ bR = bpy.props.BoolProperty(
+ name="Right Baseboard",
+ description="Create a left baseboard", default=False,
+ )
+ # Fill countertop spaces
+ tC = bpy.props.BoolProperty(
+ name="Countertop fill",
+ description="Fill empty spaces with countertop", default=True,
+ )
+ # Add countertop edge
+ tE = bpy.props.BoolProperty(
+ name="Countertop edge",
+ description="Add edge to countertop", default=True,
+ )
+ # cabinet rotation
+ rotate = bpy.props.EnumProperty(
+ items=(
+ ('9', "Default", ""),
+ ('1', "90 CW", ""),
+ ('2', "90 CCW", ""),
+ ('3', "180", ""),
+ ),
+ name="Rot",
+ description="Rotate cabinet relative to previous one",
+ )
+
+
+bpy.utils.register_class(CabinetProperties)
+
+
+# ------------------------------------------------------------------
+# Define UI class
+# Kitchens
+# ------------------------------------------------------------------
+class AchmKitchen(bpy.types.Operator):
+ bl_idname = "mesh.archimesh_kitchen"
+ bl_label = "Cabinets"
+ bl_description = "Cabinet Generator"
+ bl_category = 'Archimesh'
+ bl_options = {'REGISTER', 'UNDO'}
+
+ # Define properties
+ type_cabinet = bpy.props.EnumProperty(
+ items=(('1', "Floor", ""),
+ ('2', "Wall", "")),
+ name="Type",
+ description="Type of cabinets",
+ )
+ oldtype = type_cabinet
+
+ thickness = bpy.props.FloatProperty(
+ name='Thickness', min=0.001, max=5, default=0.018, precision=3,
+ description='Board thickness',
+ )
+ depth = bpy.props.FloatProperty(
+ name='Depth', min=0.001, max=50, default=0.59, precision=3,
+ description='Default cabinet depth',
+ )
+ height = bpy.props.FloatProperty(
+ name='Height', min=0.001, max=50, default=0.70, precision=3,
+ description='Default cabinet height',
+ )
+ handle = bpy.props.EnumProperty(
+ items=(
+ ('1', "Model 1", ""),
+ ('2', "Model 2", ""),
+ ('3', "Model 3", ""),
+ ('4', "Model 4", ""),
+ ('5', "Model 5", ""),
+ ('6', "Model 6", ""),
+ ('7', "Model 7", ""),
+ ('8', "Model 8", ""),
+ ('9', "None", ""),
+ ),
+ name="Handle",
+ description="Type of handle",
+ )
+ handle_x = bpy.props.FloatProperty(
+ name='', min=0.001, max=10,
+ default=0.05, precision=3,
+ description='Displacement in X relative position (limited to door size)',
+ )
+ handle_z = bpy.props.FloatProperty(
+ name='', min=0.001, max=10,
+ default=0.05, precision=3,
+ description='Displacement in Z relative position (limited to door size)',
+ )
+
+ baseboard = bpy.props.BoolProperty(
+ name="Baseboard",
+ description="Create a baseboard automatically",
+ default=True,
+ )
+ baseheight = bpy.props.FloatProperty(
+ name='height', min=0.001, max=10,
+ default=0.16, precision=3,
+ description='Baseboard height',
+ )
+ basefactor = bpy.props.FloatProperty(
+ name='sink', min=0, max=1,
+ default=0.90, precision=3,
+ description='Baseboard sink',
+ )
+
+ countertop = bpy.props.BoolProperty(
+ name="Countertop",
+ description="Create a countertop automatically (only default cabinet height)",
+ default=True,
+ )
+ counterheight = bpy.props.FloatProperty(
+ name='height', min=0.001, max=10,
+ default=0.02, precision=3,
+ description='Countertop height',
+ )
+ counterextend = bpy.props.FloatProperty(
+ name='extend', min=0.001, max=10,
+ default=0.03, precision=3,
+ description='Countertop extent',
+ )
+
+ fitZ = bpy.props.BoolProperty(
+ name="Floor origin in Z=0",
+ description="Use Z=0 axis as vertical origin floor position",
+ default=True,
+ )
+ moveZ = bpy.props.FloatProperty(
+ name='Z position', min=0.001, max=10,
+ default=1.5, precision=3,
+ description='Wall cabinet Z position from floor',
+ )
+
+ cabinet_num = bpy.props.IntProperty(
+ name='Number of Cabinets', min=1, max=30,
+ default=1,
+ description='Number total of cabinets in the Kitchen',
+ )
+ cabinets = bpy.props.CollectionProperty(type=CabinetProperties)
+
+ # Materials
+ crt_mat = bpy.props.BoolProperty(
+ name="Create default Cycles materials",
+ description="Create default materials for Cycles render",
+ default=True,
+ )
+
+ # -----------------------------------------------------
+ # Draw (create UI interface)
+ # -----------------------------------------------------
+ # noinspection PyUnusedLocal
+ def draw(self, context):
+ layout = self.layout
+ space = bpy.context.space_data
+ if not space.local_view:
+ # Imperial units warning
+ if bpy.context.scene.unit_settings.system == "IMPERIAL":
+ row = layout.row()
+ row.label("Warning: Imperial units not supported", icon='COLOR_RED')
+
+ box = layout.box()
+ row = box.row()
+ row.prop(self, 'type_cabinet')
+
+ row.prop(self, 'thickness')
+ row = box.row()
+ row.prop(self, 'depth')
+ row.prop(self, 'height')
+ row = box.row()
+ row.prop(self, 'handle')
+ if self.handle != "9":
+ row.prop(self, 'handle_x')
+ row.prop(self, 'handle_z')
+
+ if self.type_cabinet == "1":
+ row = box.row()
+ row.prop(self, "countertop")
+ if self.countertop:
+ row.prop(self, "counterheight")
+ row.prop(self, "counterextend")
+ row = box.row()
+ row.prop(self, 'baseboard')
+ if self.baseboard:
+ row.prop(self, 'baseheight')
+ row.prop(self, 'basefactor', slider=True)
+
+ row = box.row()
+ row.prop(self, 'fitZ')
+ if self.type_cabinet == "2":
+ row.prop(self, 'moveZ')
+
+ # Cabinet number
+ row = box.row()
+ row.prop(self, 'cabinet_num')
+ # Add menu for cabinets
+ if self.cabinet_num > 0:
+ for idx in range(0, self.cabinet_num):
+ box = layout.box()
+ add_cabinet(self, box, idx + 1, self.cabinets[idx])
+
+ box = layout.box()
+ box.prop(self, 'crt_mat')
+ else:
+ row = layout.row()
+ row.label("Warning: Operator does not work in local view mode", icon='ERROR')
+
+ # -----------------------------------------------------
+ # Execute
+ # -----------------------------------------------------
+ # noinspection PyUnusedLocal
+ def execute(self, context):
+ if bpy.context.mode == "OBJECT":
+ # Set default values
+ if self.oldtype != self.type_cabinet:
+ if self.type_cabinet == "1": # Floor
+ self.depth = 0.59
+ self.height = 0.70
+
+ if self.type_cabinet == "2": # Wall
+ self.depth = 0.35
+ self.height = 0.70
+ self.oldtype = self.type_cabinet
+
+ # Create all elements
+ for i in range(len(self.cabinets) - 1, self.cabinet_num):
+ self.cabinets.add()
+
+ # Create cabinets
+ create_kitchen_mesh(self)
+ return {'FINISHED'}
+ else:
+ self.report({'WARNING'}, "Archimesh: Option only valid in Object mode")
+ return {'CANCELLED'}
+
+
+# -----------------------------------------------------
+# Add cabinet parameters
+# -----------------------------------------------------
+def add_cabinet(self, box, num, cabinet):
+ doortype = cabinet.dType
+ row = box.row()
+ row.label("Cabinet " + str(num))
+ row.prop(cabinet, 'sX')
+
+ row = box.row()
+ row.prop(cabinet, 'wY')
+ row.prop(cabinet, 'wZ')
+ row.prop(cabinet, 'rotate')
+
+ row = box.row()
+ row.prop(cabinet, 'pX')
+ row.prop(cabinet, 'pY')
+ row.prop(cabinet, 'pZ')
+
+ row = box.row()
+ row.prop(cabinet, 'dType')
+ if doortype == "7": # Drawers
+ row.prop(cabinet, 'dNum') # drawers number
+ else:
+ row.prop(cabinet, 'sNum') # shelves number
+ # Glass ratio
+ if doortype == "4" or doortype == "5" or doortype == "6" or doortype == "11":
+ row.prop(cabinet, 'gF', slider=True) # shelves number
+ # Handle
+ row = box.row()
+ if self.handle != "9":
+ row.prop(cabinet, 'hand')
+ if self.baseboard and self.type_cabinet == "1":
+ row.prop(cabinet, 'bL')
+ row.prop(cabinet, 'bR')
+
+ if self.countertop and self.type_cabinet == "1":
+ row = box.row()
+ row.prop(cabinet, 'tC')
+ row.prop(cabinet, 'tE')
+
+
+# ------------------------------------------------------------------------------
+# Generate mesh data
+# All custom values are passed using self container (self.myvariable)
+# ------------------------------------------------------------------------------
+def create_kitchen_mesh(self):
+ # deactivate others
+ for o in bpy.data.objects:
+ if o.select is True:
+ o.select = False
+ bpy.ops.object.select_all(False)
+ # Create cabinets
+ generate_cabinets(self)
+
+ return
+
+
+# ------------------------------------------------------------------------------
+# Generate cabinet
+# All custom values are passed using self container (self.myvariable)
+# ------------------------------------------------------------------------------
+def generate_cabinets(self):
+
+ boxes = []
+ bases = []
+ location = bpy.context.scene.cursor_location
+ myloc = copy.copy(location) # copy location to keep 3D cursor position
+ # Fit to floor
+ if self.fitZ:
+ myloc[2] = 0
+ # Move to wall position
+ if self.type_cabinet == "2": # wall
+ myloc[2] = myloc[2] + self.moveZ
+ # Baseboard
+ if self.type_cabinet == "1" and self.baseboard: # floor
+ myloc[2] = myloc[2] + self.baseheight # add baseboard position for bottom
+
+ # Create cabinets
+ lastx = myloc[0]
+ lasty = myloc[1]
+ lastrot = 0 # last rotation
+ # ------------------------------------------------------------------------------
+ # Cabinets
+ #
+ # By default all cabinets are created in X axis and later are rotated if needed
+ # the default rotation means keep last rotation, not 0, so if the previous
+ # cabinet is 90CW, the next one will be the same. To back to 0, you must select
+ # 90 CCW.
+ # ------------------------------------------------------------------------------
+ for i in range(0, self.cabinet_num):
+ mydata = create_box(self.type_cabinet, "Cabinet" + str(i + 1),
+ self.thickness,
+ self.cabinets[i].sX, self.depth + self.cabinets[i].wY, self.height + self.cabinets[i].wZ,
+ self.cabinets[i].pX + lastx,
+ self.cabinets[i].pY + lasty,
+ myloc[2] + self.cabinets[i].pZ,
+ self.cabinets[i].dType, self.cabinets[i].dNum, self.cabinets[i].sNum, self.cabinets[i].gF,
+ self.crt_mat,
+ self.cabinets[i].hand, self.handle, self.handle_x, self.handle_z, self.depth)
+ mybox = mydata[0]
+ # LastX is the sum of initial position + width of the cabinet.
+ lastx = mydata[1]
+ # add SKU property
+ sku = createunitsku(self, self.cabinets[i])
+ mydata[0]["archimesh.sku"] = sku
+
+ # Save rotation type
+ myrotationtype = int(self.cabinets[i].rotate)
+
+ # ---------------------------------------------------------
+ # Calculate new rotation angle
+ #
+ # ---------------------------------------------------------
+ myrot = lastrot
+ # ----------
+ # Default
+ # ----------
+ if myrotationtype == RotationType_Default:
+ myrot = myrot # do no change rotation
+ # ----------
+ # 90 CW
+ # ----------
+ if myrotationtype == RotationType_R90CW:
+ myrot += -math.pi / 2
+ # ----------
+ # 90 CCW
+ # ----------
+ if myrotationtype == RotationType_R90CCW:
+ myrot += math.pi / 2
+ # ----------
+ # 180
+ # ----------
+ if myrotationtype == RotationType_R180:
+ myrot = myrot + math.pi
+
+ # Save the rotation for next cabinet
+ lastrot = myrot
+ angle = myrot - ((2 * math.pi) * (myrot // (2 * math.pi))) # clamp one revolution
+
+ # -------------------------------------------
+ # Countertop (only default height cabinet)
+ # 9-Default, 1-90CW, 2-90CCW, 3-180
+ # -------------------------------------------
+ if self.countertop and self.type_cabinet == "1" and self.cabinets[i].wZ == 0:
+ w = self.cabinets[i].sX
+ # fill (depend on orientation)
+ if self.cabinets[i].tC:
+ # 0 or 180 degrees
+ if angle == 0 or angle == math.pi:
+ w += math.fabs(self.cabinets[i].pX)
+ # 90 or 270 degrees
+ if angle == (3 * math.pi) / 2 or angle == math.pi / 2:
+ w += math.fabs(self.cabinets[i].pY)
+
+ mycountertop = create_countertop("Countertop" + str(i + 1),
+ w,
+ self.depth + self.cabinets[i].wY,
+ self.counterheight, self.counterextend,
+ self.crt_mat, self.cabinets[i].dType, self.depth,
+ self.cabinets[i].tE)
+ # -------------------------------
+ # Fill countertop spaces
+ # -------------------------------
+ if self.cabinets[i].tC:
+ # Default
+ if angle == 0:
+ if self.cabinets[i].pX >= 0:
+ mycountertop.location[0] = -self.cabinets[i].pX
+ else:
+ mycountertop.location[0] = 0
+
+ # 90CW
+ if angle == (3 * math.pi) / 2:
+ if self.cabinets[i].pY >= 0:
+ mycountertop.location[0] = 0
+ else:
+ mycountertop.location[0] = self.cabinets[i].pY
+ # 90CCW
+ if angle == math.pi / 2:
+ if self.cabinets[i].pY >= 0:
+ mycountertop.location[0] = self.cabinets[i].pY * -1
+ else:
+ mycountertop.location[0] = 0
+ # 180
+ if angle == math.pi:
+ mycountertop.location[0] = 0
+
+ mycountertop.location[2] = self.height
+ mycountertop.parent = mydata[0]
+ # --------------------
+ # add countertop SKU
+ # --------------------
+ t = w
+ # if corner, remove size
+ if self.cabinets[i].dType == "9" or self.cabinets[i].dType == "10":
+ t = t - self.cabinets[i].sX
+
+ mycountertop["archimesh.top_sku"] = "T%06.3fx%06.3fx%06.3f-%06.3f" % (t,
+ self.depth + self.cabinets[
+ i].wY + self.counterextend,
+ self.counterheight,
+ w)
+ # ----------------
+ # Baseboard
+ # ----------------
+ if self.baseboard and self.type_cabinet == "1":
+ gap = (self.depth + self.cabinets[i].wY) - ((self.depth + self.cabinets[i].wY) * self.basefactor)
+ mybase = create_baseboard("Baseboard" + str(i + 1),
+ self.cabinets[i].sX, self.thickness, self.baseheight,
+ self.crt_mat, self.cabinets[i].bL, self.cabinets[i].bR,
+ (self.depth + self.cabinets[i].wY) * self.basefactor, self.cabinets[i].dType, gap)
+ bases.extend([mybase])
+ mybase.location[1] = (self.depth + self.cabinets[i].wY) * self.basefactor * -1
+ mybase.location[2] = -self.baseheight
+ mybase.parent = mydata[0]
+ # --------------------
+ # add base SKU
+ # --------------------
+ t = self.cabinets[i].sX
+ # Add sides
+ if self.cabinets[i].bR is True:
+ t = t + (self.depth + self.cabinets[i].wY) * self.basefactor
+ if self.cabinets[i].bL is True:
+ t = t + (self.depth + self.cabinets[i].wY) * self.basefactor
+
+ mybase["archimesh.base_sku"] = "B%06.3fx%06.3fx%06.3f" % (t, self.thickness, self.baseheight)
+
+ # Rotate
+ mybox.rotation_euler = (0, 0, myrot)
+
+ # -----------------------------------------
+ # Calculate new position for next cabinet
+ # -----------------------------------------
+ xm = 0
+ ym = 0
+
+ # 0 degrees
+ if angle == 0:
+ lastx = lastx
+ lasty = lasty
+ # 90 degrees
+ if angle == math.pi / 2:
+ ym = -self.cabinets[i].sX
+ lastx = lastx - self.cabinets[i].sX - self.cabinets[i].pX
+ lasty = lasty + self.cabinets[i].sX + self.cabinets[i].pY
+ # 180 degrees
+ if angle == math.pi:
+ lastx -= 2 * (self.cabinets[i].sX + self.cabinets[i].pX)
+ # 270 degrees
+ if angle == (3 * math.pi) / 2:
+ xm = self.depth - self.counterextend
+ lastx = lastx - self.cabinets[i].sX - self.cabinets[i].pX
+ lasty = lasty - self.cabinets[i].sX - self.cabinets[i].pX + self.cabinets[i].pY
+
+ myl = mybox.location
+ # noinspection PyUnresolvedReferences
+ mybox.location = (myl.x + xm, myl.y + ym, myl.z)
+
+ # ---------------------------------------
+ # Save box
+ # ---------------------------------------
+ boxes.extend([mybox])
+
+ # refine cabinets
+ for box in boxes:
+ remove_doubles(box)
+ set_normals(box)
+
+ # refine baseboard
+ for base in bases:
+ remove_doubles(base)
+ set_normals(base)
+
+ # Create materials
+ if self.crt_mat:
+ mat = create_diffuse_material("Cabinet_material", False, 0.8, 0.8, 0.8)
+ for box in boxes:
+ set_material(box, mat)
+
+ return
+
+
+# ------------------------------------------------------------------------------
+# Create cabinet box
+#
+# thickness: wood thickness
+# sX: Size in X axis
+# sY: Size in Y axis
+# sZ: Size in Z axis
+# pX: position X axis
+# pY: position Y axis
+# pZ: position Z axis
+# doorType: Type of door or drawers
+# drawers: Number of drawers
+# shelves: Number of shelves
+# gF: Glass size factor
+# mat: Flag for creating materials
+# handle: handle visibility flag
+# handle_model: Type of handle
+# handle_x: Position of handle in X axis
+# handle_z: Position of handle in Z axis
+# depth: Default depth
+# ------------------------------------------------------------------------------
+def create_box(type_cabinet, objname, thickness, sx, sy, sz, px, py, pz, doortype, drawers, shelves, gf, mat,
+ handle, handle_model, handle_x, handle_z, depth):
+ myvertex = []
+ myfaces = []
+ # external faces
+ myvertex.extend(
+ [(0, 0, 0), (0, -sy, 0), (0, -sy, sz), (0, 0, sz), (sx, 0, 0), (sx, -sy, 0), (sx, -sy, sz), (sx, 0, sz)])
+ myfaces.extend([(0, 1, 2, 3), (4, 5, 6, 7), (0, 4, 7, 3), (0, 1, 5, 4), (3, 2, 6, 7)])
+
+ # internal faces
+ myvertex.extend([(thickness, -thickness, thickness), (thickness, -sy, thickness),
+ (thickness, -sy, sz - thickness), (thickness, -thickness, sz - thickness),
+ (sx - thickness, -thickness, thickness), (sx - thickness, -sy, thickness),
+ (sx - thickness, -sy, sz - thickness), (sx - thickness, -thickness, sz - thickness)])
+
+ myfaces.extend([(8, 9, 10, 11), (12, 13, 14, 15), (8, 12, 15, 11), (8, 9, 13, 12), (11, 10, 14, 15)])
+ myfaces.extend([(1, 9, 10, 2), (2, 6, 14, 10), (6, 5, 13, 14), (5, 1, 9, 13)])
+
+ # -----------------
+ # shelves
+ # -----------------
+ v = 16 # vertice number
+ if doortype != "7": # Drawers
+ # calculate separation
+ dist = sz - (thickness * 2)
+ space = dist / (shelves + 1)
+ posz1 = thickness + space
+
+ for x in range(shelves):
+ posz2 = posz1 - thickness
+ myvertex.extend([(thickness, -thickness, posz1), (thickness, -sy, posz1),
+ (thickness, -sy, posz2), (thickness, -thickness, posz2),
+ (sx - thickness, -thickness, posz1), (sx - thickness, -sy, posz1),
+ (sx - thickness, -sy, posz2), (sx - thickness, -thickness, posz2)])
+
+ myfaces.extend([(v, v + 1, v + 2, v + 3), (v + 4, v + 5, v + 6, v + 7), (v, v + 4, v + 7, v + 3),
+ (v, v + 1, v + 5, v + 4), (v + 3, v + 2, v + 6, v + 7), (v + 1, v + 2, v + 6, v + 5)])
+ v += 8
+ posz1 += space
+
+ mymesh = bpy.data.meshes.new(objname)
+ myobject = bpy.data.objects.new(objname, mymesh)
+
+ myobject.location[0] = px
+ myobject.location[1] = py
+ myobject.location[2] = pz
+ bpy.context.scene.objects.link(myobject)
+
+ mymesh.from_pydata(myvertex, [], myfaces)
+ mymesh.update(calc_edges=True)
+
+ # ---------------------------------------
+ # Drawers
+ # ---------------------------------------
+ if doortype == "7": # Drawers
+ # calculate separation
+ gap = 0.001
+ dist = sz - (gap * drawers)
+ space = dist / drawers
+ posz1 = 0
+
+ for x in range(drawers):
+ mydrawer = create_drawer("Drawer", thickness, sx, sy, space, mat, handle,
+ handle_model, handle_z)
+ mydrawer.location[1] = -sy
+ mydrawer.location[2] = posz1
+ mydrawer.parent = myobject
+ remove_doubles(mydrawer)
+ set_normals(mydrawer)
+ posz1 = posz1 + space + gap # gap
+
+ # ---------------------------------------
+ # Doors
+ # ---------------------------------------
+ if doortype != "99" and doortype != "7": # None or Drawers
+ if doortype == "1" or doortype == "2" or doortype == "3" or doortype == "4" \
+ or doortype == "5" or doortype == "6": # single door
+ mydoor = create_door(type_cabinet, objname + "_Door", thickness, sx, sz, doortype, gf, mat, handle,
+ handle_model, handle_x, handle_z, 0.001)
+ mydoor.parent = myobject
+ mydoor.location[1] = -sy - 0.001 # add 1 mm gap
+ remove_doubles(mydoor)
+ set_normals(mydoor)
+
+ else: # double doors
+ if doortype == "8" or doortype == "10" or doortype == "11":
+ # Glass or not
+ if doortype != "11":
+ typ = "2"
+ else:
+ typ = "5"
+
+ # Adjust corner doors
+ dwidth = sx / 2
+ if doortype == "10":
+ dwidth = sx - depth - thickness - 0.001
+
+ mydoor1 = create_door(type_cabinet, objname + "_Door_L", thickness, dwidth, sz, typ, gf, mat,
+ handle,
+ handle_model, handle_x, handle_z, 0.0005) # left
+ mydoor1.location[1] = -sy - 0.001 # add 1 mm gap
+ mydoor1.parent = myobject
+ remove_doubles(mydoor1)
+ set_normals(mydoor1)
+
+ if doortype == "8" or doortype == "9" or doortype == "11":
+ # Glass or not
+ if doortype != "11":
+ typ = "1"
+ else:
+ typ = "4"
+
+ # Adjust corner doors
+ dwidth = sx / 2
+ if doortype == "9":
+ dwidth = sx - depth - thickness - 0.001
+
+ mydoor2 = create_door(type_cabinet, objname + "_Door_R", thickness, dwidth, sz, typ, gf, mat,
+ handle,
+ handle_model, handle_x, handle_z, 0.0005) # right
+ mydoor2.location[1] = -sy - 0.001 # add 1 mm gap
+ mydoor2.location[0] = sx
+ mydoor2.parent = myobject
+ remove_doubles(mydoor2)
+ set_normals(mydoor2)
+
+ return myobject, px + sx
+
+
+# ------------------------------------------------------------------------------
+# Create baseboard
+#
+# sX: Size in X axis
+# sY: Size in Y axis
+# sZ: Size in Z axis
+# mat: Flag for creating materials
+# bL: Flag to create left side
+# bR: Flag to create right side
+# depth: depth or position of baseboard
+# gap: space to close in corners
+# ------------------------------------------------------------------------------
+def create_baseboard(objname, sx, sy, sz, mat, bl, br, depth, doortype, gap):
+ myvertex = []
+ myfaces = []
+ p = 0
+ # external faces
+ myvertex.extend(
+ [(0, 0, 0), (0, -sy, 0), (0, -sy, sz), (0, 0, sz), (sx, 0, 0), (sx, -sy, 0), (sx, -sy, sz), (sx, 0, sz)])
+ myfaces.extend([(0, 1, 2, 3), (4, 5, 6, 7), (0, 4, 7, 3), (0, 1, 5, 4), (3, 2, 6, 7), (1, 5, 6, 2)])
+ # left side
+ f = 8
+ if bl:
+ myvertex.extend(
+ [(0, 0, 0), (0, depth, 0), (0, depth, sz), (0, 0, sz), (sy, 0, 0), (sy, depth, 0), (sy, depth, sz),
+ (sy, 0, sz)])
+ myfaces.extend(
+ [(f, f + 1, f + 2, f + 3), (f + 4, f + 5, f + 6, f + 7), (f, f + 4, f + 7, f + 3), (f, f + 1, f + 5, f + 4),
+ (f + 3, f + 2, f + 6, f + 7), (f + 1, f + 5, f + 6, f + 2)])
+ f += 8
+ # right side
+ if br:
+ p = sx - sy
+ myvertex.extend([(p, 0, 0), (p, depth, 0), (p, depth, sz), (p, 0, sz), (p + sy, 0, 0), (p + sy, depth, 0),
+ (p + sy, depth, sz), (p + sy, 0, sz)])
+ myfaces.extend(
+ [(f, f + 1, f + 2, f + 3), (f + 4, f + 5, f + 6, f + 7), (f, f + 4, f + 7, f + 3), (f, f + 1, f + 5, f + 4),
+ (f + 3, f + 2, f + 6, f + 7), (f + 1, f + 5, f + 6, f + 2)])
+ f += 8
+ # Corners
+ if doortype == "9" or doortype == "10":
+ if doortype == "9":
+ p = depth + sy
+ if doortype == "10":
+ p = sx - depth - sy
+
+ size = gap * -2
+ myvertex.extend([(p, -sy, 0), (p, size, 0), (p, size, sz), (p, -sy, sz), (p + sy, -sy, 0), (p + sy, size, 0),
+ (p + sy, size, sz), (p + sy, -sy, sz)])
+ myfaces.extend(
+ [(f, f + 1, f + 2, f + 3), (f + 4, f + 5, f + 6, f + 7), (f, f + 4, f + 7, f + 3), (f, f + 1, f + 5, f + 4),
+ (f + 3, f + 2, f + 6, f + 7), (f + 1, f + 5, f + 6, f + 2)])
+
+ mymesh = bpy.data.meshes.new(objname)
+ mybaseboard = bpy.data.objects.new(objname, mymesh)
+
+ mybaseboard.location[0] = 0
+ mybaseboard.location[1] = 0
+ mybaseboard.location[2] = 0
+ bpy.context.scene.objects.link(mybaseboard)
+
+ mymesh.from_pydata(myvertex, [], myfaces)
+ mymesh.update(calc_edges=True)
+
+ # Material
+ if mat:
+ mat = create_diffuse_material("Baseboard_material", False, 0.8, 0.8, 0.8)
+ set_material(mybaseboard, mat)
+
+ return mybaseboard
+
+
+# ------------------------------------------------------------------------------
+# Create Countertop
+#
+# sX: Size in X axis
+# sY: Size in Y axis
+# sZ: Size in Z axis
+# mat: Flag for creating materials
+# doorType: Type of door
+# depth: Depth of the cabinets
+# edge: add countertop edge
+# ------------------------------------------------------------------------------
+def create_countertop(objname, sx, sy, sz, over, mat, doortype, depth, edge):
+ oy = 0.02
+ oz = 0.05 + sz
+
+ myvertex = []
+ myfaces = []
+ # if corner the size is less
+ ts = 0
+ tx = sx
+
+ if doortype == "9":
+ ts = sx - (sx - over - depth)
+ tx = sx
+
+ if doortype == "10":
+ ts = 0
+ tx = sx - over - depth
+
+ # external faces
+ myvertex.extend([(ts, 0, 0), (ts, -sy - over, 0), (ts, -sy - over, sz), (ts, 0, sz),
+ (tx, 0, 0), (tx, -sy - over, 0), (tx, -sy - over, sz), (tx, 0, sz)])
+ myfaces.extend([(0, 1, 2, 3), (4, 5, 6, 7), (0, 4, 7, 3), (0, 1, 5, 4), (3, 2, 6, 7), (1, 5, 6, 2)])
+ # Back
+ ts = 0
+ tx = sx
+
+ if doortype == "9":
+ ts = oy
+
+ if doortype == "10":
+ tx -= oy
+ # Add edge
+ if edge is True:
+ myvertex.extend([(ts, 0, sz), (ts, -oy, sz), (ts, -oy, oz), (ts, 0, oz),
+ (tx, 0, sz), (tx, -oy, sz), (tx, -oy, oz), (tx, 0, oz)])
+ myfaces.extend(
+ [(8, 9, 10, 11), (12, 13, 14, 15), (8, 12, 15, 11), (8, 9, 13, 12), (11, 10, 14, 15), (9, 13, 14, 10)])
+
+ mymesh = bpy.data.meshes.new(objname)
+ mycountertop = bpy.data.objects.new(objname, mymesh)
+
+ mycountertop.location[0] = 0
+ mycountertop.location[1] = 0
+ mycountertop.location[2] = 0
+ bpy.context.scene.objects.link(mycountertop)
+
+ mymesh.from_pydata(myvertex, [], myfaces)
+ mymesh.update(calc_edges=True)
+
+ # Material
+ if mat:
+ mat = create_diffuse_material("countertop_material", False, 0, 0, 0, 0.2, 0.2, 0.2, 0.15)
+ set_material(mycountertop, mat)
+
+ return mycountertop
+
+
+# ------------------------------------------------------------------------------
+# Create cabinet door
+#
+# type_cabinet: Type of cabinet (floor or wall)
+# objName: Name of the created object
+# thickness: wood thickness
+# sX: Size in X axis
+# sY: Size in Y axis
+# sZ: Size in Z axis
+# doorType: Type of door or drawers
+# gF: Glass size factor
+# mat: Flag for creating materials
+# handle: handle visibility flag
+# handle_model: Type of handle
+# handle_x: Position of handle in X axis
+# handle_z: Position of handle in Z axis
+# gapX: size of the horizontal gap
+# ------------------------------------------------------------------------------
+def create_door(type_cabinet, objname, thickness, sx, sz, doortype, gf, mat, handle, handle_model, handle_x,
+ handle_z, gapx):
+
+ myvertex = []
+ myfaces = []
+
+ # Left open
+ f = -1 # right
+ if doortype == "2" or doortype == "5" or doortype == "10":
+ f = 1
+ # add small gap in width
+ sx = sx - gapx
+ # add small gap in top zone
+ sz -= 0.002
+ # External Frame
+ myvertex.extend([(0, 0, 0), (0, -thickness, 0), (0, -thickness, sz), (0, 0, sz), (sx * f, 0, 0),
+ (sx * f, -thickness, 0), (sx * f, -thickness, sz), (sx * f, 0, sz)])
+ myfaces.extend([(0, 1, 2, 3), (4, 5, 6, 7), (0, 1, 5, 4), (3, 2, 6, 7)])
+ # ---------------
+ # Solid door
+ # ---------------
+ if doortype == "1" or doortype == "2" or doortype == "3" \
+ or doortype == "8" or doortype == "9" or doortype == "10":
+ myfaces.extend([(0, 4, 7, 3), (1, 2, 6, 5)])
+ # ---------------
+ # Glass door
+ # ---------------
+ if doortype == "4" or doortype == "5" or doortype == "6" or doortype == "11":
+ w = sx * gf # calculate frame size W
+ h = sz * gf # calculate frame size V
+
+ myvertex.extend([(w * f, 0, h), (w * f, -thickness, h), (w * f, -thickness, sz - h), (w * f, 0, sz - h),
+ ((sx - w) * f, 0, h),
+ ((sx - w) * f, -thickness, h), ((sx - w) * f, -thickness, sz - h), ((sx - w) * f, 0, sz - h)])
+ myfaces.extend([(8, 9, 10, 11), (12, 13, 14, 15), (8, 11, 15, 12), (10, 11, 15, 14), (8, 12, 13, 9),
+ (1, 9, 10, 2), (5, 13, 14, 6), (6, 2, 10, 14), (5, 1, 9, 13),
+ (0, 3, 11, 8), (12, 15, 7, 4), (4, 0, 8, 12), (11, 3, 7, 15)])
+
+ mymesh = bpy.data.meshes.new(objname)
+ mydoor = bpy.data.objects.new(objname, mymesh)
+ if f == -1:
+ mydoor.location[0] = sx
+ else:
+ mydoor.location[0] = 0
+
+ mydoor.location[1] = 0
+ mydoor.location[2] = 0
+ bpy.context.scene.objects.link(mydoor)
+
+ mymesh.from_pydata(myvertex, [], myfaces)
+ mymesh.update(calc_edges=True)
+
+ # ----------------------------------------------
+ # Handles
+ # RT: Put handle in right side top
+ # LT: Put handle in left side top
+ # RB: Put handle in right side bottom
+ # LB: Put handle in left side bottom
+ # T: Put handle in top side middle
+ # B: Put handle in bottom side middle
+ #
+ # The position is reverse to the open direction
+ # of the door
+ # ----------------------------------------------
+ hpos = "RT" # Right by default
+ if handle:
+ # -----------------
+ # Floor units
+ # -----------------
+ if type_cabinet == "1":
+ if doortype == "1" or doortype == "4" or doortype == "9": # Right
+ hpos = "LT"
+ if doortype == "2" or doortype == "5" or doortype == "10": # Left
+ hpos = "RT"
+ if doortype == "3" or doortype == "6":
+ hpos = "T"
+ # -----------------
+ # Wall units
+ # -----------------
+ if type_cabinet == "2":
+ if doortype == "1" or doortype == "4" or doortype == "9": # Right
+ hpos = "LB"
+ if doortype == "2" or doortype == "5" or doortype == "10": # Left
+ hpos = "RB"
+ if doortype == "3" or doortype == "6":
+ hpos = "B"
+
+ create_handle(handle_model, mydoor, thickness, hpos, mat, handle_x, handle_z)
+
+ if mat:
+ # Door material
+ mat = create_diffuse_material("Door_material", False, 0.8, 0.8, 0.8, 0.279, 0.337, 0.6, 0.2)
+ set_material(mydoor, mat)
+ # Add Glass
+ if doortype == "4" or doortype == "5" or doortype == "6" or doortype == "11":
+ mat = create_glass_material("DoorGlass_material", False)
+ mydoor.data.materials.append(mat)
+ select_faces(mydoor, 6, True)
+ set_material_faces(mydoor, 1)
+
+ # Limit rotation axis
+ if hpos != "T" and hpos != "TM" and hpos != "B":
+ mydoor.lock_rotation = (True, True, False)
+
+ return mydoor
+
+
+# ------------------------------------------------------------------------------
+# Create drawers
+#
+# thickness: wood thickness
+# sX: Size in X axis
+# sY: Size in Y axis
+# sZ: Size in Z axis
+# mat: Flag for creating materials
+# handle: handle visibility flag
+# handle_model: Type of handle
+# handle_z: Position of handle in Z axis
+# ------------------------------------------------------------------------------
+def create_drawer(objname, thickness, sx, sy, sz, mat, handle, handle_model, handle_z):
+ myvertex = []
+ myfaces = []
+ # Front face
+ myvertex.extend([(0, 0, 0), (0, -thickness, 0), (0, -thickness, sz), (0, 0, sz), (sx, 0, 0), (sx, -thickness, 0),
+ (sx, -thickness, sz), (sx, 0, sz)])
+ myfaces.extend([(0, 1, 2, 3), (4, 5, 6, 7), (0, 4, 7, 3), (0, 1, 5, 4), (3, 2, 6, 7), (1, 2, 6, 5)])
+
+ # internal faces (thickness cm gap)
+ myvertex.extend([(thickness, 0, thickness),
+ (thickness, sy - thickness, thickness),
+ (sx - thickness, sy - thickness, thickness),
+ (sx - thickness, 0, thickness),
+ (thickness * 2, 0, thickness),
+ (thickness * 2, sy - thickness * 2, thickness),
+ (sx - thickness * 2, sy - thickness * 2, thickness),
+ (sx - thickness * 2, 0, thickness)])
+
+ myfaces.extend([(8, 9, 13, 12), (13, 9, 10, 14), (14, 10, 11, 15), (12, 13, 14, 15)])
+ h = sz * 0.7
+ myvertex.extend([(thickness, 0, h),
+ (thickness, sy - thickness, h),
+ (sx - thickness, sy - thickness, h),
+ (sx - thickness, 0, h),
+ (thickness * 2, 0, h),
+ (thickness * 2, sy - thickness * 2, h),
+ (sx - thickness * 2, sy - thickness * 2, h),
+ (sx - thickness * 2, 0, h)])
+ myfaces.extend(
+ [(16, 17, 21, 20), (21, 17, 18, 22), (22, 18, 19, 23), (8, 9, 17, 16), (9, 10, 18, 17), (10, 11, 19, 18),
+ (12, 13, 21, 20), (13, 14, 22, 21), (14, 15, 23, 22)])
+
+ mymesh = bpy.data.meshes.new(objname)
+ mydrawer = bpy.data.objects.new(objname, mymesh)
+
+ mydrawer.location[0] = 0
+ mydrawer.location[1] = 0
+ mydrawer.location[2] = 0
+ bpy.context.scene.objects.link(mydrawer)
+
+ mymesh.from_pydata(myvertex, [], myfaces)
+ mymesh.update(calc_edges=True)
+
+ # Handle
+ if handle:
+ model = handle_model
+ # Drawers always horizontal handle, so override values
+ if model == "1":
+ model = "3"
+
+ if model == "4":
+ model = "2"
+
+ create_handle(model, mydrawer, thickness, "TM", mat, 0, handle_z) # always in the top area/middle
+
+ # Material
+ if mat:
+ mat = create_diffuse_material("Drawer_material", False, 0.8, 0.8, 0.8, 0.6, 0.6, 0.6, 0.2)
+ set_material(mydrawer, mat)
+
+ # Lock transformation
+ mydrawer.lock_location = (True, False, True) # only Y axis
+
+ return mydrawer
+
+
+# ------------------------------------------------------------------------------
+# Create Handles
+#
+# model: handle model
+# myDoor: Door that has the handle
+# thickness: thickness of board
+# handle_position: position of the handle
+# RT: Put handle in right side top
+# LT: Put handle in left side top
+# RB: Put handle in right side bottom
+# LB: Put handle in left side bottom
+# T: Put handle in top side middle
+# TM: Put handle in top side middle (drawers)
+# B: Put handle in bottom side middle
+# mat: create default cycles material
+# handle_x: Position of handle in X axis
+# handle_z: Position of handle in Z axis
+# ------------------------------------------------------------------------------
+def create_handle(model, mydoor, thickness, handle_position, mat, handle_x, handle_z):
+ if model == "9":
+ return None
+
+ # Retry mesh data
+ if model == "1" or model == "3":
+ mydata = handle_model_01()
+ elif model == "2" or model == "4":
+ mydata = handle_model_02()
+ elif model == "5":
+ mydata = handle_model_05()
+ elif model == "6":
+ mydata = handle_model_06()
+ elif model == "7":
+ mydata = handle_model_07()
+ elif model == "8":
+ mydata = handle_model_08()
+ else:
+ mydata = handle_model_01() # default model
+
+ # move data
+ myvertex = mydata[0]
+ myfaces = mydata[1]
+
+ mymesh = bpy.data.meshes.new("Handle")
+ myhandle = bpy.data.objects.new("Handle", mymesh)
+
+ bpy.context.scene.objects.link(myhandle)
+
+ mymesh.from_pydata(myvertex, [], myfaces)
+ mymesh.update(calc_edges=True)
+
+ # Position handle
+ myhandle.location.y = -thickness
+ # Calculate dimensions
+ if model == "1" or model == "4" or model == "5" or model == "6":
+ width = myhandle.dimensions.z / 2
+ height = myhandle.dimensions.x / 2
+ else:
+ width = myhandle.dimensions.x / 2
+ height = myhandle.dimensions.z / 2
+ # Limit handle position to door dimensions
+ if handle_x + width > mydoor.dimensions.x:
+ handle_x = mydoor.dimensions.x - 0.01
+
+ if handle_z + height > mydoor.dimensions.z:
+ handle_z = mydoor.dimensions.z - 0.01
+
+ # Position in X axis
+ if handle_position == "LT" or handle_position == "LB":
+ myhandle.location.x = -mydoor.dimensions.x + handle_x + width
+
+ if handle_position == "RT" or handle_position == "RB":
+ myhandle.location.x = mydoor.dimensions.x - handle_x - width
+
+ # Position in Z axis
+ if handle_position == "RT" or handle_position == "LT":
+ if mydoor.dimensions.z - handle_z - height > 1.2:
+ myhandle.location.z = 1.2
+ else:
+ myhandle.location.z = mydoor.dimensions.z - handle_z - height
+
+ if handle_position == "RB" or handle_position == "LB":
+ myhandle.location.z = handle_z + height
+
+ # Position for Middle point
+ if handle_position == "T" or handle_position == "B":
+ myhandle.location.x = -mydoor.dimensions.x / 2
+
+ if handle_position == "TM":
+ myhandle.location.x = mydoor.dimensions.x / 2
+
+ if handle_position == "T" or handle_position == "TM":
+ myhandle.location.z = mydoor.dimensions.z - handle_z - height
+
+ if handle_position == "B":
+ myhandle.location.z = handle_z - height
+
+ # rotate
+ if handle_position != "T" and handle_position != "B" and handle_position != "TM":
+ yrot = 0
+ if model == "1":
+ yrot = math.pi / 2
+
+ if model == "4":
+ if handle_position == "LT" or handle_position == "LB":
+ yrot = -math.pi / 2
+ else:
+ yrot = math.pi / 2
+
+ myhandle.rotation_euler = (0, yrot, 0.0) # radians PI=180
+
+ # parent
+ myhandle.parent = mydoor
+ # Materials
+ if mat:
+ mat = create_glossy_material("Handle_material", False, 0.733, 0.779, 0.8, 0.733, 0.779, 0.8, 0.02)
+ set_material(myhandle, mat)
+
+ # Smooth
+ if model == "1" or model == "3":
+ set_smooth(myhandle)
+ set_modifier_subsurf(myhandle)
+
+ if model == "5" or model == "6" or model == "7" or model == "8":
+ set_smooth(myhandle)
+
+ return myhandle
+
+
+# ----------------------------------------------
+# Handle model 01
+# ----------------------------------------------
+def handle_model_01():
+ # ------------------------------------
+ # Mesh data
+ # ------------------------------------
+ minx = -0.07222598791122437
+ maxx = 0.07222597301006317
+ maxy = 6.545917585754069e-08
+ minz = -0.004081448074430227
+ maxz = 0.004081418737769127
+
+ # Vertex
+ myvertex = [(maxx - 0.013172730803489685, -0.025110241025686264, maxz - 0.0003106782678514719),
+ (maxx - 0.01216559112071991, -0.027320515364408493, maxz - 0.0011954230722039938),
+ (maxx - 0.011492643505334854, -0.028797375038266182, maxz - 0.0025195349007844925),
+ (maxx - 0.011256333440542221, -0.029315980151295662, maxz - 0.0040814326939546675),
+ (maxx - 0.011492643505334854, -0.02879737690091133, minz + 0.0025195364141836762),
+ (maxx - 0.01216559112071991, -0.02732051908969879, minz + 0.0011954230722039938),
+ (maxx - 0.013172730803489685, -0.025110244750976562, minz + 0.0003106798976659775),
+ (maxx - 0.014360729604959488, -0.022503048181533813, minz),
+ (maxx - 0.01554873213171959, -0.019895851612091064, minz + 0.00031067943200469017),
+ (maxx - 0.016555871814489365, -0.017685577273368835, minz + 0.001195424236357212),
+ (maxx - 0.01722881942987442, -0.016208721324801445, minz + 0.0025195354828611016),
+ (maxx - 0.017465125769376755, -0.015690118074417114, minz + 0.00408143286244389),
+ (maxx - 0.01722881942987442, -0.016208721324801445, maxz - 0.0025195367634296417),
+ (maxx - 0.016555871814489365, -0.017685577273368835, maxz - 0.0011954237706959248),
+ (maxx - 0.01554873213171959, -0.019895853474736214, maxz - 0.00031068059615790844),
+ (maxx - 0.014360729604959488, -0.022503050044178963, maxz),
+ (maxx - 0.00908602774143219, -0.022446047514677048, maxz - 0.0003106782678514719),
+ (maxx - 0.007382020354270935, -0.024176951497793198, maxz - 0.0011954226065427065),
+ (maxx - 0.006243452429771423, -0.025333505123853683, maxz - 0.002519535133615136),
+ (maxx - 0.005843624472618103, -0.025739632546901703, maxz - 0.004081432702012222),
+ (maxx - 0.006243452429771423, -0.025333506986498833, minz + 0.0025195362977683544),
+ (maxx - 0.007382020354270935, -0.024176953360438347, minz + 0.0011954230722039938),
+ (maxx - 0.00908602774143219, -0.022446051239967346, minz + 0.0003106798976659775),
+ (maxx - 0.011096026748418808, -0.020404310896992683, minz),
+ (maxx - 0.013106036931276321, -0.01836257427930832, minz + 0.0003106796648353338),
+ (maxx - 0.014810033142566681, -0.01663167029619217, minz + 0.001195424236357212),
+ (maxx - 0.015948612242937088, -0.015475118532776833, minz + 0.0025195355992764235),
+ (maxx - 0.016348421573638916, -0.015068991109728813, minz + 0.004081432861045897),
+ (maxx - 0.015948612242937088, -0.015475118532776833, maxz - 0.00251953664701432),
+ (maxx - 0.014810033142566681, -0.01663167029619217, maxz - 0.0011954233050346375),
+ (maxx - 0.013106033205986023, -0.01836257241666317, maxz - 0.0003106803633272648),
+ (maxx - 0.011096026748418808, -0.020404312759637833, maxz - 4.656612873077393e-10),
+ (maxx - 0.004618480801582336, -0.01468262542039156, maxz - 0.0008190707303583622),
+ (maxx - 0.002191290259361267, -0.014774298295378685, maxz - 0.001584529411047697),
+ (maxx - 0.0005694925785064697, -0.014835557900369167, maxz - 0.002730117877945304),
+ (maxx, -0.014857066795229912, maxz - 0.004081432337202706),
+ (maxx - 0.0005694925785064697, -0.014835558831691742, minz + 0.002730119973421097),
+ (maxx - 0.002191290259361267, -0.014774300158023834, minz + 0.001584530808031559),
+ (maxx - 0.004618480801582336, -0.01468262542039156, minz + 0.0008190732914954424),
+ (maxx - 0.0074815452098846436, -0.014574488624930382, minz + 0.000550281023606658),
+ (maxx - 0.010344602167606354, -0.014466354623436928, minz + 0.0008190732914954424),
+ (maxx - 0.012771788984537125, -0.01437467709183693, minz + 0.0015845317393541336),
+ (maxx - 0.014393582940101624, -0.01431342400610447, minz + 0.002730119158513844),
+ (maxx - 0.014963079243898392, -0.014291912317276001, maxz - 0.004081433403984924),
+ (maxx - 0.014393582940101624, -0.01431342400610447, maxz - 0.0027301193913444877),
+ (maxx - 0.012771788984537125, -0.014374678023159504, maxz - 0.0015845298767089844),
+ (maxx - 0.010344602167606354, -0.014466352760791779, maxz - 0.0008190723601728678),
+ (maxx - 0.0074815452098846436, -0.014574489556252956, maxz - 0.0005502800922840834),
+ (maxx - 0.004618480801582336, maxy - 2.029310053330846e-11, maxz - 0.0008190718945115805),
+ (maxx - 0.002191290259361267, maxy - 7.808864666003501e-11, maxz - 0.0015845305752009153),
+ (maxx - 0.0005694925785064697, maxy - 1.645759084567544e-10, maxz - 0.002730119042098522),
+ (maxx, maxy - 2.665956344571896e-10, minz + 0.004081433353314345),
+ (maxx - 0.0005694925785064697, maxy - 3.686153604576248e-10, minz + 0.0027301188092678785),
+ (maxx - 0.002191290259361267, maxy - 4.5510972768170177e-10, minz + 0.0015845296438783407),
+ (maxx - 0.004618480801582336, maxy - 5.128981683810707e-10, minz + 0.0008190721273422241),
+ (maxx - 0.0074815452098846436, maxy - 5.331912689143792e-10, minz + 0.0005502798594534397),
+ (maxx - 0.010344602167606354, maxy - 5.128981683810707e-10, minz + 0.0008190721273422241),
+ (maxx - 0.012771788984537125, maxy - 4.5510972768170177e-10, minz + 0.0015845305752009153),
+ (maxx - 0.014393582940101624, maxy - 3.686153604576248e-10, minz + 0.0027301181107759476),
+ (maxx - 0.014963079243898392, maxy - 2.665956344571896e-10, minz + 0.00408143232919933),
+ (maxx - 0.014393582940101624, maxy - 1.645759084567544e-10, maxz - 0.002730120439082384),
+ (maxx - 0.012771788984537125, maxy - 7.808864666003501e-11, maxz - 0.0015845310408622026),
+ (maxx - 0.010344602167606354, maxy - 2.029310053330846e-11, maxz - 0.000819073524326086),
+ (maxx - 0.0074815452098846436, maxy, maxz - 0.0005502812564373016),
+ (minx + 0.013172738254070282, -0.025110241025686264, maxz - 0.0003106782678514719),
+ (minx + 0.012165598571300507, -0.027320515364408493, maxz - 0.0011954230722039938),
+ (minx + 0.011492650955915451, -0.028797375038266182, maxz - 0.0025195349007844925),
+ (minx + 0.011256340891122818, -0.029315980151295662, maxz - 0.0040814326939546675),
+ (minx + 0.011492650955915451, -0.02879737690091133, minz + 0.0025195364141836762),
+ (minx + 0.012165598571300507, -0.02732051908969879, minz + 0.0011954230722039938),
+ (minx + 0.013172738254070282, -0.025110244750976562, minz + 0.0003106798976659775),
+ (minx + 0.014360737055540085, -0.022503048181533813, minz),
+ (minx + 0.015548739582300186, -0.019895851612091064, minz + 0.00031067943200469017),
+ (minx + 0.01655587926506996, -0.017685577273368835, minz + 0.001195424236357212),
+ (minx + 0.017228826880455017, -0.016208721324801445, minz + 0.0025195354828611016),
+ (minx + 0.01746513321995735, -0.015690118074417114, minz + 0.00408143286244389),
+ (minx + 0.017228826880455017, -0.016208721324801445, maxz - 0.0025195367634296417),
+ (minx + 0.01655587926506996, -0.017685577273368835, maxz - 0.0011954237706959248),
+ (minx + 0.015548739582300186, -0.019895853474736214, maxz - 0.00031068059615790844),
+ (minx + 0.014360737055540085, -0.022503050044178963, maxz),
+ (maxx - 0.07222597673535347, -0.022503051906824112, maxz),
+ (maxx - 0.07222597673535347, -0.019637949764728546, maxz - 0.00031068059615790844),
+ (maxx - 0.07222597673535347, -0.01720903068780899, maxz - 0.0011954237706959248),
+ (maxx - 0.07222597673535347, -0.015586081892251968, maxz - 0.0025195368798449636),
+ (maxx - 0.07222597673535347, -0.015016178600490093, minz + 0.004081432688119335),
+ (maxx - 0.07222597673535347, -0.015586081892251968, minz + 0.00251953536644578),
+ (maxx - 0.07222597673535347, -0.01720903068780899, minz + 0.001195424236357212),
+ (maxx - 0.07222597673535347, -0.019637947902083397, minz + 0.00031067943200469017),
+ (maxx - 0.07222597673535347, -0.022503051906824112, minz),
+ (maxx - 0.07222597673535347, -0.025368154048919678, minz + 0.0003106798976659775),
+ (maxx - 0.07222597673535347, -0.027797073125839233, minz + 0.0011954230722039938),
+ (maxx - 0.07222597673535347, -0.029420025646686554, minz + 0.0025195364141836762),
+ (maxx - 0.07222597673535347, -0.029989928007125854, maxz - 0.004081432643072702),
+ (maxx - 0.07222597673535347, -0.029420021921396255, maxz - 0.0025195349007844925),
+ (maxx - 0.07222597673535347, -0.027797069400548935, maxz - 0.0011954230722039938),
+ (maxx - 0.07222597673535347, -0.025368154048919678, maxz - 0.0003106782678514719),
+ (minx + 0.00908602774143219, -0.022446047514677048, maxz - 0.0003106782678514719),
+ (minx + 0.007382035255432129, -0.024176951497793198, maxz - 0.0011954226065427065),
+ (minx + 0.006243467330932617, -0.025333505123853683, maxz - 0.002519535133615136),
+ (minx + 0.005843639373779297, -0.025739632546901703, maxz - 0.004081432702012222),
+ (minx + 0.006243467330932617, -0.025333506986498833, minz + 0.0025195362977683544),
+ (minx + 0.007382035255432129, -0.024176953360438347, minz + 0.0011954230722039938),
+ (minx + 0.00908602774143219, -0.022446051239967346, minz + 0.0003106798976659775),
+ (minx + 0.011096034198999405, -0.020404310896992683, minz),
+ (minx + 0.013106044381856918, -0.01836257427930832, minz + 0.0003106796648353338),
+ (minx + 0.014810040593147278, -0.01663167029619217, minz + 0.001195424236357212),
+ (minx + 0.015948619693517685, -0.015475118532776833, minz + 0.0025195355992764235),
+ (minx + 0.016348429024219513, -0.015068991109728813, minz + 0.004081432861045897),
+ (minx + 0.015948619693517685, -0.015475118532776833, maxz - 0.00251953664701432),
+ (minx + 0.014810040593147278, -0.01663167029619217, maxz - 0.0011954233050346375),
+ (minx + 0.01310604065656662, -0.01836257241666317, maxz - 0.0003106803633272648),
+ (minx + 0.011096034198999405, -0.020404312759637833, maxz - 4.656612873077393e-10),
+ (minx + 0.004618480801582336, -0.01468262542039156, maxz - 0.0008190707303583622),
+ (minx + 0.002191305160522461, -0.014774298295378685, maxz - 0.001584529411047697),
+ (minx + 0.0005695074796676636, -0.014835557900369167, maxz - 0.002730117877945304),
+ (minx, -0.014857066795229912, maxz - 0.004081432337202706),
+ (minx + 0.0005694925785064697, -0.014835558831691742, minz + 0.002730119973421097),
+ (minx + 0.002191290259361267, -0.014774300158023834, minz + 0.001584530808031559),
+ (minx + 0.004618480801582336, -0.01468262542039156, minz + 0.0008190732914954424),
+ (minx + 0.0074815452098846436, -0.014574488624930382, minz + 0.000550281023606658),
+ (minx + 0.01034460961818695, -0.014466354623436928, minz + 0.0008190732914954424),
+ (minx + 0.012771796435117722, -0.01437467709183693, minz + 0.0015845317393541336),
+ (minx + 0.01439359039068222, -0.01431342400610447, minz + 0.002730119158513844),
+ (minx + 0.014963086694478989, -0.014291912317276001, maxz - 0.004081433403984924),
+ (minx + 0.01439359039068222, -0.01431342400610447, maxz - 0.0027301193913444877),
+ (minx + 0.012771796435117722, -0.014374678023159504, maxz - 0.0015845298767089844),
+ (minx + 0.01034460961818695, -0.014466352760791779, maxz - 0.0008190723601728678),
+ (minx + 0.0074815452098846436, -0.014574489556252956, maxz - 0.0005502800922840834),
+ (minx + 0.004618480801582336, maxy - 2.029310053330846e-11, maxz - 0.0008190718945115805),
+ (minx + 0.002191305160522461, maxy - 7.808864666003501e-11, maxz - 0.0015845305752009153),
+ (minx + 0.0005695074796676636, maxy - 1.645759084567544e-10, maxz - 0.002730119042098522),
+ (minx, maxy - 2.665956344571896e-10, minz + 0.004081433353314345),
+ (minx + 0.0005694925785064697, maxy - 3.686153604576248e-10, minz + 0.0027301188092678785),
+ (minx + 0.002191290259361267, maxy - 4.5510972768170177e-10, minz + 0.0015845296438783407),
+ (minx + 0.004618480801582336, maxy - 5.128981683810707e-10, minz + 0.0008190721273422241),
+ (minx + 0.0074815452098846436, maxy - 5.331912689143792e-10, minz + 0.0005502798594534397),
+ (minx + 0.01034460961818695, maxy - 5.128981683810707e-10, minz + 0.0008190721273422241),
+ (minx + 0.012771796435117722, maxy - 4.5510972768170177e-10, minz + 0.0015845305752009153),
+ (minx + 0.01439359039068222, maxy - 3.686153604576248e-10, minz + 0.0027301181107759476),
+ (minx + 0.014963086694478989, maxy - 2.665956344571896e-10, minz + 0.00408143232919933),
+ (minx + 0.01439359039068222, maxy - 1.645759084567544e-10, maxz - 0.002730120439082384),
+ (minx + 0.012771796435117722, maxy - 7.808864666003501e-11, maxz - 0.0015845310408622026),
+ (minx + 0.01034460961818695, maxy - 2.029310053330846e-11, maxz - 0.000819073524326086),
+ (minx + 0.0074815452098846436, maxy, maxz - 0.0005502812564373016)]
+
+ # Faces
+ myfaces = [(90, 89, 6, 5), (88, 87, 8, 7), (86, 85, 10, 9), (84, 83, 12, 11), (80, 95, 0, 15),
+ (82, 81, 14, 13), (93, 92, 3, 2), (91, 90, 5, 4), (89, 88, 7, 6), (87, 86, 9, 8),
+ (85, 84, 11, 10), (95, 94, 1, 0), (83, 82, 13, 12), (94, 93, 2, 1), (81, 80, 15, 14),
+ (92, 91, 4, 3), (2, 3, 19, 18), (13, 14, 30, 29), (15, 0, 16, 31), (11, 12, 28, 27),
+ (9, 10, 26, 25), (7, 8, 24, 23), (5, 6, 22, 21), (3, 4, 20, 19), (14, 15, 31, 30),
+ (1, 2, 18, 17), (12, 13, 29, 28), (0, 1, 17, 16), (10, 11, 27, 26), (8, 9, 25, 24),
+ (6, 7, 23, 22), (4, 5, 21, 20), (19, 20, 36, 35), (30, 31, 47, 46), (17, 18, 34, 33),
+ (28, 29, 45, 44), (16, 17, 33, 32), (26, 27, 43, 42), (24, 25, 41, 40), (22, 23, 39, 38),
+ (20, 21, 37, 36), (18, 19, 35, 34), (29, 30, 46, 45), (31, 16, 32, 47), (27, 28, 44, 43),
+ (25, 26, 42, 41), (23, 24, 40, 39), (21, 22, 38, 37), (36, 37, 53, 52), (34, 35, 51, 50),
+ (45, 46, 62, 61), (47, 32, 48, 63), (43, 44, 60, 59), (41, 42, 58, 57), (39, 40, 56, 55),
+ (37, 38, 54, 53), (35, 36, 52, 51), (46, 47, 63, 62), (33, 34, 50, 49), (44, 45, 61, 60),
+ (32, 33, 49, 48), (42, 43, 59, 58), (40, 41, 57, 56), (38, 39, 55, 54), (90, 69, 70, 89),
+ (88, 71, 72, 87), (86, 73, 74, 85), (84, 75, 76, 83), (80, 79, 64, 95), (82, 77, 78, 81),
+ (93, 66, 67, 92), (91, 68, 69, 90), (89, 70, 71, 88), (87, 72, 73, 86), (85, 74, 75, 84),
+ (95, 64, 65, 94), (83, 76, 77, 82), (94, 65, 66, 93), (81, 78, 79, 80), (92, 67, 68, 91),
+ (66, 98, 99, 67), (77, 109, 110, 78), (79, 111, 96, 64), (75, 107, 108, 76), (73, 105, 106, 74),
+ (71, 103, 104, 72), (69, 101, 102, 70), (67, 99, 100, 68), (78, 110, 111, 79), (65, 97, 98, 66),
+ (76, 108, 109, 77), (64, 96, 97, 65), (74, 106, 107, 75), (72, 104, 105, 73), (70, 102, 103, 71),
+ (68, 100, 101, 69), (99, 115, 116, 100), (110, 126, 127, 111), (97, 113, 114, 98), (108, 124, 125, 109),
+ (96, 112, 113, 97), (106, 122, 123, 107), (104, 120, 121, 105), (102, 118, 119, 103),
+ (100, 116, 117, 101),
+ (98, 114, 115, 99), (109, 125, 126, 110), (111, 127, 112, 96), (107, 123, 124, 108),
+ (105, 121, 122, 106),
+ (103, 119, 120, 104), (101, 117, 118, 102), (116, 132, 133, 117), (114, 130, 131, 115),
+ (125, 141, 142, 126),
+ (127, 143, 128, 112), (123, 139, 140, 124), (121, 137, 138, 122), (119, 135, 136, 120),
+ (117, 133, 134, 118),
+ (115, 131, 132, 116), (126, 142, 143, 127), (113, 129, 130, 114), (124, 140, 141, 125),
+ (112, 128, 129, 113),
+ (122, 138, 139, 123), (120, 136, 137, 121), (118, 134, 135, 119)]
+
+ return myvertex, myfaces
+
+
+# ----------------------------------------------
+# Handle model 02
+# ----------------------------------------------
+def handle_model_02():
+ # ------------------------------------
+ # Mesh data
+ # ------------------------------------
+ minx = -0.09079331159591675
+ maxx = 0.09079315513372421
+ maxy = 0
+ minz = -0.018363870680332184
+ maxz = 0.0015741242095828056
+
+ # Vertex
+ myvertex = [(maxx, maxy, maxz - 9.313225746154785e-10),
+ (maxx, maxy, maxz - 0.0031482474878430367),
+ (maxx, -0.02426009438931942, maxz - 0.0031482460908591747),
+ (maxx, -0.02426009438931942, maxz),
+ (maxx, -0.02727462910115719, maxz),
+ (maxx, -0.02727462910115719, maxz - 0.0031482460908591747),
+ (maxx, -0.02426009625196457, minz + 0.002603583037853241),
+ (maxx, -0.027274630963802338, minz + 0.002603583037853241),
+ (maxx, -0.02426009625196457, minz),
+ (maxx, -0.027274630963802338, minz),
+ (maxx, -0.021415365859866142, minz + 0.002603583037853241),
+ (maxx, -0.02141536772251129, minz),
+ (maxx - 0.0907932324437013, -0.02426009438931942, maxz - 0.0031482460908591747),
+ (maxx - 0.0907932324437013, -0.02426009438931942, maxz),
+ (minx, maxy, maxz - 9.313225746154785e-10),
+ (minx, maxy, maxz - 0.0031482474878430367),
+ (minx, -0.02426009438931942, maxz - 0.0031482460908591747),
+ (minx, -0.02426009438931942, maxz),
+ (minx, -0.02727462910115719, maxz),
+ (minx, -0.02727462910115719, maxz - 0.0031482460908591747),
+ (maxx - 0.0907932324437013, -0.02727462910115719, maxz),
+ (maxx - 0.0907932324437013, maxy, maxz - 9.313225746154785e-10),
+ (maxx - 0.0907932324437013, -0.02727462910115719, maxz - 0.0031482460908591747),
+ (maxx - 0.0907932324437013, maxy, maxz - 0.0031482474878430367),
+ (maxx - 0.0907932324437013, -0.02426009625196457, minz + 0.002603583037853241),
+ (minx, -0.02426009625196457, minz + 0.002603583037853241),
+ (minx, -0.027274630963802338, minz + 0.002603583037853241),
+ (maxx - 0.0907932324437013, -0.027274630963802338, minz + 0.002603583037853241),
+ (maxx - 0.0907932324437013, -0.02426009625196457, minz),
+ (minx, -0.02426009625196457, minz),
+ (minx, -0.027274630963802338, minz),
+ (maxx - 0.0907932324437013, -0.027274630963802338, minz),
+ (maxx - 0.0907932324437013, -0.021415365859866142, minz + 0.002603583037853241),
+ (minx, -0.021415365859866142, minz + 0.002603583037853241),
+ (maxx - 0.0907932324437013, -0.02141536772251129, minz),
+ (minx, -0.02141536772251129, minz)]
+
+ # Faces
+ myfaces = [(2, 5, 7, 6), (13, 3, 0, 21), (3, 2, 1, 0), (7, 27, 31, 9), (23, 21, 0, 1),
+ (5, 22, 27, 7), (4, 5, 2, 3), (2, 12, 23, 1), (20, 4, 3, 13), (5, 4, 20, 22),
+ (12, 2, 6, 24), (9, 31, 28, 8), (6, 7, 9, 8), (32, 10, 11, 34), (6, 8, 11, 10),
+ (8, 28, 34, 11), (24, 6, 10, 32), (16, 25, 26, 19), (13, 21, 14, 17), (17, 14, 15, 16),
+ (26, 30, 31, 27), (23, 15, 14, 21), (19, 26, 27, 22), (18, 17, 16, 19), (16, 15, 23, 12),
+ (20, 13, 17, 18), (19, 22, 20, 18), (22, 27, 24, 12), (12, 24, 25, 16), (30, 29, 28, 31),
+ (25, 29, 30, 26), (27, 31, 28, 24), (28, 34, 32, 24), (32, 34, 35, 33), (25, 33, 35, 29),
+ (29, 35, 34, 28), (24, 32, 33, 25)]
+
+ return myvertex, myfaces
+
+
+# ----------------------------------------------
+# Handle model 05
+# ----------------------------------------------
+def handle_model_05():
+ # ------------------------------------
+ # Mesh data
+ # ------------------------------------
+ minx = -0.012873317115008831
+ maxx = 0.012873315252363682
+ maxy = 6.581399869531879e-10
+ minz = -0.012873317115008831
+ maxz = 0.012873315252363682
+
+ # Vertex
+ myvertex = [(maxx - 0.01287331552838386, maxy, maxz - 0.008879524189978838),
+ (maxx - 0.01287331552838386, -0.004451401997357607, maxz - 0.008879524189978838),
+ (maxx - 0.012094165373127908, maxy, maxz - 0.008956264238804579),
+ (maxx - 0.012094165373127908, -0.004451401997357607, maxz - 0.008956263773143291),
+ (maxx - 0.011344957514666021, maxy, maxz - 0.00918353395536542),
+ (maxx - 0.011344957514666021, -0.004451401997357607, maxz - 0.009183533489704132),
+ (maxx - 0.010654483688995242, maxy, maxz - 0.00955259962938726),
+ (maxx - 0.010654483688995242, -0.004451401997357607, maxz - 0.009552599163725972),
+ (maxx - 0.010049278382211924, maxy, maxz - 0.010049279080703855),
+ (maxx - 0.010049278382211924, -0.004451401997357607, maxz - 0.010049278382211924),
+ (maxx - 0.009552599163725972, maxy - 6.581399869531879e-10, maxz - 0.01065448485314846),
+ (maxx - 0.009552599163725972, -0.004451401997357607, maxz - 0.01065448415465653),
+ (maxx - 0.009183533489704132, maxy - 6.581399869531879e-10, maxz - 0.011344958445988595),
+ (maxx - 0.009183533489704132, -0.004451401997357607, maxz - 0.011344957863911986),
+ (maxx - 0.008956263773143291, maxy - 6.581399869531879e-10, maxz - 0.0120941661298275),
+ (maxx - 0.008956263773143291, -0.004451401997357607, maxz - 0.012094165605958551),
+ (maxx - 0.008879524189978838, maxy - 6.581399869531879e-10, maxz - 0.012873315995101497),
+ (maxx - 0.008879524189978838, -0.004451401997357607, maxz - 0.012873315519886824),
+ (maxx - 0.008956263307482004, maxy - 6.581399869531879e-10, minz + 0.012094166420865804),
+ (maxx - 0.008956263307482004, -0.004451401997357607, minz + 0.01209416682831943),
+ (maxx - 0.009183533024042845, maxy - 6.581399869531879e-10, minz + 0.011344958795234561),
+ (maxx - 0.009183533024042845, -0.004451401997357607, minz + 0.011344959260895848),
+ (maxx - 0.009552599163725972, maxy - 6.581399869531879e-10, minz + 0.01065448415465653),
+ (maxx - 0.009552599163725972, -0.004451401997357607, minz + 0.01065448485314846),
+ (maxx - 0.010049278382211924, -6.581399869531879e-10, minz + 0.010049278847873211),
+ (maxx - 0.010049278382211924, -0.004451401997357607, minz + 0.010049279546365142),
+ (maxx - 0.010654483921825886, -6.581399869531879e-10, minz + 0.00955259962938726),
+ (maxx - 0.010654483921825886, -0.004451401997357607, minz + 0.009552600095048547),
+ (maxx - 0.011344958213157952, -6.581399869531879e-10, minz + 0.009183533256873488),
+ (maxx - 0.011344958213157952, -0.004451401997357607, minz + 0.009183533489704132),
+ (maxx - 0.012094166362658143, -6.581399869531879e-10, minz + 0.008956264238804579),
+ (maxx - 0.012094166362658143, -0.004451401997357607, minz + 0.008956264238804579),
+ (minx + 0.012873315537646146, -6.581399869531879e-10, minz + 0.008879524655640125),
+ (minx + 0.012873315537646146, -0.004451401997357607, minz + 0.008879525121301413),
+ (minx + 0.012094165082089603, -6.581399869531879e-10, minz + 0.008956264238804579),
+ (minx + 0.012094165082089603, -0.004451401997357607, minz + 0.008956264704465866),
+ (minx + 0.011344957165420055, -6.581399869531879e-10, minz + 0.009183534886687994),
+ (minx + 0.011344957165420055, -0.004451401997357607, minz + 0.009183535352349281),
+ (minx + 0.010654483223333955, -6.581399869531879e-10, minz + 0.009552601026371121),
+ (minx + 0.010654483223333955, -0.004451401997357607, minz + 0.009552601724863052),
+ (minx + 0.010049277916550636, -6.581399869531879e-10, minz + 0.010049280477687716),
+ (minx + 0.010049277916550636, -0.004451401997357607, minz + 0.010049281176179647),
+ (minx + 0.009552598698064685, maxy - 6.581399869531879e-10, minz + 0.010654486482962966),
+ (minx + 0.009552598698064685, -0.004451401997357607, minz + 0.010654486948624253),
+ (minx + 0.009183533024042845, maxy - 6.581399869531879e-10, minz + 0.011344961123540998),
+ (minx + 0.009183533024042845, -0.004451401997357607, minz + 0.011344961589202285),
+ (minx + 0.008956264238804579, maxy - 6.581399869531879e-10, minz + 0.01209416938945651),
+ (minx + 0.008956264238804579, -0.004451401997357607, minz + 0.012094169855117798),
+ (minx + 0.008879525121301413, maxy - 6.581399869531879e-10, maxz - 0.012873312440222273),
+ (minx + 0.008879525121301413, -0.004451401997357607, maxz - 0.012873311965007517),
+ (minx + 0.008956265170127153, maxy - 6.581399869531879e-10, maxz - 0.012094162055291235),
+ (minx + 0.008956265170127153, -0.004451401997357607, maxz - 0.012094161589629948),
+ (minx + 0.009183535818010569, maxy - 6.581399869531879e-10, maxz - 0.01134495425503701),
+ (minx + 0.009183535818010569, -0.004451401997357607, maxz - 0.011344953789375722),
+ (minx + 0.009552602656185627, maxy - 6.581399869531879e-10, maxz - 0.010654480429366231),
+ (minx + 0.009552602656185627, -0.004451401997357607, maxz - 0.010654479963704944),
+ (minx + 0.01004928327165544, maxy, maxz - 0.010049275355413556),
+ (minx + 0.01004928327165544, -0.004451401997357607, maxz - 0.010049275122582912),
+ (minx + 0.010654489509761333, maxy, maxz - 0.009552596602588892),
+ (minx + 0.010654489509761333, -0.004451401997357607, maxz - 0.009552596136927605),
+ (minx + 0.011344964150339365, maxy, maxz - 0.00918353139422834),
+ (minx + 0.011344964150339365, -0.004451401997357607, maxz - 0.009183531161397696),
+ (minx + 0.012094172765500844, maxy, maxz - 0.008956263307482004),
+ (minx + 0.012094172765500844, -0.004451401997357607, maxz - 0.00895626237615943),
+ (minx + 0.01287331571475725, -0.01000460609793663, maxz),
+ (maxx - 0.010361857246607542, -0.01000460609793663, maxz - 0.0002473592758178711),
+ (maxx - 0.00794691126793623, -0.01000460609793663, maxz - 0.0009799236431717873),
+ (maxx - 0.005721285007894039, -0.01000460609793663, maxz - 0.002169545739889145),
+ (maxx - 0.0037705078721046448, -0.01000460609793663, maxz - 0.0037705088034272194),
+ (maxx - 0.002169545739889145, -0.01000460609793663, maxz - 0.005721286870539188),
+ (maxx - 0.0009799227118492126, -0.010004607029259205, maxz - 0.007946912664920092),
+ (maxx - 0.00024735741317272186, -0.010004607029259205, maxz - 0.010361858177930117),
+ (maxx, -0.010004607029259205, minz + 0.012873315524888684),
+ (maxx - 0.00024735648185014725, -0.010004607029259205, minz + 0.010361856315284967),
+ (maxx - 0.0009799227118492126, -0.010004607029259205, minz + 0.007946911733597517),
+ (maxx - 0.002169545739889145, -0.01000460796058178, minz + 0.005721283610910177),
+ (maxx - 0.0037705078721046448, -0.01000460796058178, minz + 0.003770505078136921),
+ (maxx - 0.005721286404877901, -0.01000460796058178, minz + 0.002169542945921421),
+ (maxx - 0.007946913596242666, -0.01000460796058178, minz + 0.0009799208492040634),
+ (maxx - 0.010361860506236553, -0.01000460796058178, minz + 0.00024735648185014725),
+ (minx + 0.012873311520098518, -0.01000460796058178, minz),
+ (minx + 0.010361851193010807, -0.01000460796058178, minz + 0.00024735648185014725),
+ (minx + 0.007946905214339495, -0.01000460796058178, minz + 0.0009799255058169365),
+ (minx + 0.005721278488636017, -0.01000460796058178, minz + 0.0021695485338568687),
+ (minx + 0.003770500421524048, -0.01000460796058178, minz + 0.0037705106660723686),
+ (minx + 0.002169538289308548, -0.01000460796058178, minz + 0.005721290595829487),
+ (minx + 0.0009799189865589142, -0.010004607029259205, minz + 0.007946919184178114),
+ (minx + 0.000247354619204998, -0.010004607029259205, minz + 0.010361866094172001),
+ (minx, -0.010004607029259205, maxz - 0.012873305383929612),
+ (minx + 0.0002473592758178711, -0.010004607029259205, maxz - 0.010361845139414072),
+ (minx + 0.0009799282997846603, -0.010004607029259205, maxz - 0.007946899626404047),
+ (minx + 0.0021695513278245926, -0.01000460609793663, maxz - 0.005721272900700569),
+ (minx + 0.003770517185330391, -0.01000460609793663, maxz - 0.003770497627556324),
+ (minx + 0.005721298512071371, -0.01000460609793663, maxz - 0.0021695364266633987),
+ (minx + 0.00794692849740386, -0.01000460609793663, maxz - 0.0009799161925911903),
+ (minx + 0.010361875407397747, -0.01000460609793663, maxz - 0.000247354619204998),
+ (minx + 0.01287331571475725, -0.012252332642674446, maxz),
+ (maxx - 0.010361857246607542, -0.012252332642674446, maxz - 0.0002473592758178711),
+ (maxx - 0.00794691126793623, -0.012252332642674446, maxz - 0.0009799236431717873),
+ (maxx - 0.005721285007894039, -0.012252332642674446, maxz - 0.002169545739889145),
+ (maxx - 0.0037705078721046448, -0.012252332642674446, maxz - 0.0037705088034272194),
+ (maxx - 0.002169545739889145, -0.012252332642674446, maxz - 0.005721286870539188),
+ (maxx - 0.0009799227118492126, -0.012252334505319595, maxz - 0.007946912664920092),
+ (maxx - 0.00024735741317272186, -0.012252334505319595, maxz - 0.010361858177930117),
+ (maxx, -0.012252334505319595, minz + 0.012873315638136429),
+ (maxx - 0.00024735648185014725, -0.012252334505319595, minz + 0.010361856315284967),
+ (maxx - 0.0009799227118492126, -0.012252334505319595, minz + 0.007946911733597517),
+ (maxx - 0.002169545739889145, -0.01225233543664217, minz + 0.005721283610910177),
+ (maxx - 0.0037705078721046448, -0.01225233543664217, minz + 0.003770505078136921),
+ (maxx - 0.005721286404877901, -0.01225233543664217, minz + 0.002169542945921421),
+ (maxx - 0.007946913596242666, -0.01225233543664217, minz + 0.0009799208492040634),
+ (maxx - 0.010361860506236553, -0.01225233543664217, minz + 0.00024735648185014725),
+ (minx + 0.012873311520098518, -0.01225233543664217, minz),
+ (minx + 0.010361851193010807, -0.01225233543664217, minz + 0.00024735648185014725),
+ (minx + 0.007946905214339495, -0.01225233543664217, minz + 0.0009799255058169365),
+ (minx + 0.005721278488636017, -0.01225233543664217, minz + 0.0021695485338568687),
+ (minx + 0.003770500421524048, -0.01225233543664217, minz + 0.0037705106660723686),
+ (minx + 0.002169538289308548, -0.01225233543664217, minz + 0.005721290595829487),
+ (minx + 0.0009799189865589142, -0.012252334505319595, minz + 0.007946919184178114),
+ (minx + 0.000247354619204998, -0.012252334505319595, minz + 0.010361866094172001),
+ (minx, -0.012252334505319595, maxz - 0.012873305270680646),
+ (minx + 0.0002473592758178711, -0.012252334505319595, maxz - 0.010361845139414072),
+ (minx + 0.0009799282997846603, -0.012252334505319595, maxz - 0.007946899626404047),
+ (minx + 0.0021695513278245926, -0.012252332642674446, maxz - 0.005721272900700569),
+ (minx + 0.003770517185330391, -0.012252332642674446, maxz - 0.003770497627556324),
+ (minx + 0.005721298512071371, -0.012252332642674446, maxz - 0.0021695364266633987),
+ (minx + 0.00794692849740386, -0.012252332642674446, maxz - 0.0009799161925911903),
+ (minx + 0.010361875407397747, -0.012252332642674446, maxz - 0.000247354619204998),
+ (minx + 0.01287331597587027, -0.012252331711351871, maxz - 0.006033936515450478),
+ (maxx - 0.011539019644260406, -0.012252331711351871, maxz - 0.006165354512631893),
+ (maxx - 0.010255999164655805, -0.012252331711351871, maxz - 0.006554554216563702),
+ (maxx - 0.009073560824617743, -0.012252332642674446, maxz - 0.007186579518020153),
+ (maxx - 0.008037144783884287, -0.012252332642674446, maxz - 0.008037144318223),
+ (maxx - 0.007186580915004015, -0.012252332642674446, maxz - 0.009073559893295169),
+ (maxx - 0.006554554216563702, -0.012252332642674446, maxz - 0.010255998698994517),
+ (maxx - 0.006165354512631893, -0.012252332642674446, maxz - 0.011539018712937832),
+ (maxx - 0.006033937446773052, -0.012252332642674446, maxz - 0.012873314963572108),
+ (maxx - 0.0061653535813093185, -0.012252332642674446, minz + 0.011539021041244268),
+ (maxx - 0.006554554216563702, -0.012252332642674446, minz + 0.01025600079447031),
+ (maxx - 0.007186580915004015, -0.012252332642674446, minz + 0.009073561755940318),
+ (maxx - 0.008037144783884287, -0.012252332642674446, minz + 0.008037145715206861),
+ (maxx - 0.009073561057448387, -0.012252332642674446, minz + 0.007186580449342728),
+ (maxx - 0.010256000561639667, -0.012252334505319595, minz + 0.006554553750902414),
+ (maxx - 0.011539021274074912, -0.012252334505319595, minz + 0.0061653549782931805),
+ (minx + 0.012873313747317816, -0.012252334505319595, minz + 0.006033938378095627),
+ (minx + 0.01153901673387736, -0.012252334505319595, minz + 0.0061653549782931805),
+ (minx + 0.01025599567219615, -0.012252334505319595, minz + 0.0065545570105314255),
+ (minx + 0.009073557797819376, -0.012252332642674446, minz + 0.007186583708971739),
+ (minx + 0.008037141524255276, -0.012252332642674446, minz + 0.008037148043513298),
+ (minx + 0.007186576724052429, -0.012252332642674446, minz + 0.00907356571406126),
+ (minx + 0.006554551888257265, -0.012252332642674446, minz + 0.010256004752591252),
+ (minx + 0.006165352184325457, -0.012252332642674446, minz + 0.011539026163518429),
+ (minx + 0.006033936981111765, -0.012252332642674446, maxz - 0.012873308875832823),
+ (minx + 0.006165355443954468, -0.012252332642674446, maxz - 0.011539011728018522),
+ (minx + 0.006554556544870138, -0.012252332642674446, maxz - 0.010255991481244564),
+ (minx + 0.007186584174633026, -0.012252332642674446, maxz - 0.00907355290837586),
+ (minx + 0.008037150837481022, -0.012252332642674446, maxz - 0.008037138264626265),
+ (minx + 0.009073568508028984, -0.012252332642674446, maxz - 0.007186574395745993),
+ (minx + 0.010256008245050907, -0.012252331711351871, maxz - 0.006554548628628254),
+ (minx + 0.011539029655978084, -0.012252331711351871, maxz - 0.006165351718664169),
+ (maxx - 0.01237887132447213, -0.012252329848706722, maxz - 0.010387574089691043),
+ (maxx - 0.011465257033705711, -0.012252329848706722, maxz - 0.01076600537635386),
+ (maxx - 0.01108119694981724, -0.012252329848706722, maxz - 0.011081195320002735),
+ (maxx - 0.010766007238999009, -0.012252329848706722, maxz - 0.011465255171060562),
+ (maxx - 0.010531799867749214, -0.012252329848706722, maxz - 0.01190342620247975),
+ (maxx - 0.01108119694981724, -0.012252329848706722, minz + 0.01108119951095432),
+ (maxx - 0.011903428356163204, -0.012252329848706722, minz + 0.010531801730394363),
+ (minx + 0.012378871033433825, -0.012252329848706722, minz + 0.010387577582150698),
+ (minx + 0.011465256451629102, -0.012252329848706722, minz + 0.01076600980013609),
+ (minx + 0.01076600607484579, -0.012252329848706722, minz + 0.011465260875411332),
+ (minx + 0.010531799402087927, -0.012252329848706722, minz + 0.011903432430699468),
+ (minx + 0.010338877560570836, -0.012252329848706722, maxz - 0.01287331168983985),
+ (minx + 0.010531801264733076, -0.012252329848706722, maxz - 0.01190342364134267),
+ (minx + 0.011081199743784964, -0.012252329848706722, maxz - 0.011081192875280976),
+ (minx + 0.011465260293334723, -0.012252329848706722, maxz - 0.010766003280878067),
+ (maxx - 0.01287331586396423, -0.012252329848706722, maxz - 0.010338874999433756),
+ (maxx - 0.011903427948709577, -0.012252329848706722, maxz - 0.010531798237934709),
+ (maxx - 0.010387575486674905, -0.012252329848706722, maxz - 0.012378869636449963),
+ (maxx - 0.010338877094909549, -0.012252329848706722, maxz - 0.012873313945746867),
+ (maxx - 0.010387575486674905, -0.012252329848706722, minz + 0.012378874002024531),
+ (maxx - 0.010531799867749214, -0.012252329848706722, minz + 0.011903430917300284),
+ (maxx - 0.010766007238999009, -0.012252329848706722, minz + 0.011465259245596826),
+ (maxx - 0.011465257382951677, -0.012252329848706722, minz + 0.010766008868813515),
+ (maxx - 0.01237887202296406, -0.012252329848706722, minz + 0.010387577582150698),
+ (minx + 0.01287331567758343, -0.012252329848706722, minz + 0.010338879656046629),
+ (minx + 0.011903427541255951, -0.012252329848706722, minz + 0.010531802894547582),
+ (minx + 0.011081196367740631, -0.012252329848706722, minz + 0.011081200325861573),
+ (minx + 0.010387575021013618, -0.012252329848706722, minz + 0.01237887586466968),
+ (minx + 0.01038757641799748, -0.012252329848706722, maxz - 0.012378867017105222),
+ (minx + 0.010766008868813515, -0.012252329848706722, maxz - 0.011465252609923482),
+ (minx + 0.011903432314284146, -0.012252329848706722, maxz - 0.01053179637528956),
+ (minx + 0.01237887580646202, -0.012252329848706722, maxz - 0.010387573391199112)]
+
+ # Faces
+ myfaces = [(0, 1, 3, 2), (2, 3, 5, 4), (4, 5, 7, 6), (6, 7, 9, 8), (8, 9, 11, 10),
+ (10, 11, 13, 12), (12, 13, 15, 14), (14, 15, 17, 16), (16, 17, 19, 18), (18, 19, 21, 20),
+ (20, 21, 23, 22), (22, 23, 25, 24), (24, 25, 27, 26), (26, 27, 29, 28), (28, 29, 31, 30),
+ (30, 31, 33, 32), (32, 33, 35, 34), (34, 35, 37, 36), (36, 37, 39, 38), (38, 39, 41, 40),
+ (40, 41, 43, 42), (42, 43, 45, 44), (44, 45, 47, 46), (46, 47, 49, 48), (48, 49, 51, 50),
+ (50, 51, 53, 52), (52, 53, 55, 54), (54, 55, 57, 56), (56, 57, 59, 58), (58, 59, 61, 60),
+ (60, 61, 63, 62), (62, 63, 1, 0), (45, 43, 85, 86), (23, 21, 74, 75), (51, 49, 88, 89),
+ (7, 5, 66, 67), (29, 27, 77, 78), (57, 55, 91, 92), (35, 33, 80, 81), (13, 11, 69, 70),
+ (63, 61, 94, 95), (41, 39, 83, 84), (19, 17, 72, 73), (47, 45, 86, 87), (3, 1, 64, 65),
+ (25, 23, 75, 76), (53, 51, 89, 90), (9, 7, 67, 68), (31, 29, 78, 79), (59, 57, 92, 93),
+ (37, 35, 81, 82), (15, 13, 70, 71), (1, 63, 95, 64), (43, 41, 84, 85), (21, 19, 73, 74),
+ (49, 47, 87, 88), (5, 3, 65, 66), (27, 25, 76, 77), (55, 53, 90, 91), (11, 9, 68, 69),
+ (33, 31, 79, 80), (61, 59, 93, 94), (39, 37, 82, 83), (17, 15, 71, 72), (89, 88, 120, 121),
+ (67, 66, 98, 99), (78, 77, 109, 110), (87, 86, 118, 119), (65, 64, 96, 97), (76, 75, 107, 108),
+ (64, 95, 127, 96), (85, 84, 116, 117), (74, 73, 105, 106), (94, 93, 125, 126), (83, 82, 114, 115),
+ (72, 71, 103, 104), (92, 91, 123, 124), (81, 80, 112, 113), (70, 69, 101, 102), (90, 89, 121, 122),
+ (68, 67, 99, 100), (79, 78, 110, 111), (88, 87, 119, 120), (66, 65, 97, 98), (77, 76, 108, 109),
+ (86, 85, 117, 118), (75, 74, 106, 107), (95, 94, 126, 127), (84, 83, 115, 116), (73, 72, 104, 105),
+ (93, 92, 124, 125), (82, 81, 113, 114), (71, 70, 102, 103), (91, 90, 122, 123), (69, 68, 100, 101),
+ (80, 79, 111, 112), (123, 122, 154, 155), (101, 100, 132, 133), (112, 111, 143, 144),
+ (121, 120, 152, 153),
+ (99, 98, 130, 131), (110, 109, 141, 142), (119, 118, 150, 151), (97, 96, 128, 129), (108, 107, 139, 140),
+ (96, 127, 159, 128), (117, 116, 148, 149), (106, 105, 137, 138), (126, 125, 157, 158),
+ (115, 114, 146, 147),
+ (104, 103, 135, 136), (124, 123, 155, 156), (113, 112, 144, 145), (102, 101, 133, 134),
+ (122, 121, 153, 154),
+ (100, 99, 131, 132), (111, 110, 142, 143), (120, 119, 151, 152), (98, 97, 129, 130),
+ (109, 108, 140, 141),
+ (118, 117, 149, 150), (107, 106, 138, 139), (127, 126, 158, 159), (116, 115, 147, 148),
+ (105, 104, 136, 137),
+ (125, 124, 156, 157), (114, 113, 145, 146), (103, 102, 134, 135), (157, 156, 173, 174),
+ (133, 132, 162, 163),
+ (134, 133, 163, 164), (132, 131, 161, 162), (150, 149, 169, 170), (146, 145, 167, 185),
+ (135, 134, 164, 177),
+ (155, 154, 172, 189), (144, 143, 183, 184), (153, 152, 171, 188), (131, 130, 176, 161),
+ (142, 141, 182, 166),
+ (151, 150, 170, 187), (129, 128, 175, 160), (140, 139, 181, 165), (128, 159, 191, 175),
+ (149, 148, 186, 169),
+ (138, 137, 179, 180), (158, 157, 174, 190), (147, 146, 185, 168), (136, 135, 177, 178),
+ (156, 155, 189, 173),
+ (145, 144, 184, 167), (154, 153, 188, 172), (143, 142, 166, 183), (152, 151, 187, 171),
+ (130, 129, 160, 176),
+ (141, 140, 165, 182), (139, 138, 180, 181), (159, 158, 190, 191), (148, 147, 168, 186),
+ (137, 136, 178, 179),
+ (175, 191, 190, 174, 173, 189, 172, 188, 171, 187, 170, 169, 186, 168, 185, 167, 184, 183, 166, 182, 165,
+ 181, 180, 179, 178, 177, 164, 163, 162, 161, 176, 160)]
+
+ return myvertex, myfaces
+
+
+# ----------------------------------------------
+# Handle model 06
+# ----------------------------------------------
+def handle_model_06():
+ # ------------------------------------
+ # Mesh data
+ # ------------------------------------
+ minx = -0.021158458665013313
+ maxx = 0.021158456802368164
+ maxy = 6.581399869531879e-10
+ minz = -0.021158462390303612
+ maxz = 0.021158454939723015
+
+ # Vertex
+ myvertex = [(maxx - 0.021158457078388343, maxy, maxz - 0.01716466387733817),
+ (maxx - 0.021158457078388343, -0.004451401997357607, maxz - 0.01716466387733817),
+ (maxx - 0.02037930692313239, maxy, maxz - 0.017241403926163912),
+ (maxx - 0.02037930692313239, -0.004451401997357607, maxz - 0.017241403460502625),
+ (maxx - 0.019630099064670503, maxy, maxz - 0.017468673642724752),
+ (maxx - 0.019630099064670503, -0.004451401997357607, maxz - 0.017468673177063465),
+ (maxx - 0.018939625238999724, maxy, maxz - 0.017837739316746593),
+ (maxx - 0.018939625238999724, -0.004451401997357607, maxz - 0.017837738851085305),
+ (maxx - 0.018334419932216406, maxy, maxz - 0.018334418768063188),
+ (maxx - 0.018334419932216406, -0.004451401997357607, maxz - 0.018334418069571257),
+ (maxx - 0.017837740713730454, maxy - 6.581399869531879e-10, maxz - 0.018939624540507793),
+ (maxx - 0.017837740713730454, -0.004451401997357607, maxz - 0.018939623842015862),
+ (maxx - 0.017468675039708614, maxy - 6.581399869531879e-10, maxz - 0.01963009813334793),
+ (maxx - 0.017468675039708614, -0.004451401997357607, maxz - 0.01963009755127132),
+ (maxx - 0.017241405323147774, maxy - 6.581399869531879e-10, maxz - 0.020379305817186832),
+ (maxx - 0.017241405323147774, -0.004451401997357607, maxz - 0.020379305293317884),
+ (maxx - 0.01716466573998332, maxy - 6.581399869531879e-10, maxz - 0.02115845568246083),
+ (maxx - 0.01716466573998332, -0.004451401997357607, maxz - 0.021158455207246157),
+ (maxx - 0.017241404857486486, maxy - 6.581399869531879e-10, minz + 0.020379311696160585),
+ (maxx - 0.017241404857486486, -0.004451401997357607, minz + 0.02037931210361421),
+ (maxx - 0.017468674574047327, maxy - 6.581399869531879e-10, minz + 0.01963010407052934),
+ (maxx - 0.017468674574047327, -0.004451401997357607, minz + 0.01963010453619063),
+ (maxx - 0.017837740713730454, maxy - 6.581399869531879e-10, minz + 0.01893962942995131),
+ (maxx - 0.017837740713730454, -0.004451401997357607, minz + 0.01893963012844324),
+ (maxx - 0.018334419932216406, -6.581399869531879e-10, minz + 0.01833442412316799),
+ (maxx - 0.018334419932216406, -0.004451401997357607, minz + 0.018334424821659923),
+ (maxx - 0.018939625471830368, -6.581399869531879e-10, minz + 0.01783774490468204),
+ (maxx - 0.018939625471830368, -0.004451401997357607, minz + 0.017837745370343328),
+ (maxx - 0.019630099763162434, -6.581399869531879e-10, minz + 0.01746867853216827),
+ (maxx - 0.019630099763162434, -0.004451401997357607, minz + 0.017468678764998913),
+ (maxx - 0.020379307912662625, -6.581399869531879e-10, minz + 0.01724140951409936),
+ (maxx - 0.020379307912662625, -0.004451401997357607, minz + 0.01724140951409936),
+ (minx + 0.02115845708765063, -6.581399869531879e-10, minz + 0.017164669930934906),
+ (minx + 0.02115845708765063, -0.004451401997357607, minz + 0.017164670396596193),
+ (minx + 0.020379306632094085, -6.581399869531879e-10, minz + 0.01724140951409936),
+ (minx + 0.020379306632094085, -0.004451401997357607, minz + 0.017241409979760647),
+ (minx + 0.019630098715424538, -6.581399869531879e-10, minz + 0.017468680161982775),
+ (minx + 0.019630098715424538, -0.004451401997357607, minz + 0.017468680627644062),
+ (minx + 0.018939624773338437, -6.581399869531879e-10, minz + 0.017837746301665902),
+ (minx + 0.018939624773338437, -0.004451401997357607, minz + 0.017837747000157833),
+ (minx + 0.01833441946655512, -6.581399869531879e-10, minz + 0.018334425752982497),
+ (minx + 0.01833441946655512, -0.004451401997357607, minz + 0.018334426451474428),
+ (minx + 0.017837740248069167, maxy - 6.581399869531879e-10, minz + 0.018939631758257747),
+ (minx + 0.017837740248069167, -0.004451401997357607, minz + 0.018939632223919034),
+ (minx + 0.017468674574047327, maxy - 6.581399869531879e-10, minz + 0.019630106398835778),
+ (minx + 0.017468674574047327, -0.004451401997357607, minz + 0.019630106864497066),
+ (minx + 0.01724140578880906, maxy - 6.581399869531879e-10, minz + 0.02037931466475129),
+ (minx + 0.01724140578880906, -0.004451401997357607, minz + 0.02037931513041258),
+ (minx + 0.017164666671305895, maxy - 6.581399869531879e-10, maxz - 0.021158452127581606),
+ (minx + 0.017164666671305895, -0.004451401997357607, maxz - 0.02115845165236685),
+ (minx + 0.017241406720131636, maxy - 6.581399869531879e-10, maxz - 0.02037930174265057),
+ (minx + 0.017241406720131636, -0.004451401997357607, maxz - 0.02037930127698928),
+ (minx + 0.01746867736801505, maxy - 6.581399869531879e-10, maxz - 0.019630093942396343),
+ (minx + 0.01746867736801505, -0.004451401997357607, maxz - 0.019630093476735055),
+ (minx + 0.01783774420619011, maxy - 6.581399869531879e-10, maxz - 0.018939620116725564),
+ (minx + 0.01783774420619011, -0.004451401997357607, maxz - 0.018939619651064277),
+ (minx + 0.018334424821659923, maxy, maxz - 0.01833441504277289),
+ (minx + 0.018334424821659923, -0.004451401997357607, maxz - 0.018334414809942245),
+ (minx + 0.018939631059765816, maxy, maxz - 0.017837736289948225),
+ (minx + 0.018939631059765816, -0.004451401997357607, maxz - 0.017837735824286938),
+ (minx + 0.019630105700343847, maxy, maxz - 0.017468671081587672),
+ (minx + 0.019630105700343847, -0.004451401997357607, maxz - 0.01746867084875703),
+ (minx + 0.020379314315505326, maxy, maxz - 0.017241402994841337),
+ (minx + 0.020379314315505326, -0.004451401997357607, maxz - 0.017241402063518763),
+ (minx + 0.02115845651317172, -0.01480177417397499, maxz),
+ (maxx - 0.017030648421496153, -0.01480177417397499, maxz - 0.00040655583143234253),
+ (maxx - 0.013061466626822948, -0.01480177417397499, maxz - 0.0016105938702821732),
+ (maxx - 0.00940344762057066, -0.01480177417397499, maxz - 0.0035658441483974457),
+ (maxx - 0.006197170354425907, -0.01480177417397499, maxz - 0.006197171285748482),
+ (maxx - 0.0035658441483974457, -0.01480177417397499, maxz - 0.009403450414538383),
+ (maxx - 0.0016105901449918747, -0.014801775105297565, maxz - 0.013061468489468098),
+ (maxx - 0.0004065539687871933, -0.014801775105297565, maxz - 0.017030649818480015),
+ (maxx, -0.014801775105297565, minz + 0.0211584585064859),
+ (maxx - 0.0004065539687871933, -0.014801775105297565, minz + 0.017030648421496153),
+ (maxx - 0.0016105901449918747, -0.014801775105297565, minz + 0.013061468489468098),
+ (maxx - 0.0035658441483974457, -0.01480177603662014, minz + 0.00940344762057066),
+ (maxx - 0.006197170354425907, -0.01480177603662014, minz + 0.006197166629135609),
+ (maxx - 0.009403450414538383, -0.01480177603662014, minz + 0.0035658422857522964),
+ (maxx - 0.013061470352113247, -0.01480177603662014, minz + 0.0016105901449918747),
+ (maxx - 0.017030653543770313, -0.01480177603662014, minz + 0.0004065539687871933),
+ (minx + 0.02115844961887081, -0.01480177603662014, minz),
+ (minx + 0.017030637711286545, -0.01480177603662014, minz + 0.0004065539687871933),
+ (minx + 0.013061455450952053, -0.01480177603662014, minz + 0.0016105975955724716),
+ (minx + 0.009403438307344913, -0.01480177603662014, minz + 0.0035658497363328934),
+ (minx + 0.006197156384587288, -0.01480177603662014, minz + 0.006197175942361355),
+ (minx + 0.003565831109881401, -0.01480177603662014, minz + 0.00940345972776413),
+ (minx + 0.001610584557056427, -0.014801775105297565, minz + 0.013061481527984142),
+ (minx + 0.0004065483808517456, -0.014801775105297565, minz + 0.01703066425397992),
+ (minx, -0.014801775105297565, maxz - 0.021158439990372813),
+ (minx + 0.00040655583143234253, -0.014801775105297565, maxz - 0.01703062793239951),
+ (minx + 0.0016105994582176208, -0.014801775105297565, maxz - 0.013061447069048882),
+ (minx + 0.0035658515989780426, -0.01480177417397499, maxz - 0.009403428062796593),
+ (minx + 0.006197184324264526, -0.01480177417397499, maxz - 0.006197153590619564),
+ (minx + 0.00940346997231245, -0.01480177417397499, maxz - 0.003565829247236252),
+ (minx + 0.013061493635177612, -0.01480177417397499, maxz - 0.0016105808317661285),
+ (minx + 0.017030677758157253, -0.01480177417397499, maxz - 0.00040655024349689484),
+ (minx + 0.02115845651317172, -0.017049500718712807, maxz),
+ (maxx - 0.017030648421496153, -0.017049500718712807, maxz - 0.00040655583143234253),
+ (maxx - 0.013061466626822948, -0.017049500718712807, maxz - 0.0016105938702821732),
+ (maxx - 0.00940344762057066, -0.017049500718712807, maxz - 0.0035658441483974457),
+ (maxx - 0.006197170354425907, -0.017049500718712807, maxz - 0.006197171285748482),
+ (maxx - 0.0035658441483974457, -0.017049500718712807, maxz - 0.009403450414538383),
+ (maxx - 0.0016105901449918747, -0.017049502581357956, maxz - 0.013061468489468098),
+ (maxx - 0.0004065539687871933, -0.017049502581357956, maxz - 0.017030649818480015),
+ (maxx, -0.017049502581357956, maxz - 0.021158458637408728),
+ (maxx - 0.0004065539687871933, -0.017049502581357956, minz + 0.017030648421496153),
+ (maxx - 0.0016105901449918747, -0.017049502581357956, minz + 0.013061468489468098),
+ (maxx - 0.0035658441483974457, -0.017049502581357956, minz + 0.00940344762057066),
+ (maxx - 0.006197170354425907, -0.017049502581357956, minz + 0.006197166629135609),
+ (maxx - 0.009403450414538383, -0.017049502581357956, minz + 0.0035658422857522964),
+ (maxx - 0.013061470352113247, -0.017049502581357956, minz + 0.0016105901449918747),
+ (maxx - 0.017030653543770313, -0.017049502581357956, minz + 0.0004065539687871933),
+ (minx + 0.02115844961887081, -0.017049502581357956, minz),
+ (minx + 0.017030637711286545, -0.017049502581357956, minz + 0.0004065539687871933),
+ (minx + 0.013061455450952053, -0.017049502581357956, minz + 0.0016105975955724716),
+ (minx + 0.009403438307344913, -0.017049502581357956, minz + 0.0035658497363328934),
+ (minx + 0.006197156384587288, -0.017049502581357956, minz + 0.006197175942361355),
+ (minx + 0.003565831109881401, -0.017049502581357956, minz + 0.00940345972776413),
+ (minx + 0.001610584557056427, -0.017049502581357956, minz + 0.013061481527984142),
+ (minx + 0.0004065483808517456, -0.017049502581357956, minz + 0.01703066425397992),
+ (minx, -0.017049502581357956, maxz - 0.02115843980423726),
+ (minx + 0.00040655583143234253, -0.017049502581357956, maxz - 0.01703062793239951),
+ (minx + 0.0016105994582176208, -0.017049502581357956, maxz - 0.013061447069048882),
+ (minx + 0.0035658515989780426, -0.017049500718712807, maxz - 0.009403428062796593),
+ (minx + 0.006197184324264526, -0.017049500718712807, maxz - 0.006197153590619564),
+ (minx + 0.00940346997231245, -0.017049500718712807, maxz - 0.003565829247236252),
+ (minx + 0.013061493635177612, -0.017049500718712807, maxz - 0.0016105808317661285),
+ (minx + 0.017030677758157253, -0.017049500718712807, maxz - 0.00040655024349689484),
+ (minx + 0.021158456942334758, -0.017049498856067657, maxz - 0.00991731882095337),
+ (maxx - 0.01896542147733271, -0.017049498856067657, maxz - 0.010133316740393639),
+ (maxx - 0.016856661066412926, -0.017049498856067657, maxz - 0.010773001238703728),
+ (maxx - 0.014913217630237341, -0.017049500718712807, maxz - 0.01181179191917181),
+ (maxx - 0.013209773227572441, -0.017049500718712807, maxz - 0.013209772296249866),
+ (maxx - 0.011811794713139534, -0.017049500718712807, maxz - 0.014913215301930904),
+ (maxx - 0.010773001238703728, -0.017049500718712807, maxz - 0.01685666013509035),
+ (maxx - 0.010133316740393639, -0.017049500718712807, maxz - 0.01896541938185692),
+ (maxx - 0.009917320683598518, -0.017049500718712807, maxz - 0.02115845573538011),
+ (maxx - 0.01013331487774849, -0.017049500718712807, minz + 0.018965424969792366),
+ (maxx - 0.010773001238703728, -0.017049500718712807, minz + 0.01685666525736451),
+ (maxx - 0.011811794713139534, -0.017049500718712807, minz + 0.01491321949288249),
+ (maxx - 0.013209773227572441, -0.017049500718712807, minz + 0.01320977695286274),
+ (maxx - 0.014913217630237341, -0.017049500718712807, minz + 0.011811795644462109),
+ (maxx - 0.016856663394719362, -0.017049502581357956, minz + 0.010773002170026302),
+ (maxx - 0.01896542403846979, -0.017049502581357956, minz + 0.010133319534361362),
+ (minx + 0.021158453279507494, -0.017049502581357956, minz + 0.009917323477566242),
+ (minx + 0.018965415423735976, -0.017049502581357956, minz + 0.010133319534361362),
+ (minx + 0.016856654547154903, -0.017049502581357956, minz + 0.01077300775796175),
+ (minx + 0.014913210645318031, -0.017049500718712807, minz + 0.011811801232397556),
+ (minx + 0.013209767639636993, -0.017049500718712807, minz + 0.013209780678153038),
+ (minx + 0.011811788193881512, -0.017049500718712807, minz + 0.014913226012140512),
+ (minx + 0.01077299751341343, -0.017049500718712807, minz + 0.016856671776622534),
+ (minx + 0.010133313946425915, -0.017049500718712807, minz + 0.018965433351695538),
+ (minx + 0.009917320683598518, -0.017049500718712807, maxz - 0.02115844572963077),
+ (minx + 0.010133318603038788, -0.017049500718712807, maxz - 0.01896540797315538),
+ (minx + 0.0107730058953166, -0.017049500718712807, maxz - 0.01685664849355817),
+ (minx + 0.011811800301074982, -0.017049500718712807, maxz - 0.014913204126060009),
+ (minx + 0.013209782540798187, -0.017049500718712807, maxz - 0.013209762051701546),
+ (minx + 0.014913228340446949, -0.017049500718712807, maxz - 0.011811783537268639),
+ (minx + 0.016856675501912832, -0.017049498856067657, maxz - 0.010772991925477982),
+ (minx + 0.01896543661132455, -0.017049498856067657, maxz - 0.010133312083780766),
+ (maxx - 0.020345793396700174, -0.017049498856067657, maxz - 0.01707291603088379),
+ (maxx - 0.018844185629859567, -0.017049498856067657, maxz - 0.017694902140647173),
+ (maxx - 0.01821294822730124, -0.017049498856067657, maxz - 0.01821294496767223),
+ (maxx - 0.017694905400276184, -0.017049498856067657, maxz - 0.018844182137399912),
+ (maxx - 0.017309964634478092, -0.017049498856067657, maxz - 0.0195643559563905),
+ (maxx - 0.01821294822730124, -0.017049498856067657, minz + 0.01821295404806733),
+ (maxx - 0.019564359914511442, -0.017049498856067657, minz + 0.017309968825429678),
+ (minx + 0.02034579199971631, -0.017049498856067657, minz + 0.017072923481464386),
+ (minx + 0.018844183767214417, -0.017049498856067657, minz + 0.017694910988211632),
+ (minx + 0.01769490260630846, -0.017049498856067657, minz + 0.01884419354610145),
+ (minx + 0.017309962771832943, -0.017049498856067657, minz + 0.01956436806358397),
+ (minx + 0.016992878634482622, -0.017049498856067657, maxz - 0.021158450354705316),
+ (minx + 0.017309966031461954, -0.017049498856067657, maxz - 0.019564351649023592),
+ (minx + 0.01821295195259154, -0.017049498856067657, maxz - 0.018212941009551287),
+ (minx + 0.01884419028647244, -0.017049498856067657, maxz - 0.017694898648187518),
+ (maxx - 0.021158457657990293, -0.017049498856067657, maxz - 0.016992874443531036),
+ (maxx - 0.01956435921601951, -0.017049498856067657, maxz - 0.017309961607679725),
+ (maxx - 0.017072918359190226, -0.017049498856067657, maxz - 0.020345790137071162),
+ (maxx - 0.016992878168821335, -0.017049498856067657, maxz - 0.021158454062492393),
+ (maxx - 0.017072918359190226, -0.017049498856067657, minz + 0.020345799159258604),
+ (maxx - 0.017309964634478092, -0.017049498856067657, minz + 0.01956436550244689),
+ (maxx - 0.017694905400276184, -0.017049498856067657, minz + 0.01884419098496437),
+ (maxx - 0.018844186328351498, -0.017049498856067657, minz + 0.01769490959122777),
+ (maxx - 0.020345794560853392, -0.017049498856067657, minz + 0.017072923481464386),
+ (minx + 0.021158456452073482, -0.017049498856067657, minz + 0.01699288422241807),
+ (minx + 0.019564357702620327, -0.017049498856067657, minz + 0.01730997092090547),
+ (minx + 0.01821294636465609, -0.017049498856067657, minz + 0.018212955445051193),
+ (minx + 0.01707291742786765, -0.017049498856067657, minz + 0.020345802302472293),
+ (minx + 0.017072919756174088, -0.017049498856067657, maxz - 0.020345785829704255),
+ (minx + 0.017694907495751977, -0.017049498856067657, maxz - 0.018844177946448326),
+ (minx + 0.01956436550244689, -0.017049498856067657, maxz - 0.017309958348050714),
+ (minx + 0.020345799799542874, -0.017049498856067657, maxz - 0.017072914633899927)]
+
+ # Faces
+ myfaces = [(0, 1, 3, 2), (2, 3, 5, 4), (4, 5, 7, 6), (6, 7, 9, 8), (8, 9, 11, 10),
+ (10, 11, 13, 12), (12, 13, 15, 14), (14, 15, 17, 16), (16, 17, 19, 18), (18, 19, 21, 20),
+ (20, 21, 23, 22), (22, 23, 25, 24), (24, 25, 27, 26), (26, 27, 29, 28), (28, 29, 31, 30),
+ (30, 31, 33, 32), (32, 33, 35, 34), (34, 35, 37, 36), (36, 37, 39, 38), (38, 39, 41, 40),
+ (40, 41, 43, 42), (42, 43, 45, 44), (44, 45, 47, 46), (46, 47, 49, 48), (48, 49, 51, 50),
+ (50, 51, 53, 52), (52, 53, 55, 54), (54, 55, 57, 56), (56, 57, 59, 58), (58, 59, 61, 60),
+ (60, 61, 63, 62), (62, 63, 1, 0), (45, 43, 85, 86), (23, 21, 74, 75), (51, 49, 88, 89),
+ (7, 5, 66, 67), (29, 27, 77, 78), (57, 55, 91, 92), (35, 33, 80, 81), (13, 11, 69, 70),
+ (63, 61, 94, 95), (41, 39, 83, 84), (19, 17, 72, 73), (47, 45, 86, 87), (3, 1, 64, 65),
+ (25, 23, 75, 76), (53, 51, 89, 90), (9, 7, 67, 68), (31, 29, 78, 79), (59, 57, 92, 93),
+ (37, 35, 81, 82), (15, 13, 70, 71), (1, 63, 95, 64), (43, 41, 84, 85), (21, 19, 73, 74),
+ (49, 47, 87, 88), (5, 3, 65, 66), (27, 25, 76, 77), (55, 53, 90, 91), (11, 9, 68, 69),
+ (33, 31, 79, 80), (61, 59, 93, 94), (39, 37, 82, 83), (17, 15, 71, 72), (89, 88, 120, 121),
+ (67, 66, 98, 99), (78, 77, 109, 110), (87, 86, 118, 119), (65, 64, 96, 97), (76, 75, 107, 108),
+ (64, 95, 127, 96), (85, 84, 116, 117), (74, 73, 105, 106), (94, 93, 125, 126), (83, 82, 114, 115),
+ (72, 71, 103, 104), (92, 91, 123, 124), (81, 80, 112, 113), (70, 69, 101, 102), (90, 89, 121, 122),
+ (68, 67, 99, 100), (79, 78, 110, 111), (88, 87, 119, 120), (66, 65, 97, 98), (77, 76, 108, 109),
+ (86, 85, 117, 118), (75, 74, 106, 107), (95, 94, 126, 127), (84, 83, 115, 116), (73, 72, 104, 105),
+ (93, 92, 124, 125), (82, 81, 113, 114), (71, 70, 102, 103), (91, 90, 122, 123), (69, 68, 100, 101),
+ (80, 79, 111, 112), (123, 122, 154, 155), (101, 100, 132, 133), (112, 111, 143, 144),
+ (121, 120, 152, 153),
+ (99, 98, 130, 131), (110, 109, 141, 142), (119, 118, 150, 151), (97, 96, 128, 129), (108, 107, 139, 140),
+ (96, 127, 159, 128), (117, 116, 148, 149), (106, 105, 137, 138), (126, 125, 157, 158),
+ (115, 114, 146, 147),
+ (104, 103, 135, 136), (124, 123, 155, 156), (113, 112, 144, 145), (102, 101, 133, 134),
+ (122, 121, 153, 154),
+ (100, 99, 131, 132), (111, 110, 142, 143), (120, 119, 151, 152), (98, 97, 129, 130),
+ (109, 108, 140, 141),
+ (118, 117, 149, 150), (107, 106, 138, 139), (127, 126, 158, 159), (116, 115, 147, 148),
+ (105, 104, 136, 137),
+ (125, 124, 156, 157), (114, 113, 145, 146), (103, 102, 134, 135), (157, 156, 173, 174),
+ (133, 132, 162, 163),
+ (134, 133, 163, 164), (132, 131, 161, 162), (150, 149, 169, 170), (146, 145, 167, 185),
+ (135, 134, 164, 177),
+ (155, 154, 172, 189), (144, 143, 183, 184), (153, 152, 171, 188), (131, 130, 176, 161),
+ (142, 141, 182, 166),
+ (151, 150, 170, 187), (129, 128, 175, 160), (140, 139, 181, 165), (128, 159, 191, 175),
+ (149, 148, 186, 169),
+ (138, 137, 179, 180), (158, 157, 174, 190), (147, 146, 185, 168), (136, 135, 177, 178),
+ (156, 155, 189, 173),
+ (145, 144, 184, 167), (154, 153, 188, 172), (143, 142, 166, 183), (152, 151, 187, 171),
+ (130, 129, 160, 176),
+ (141, 140, 165, 182), (139, 138, 180, 181), (159, 158, 190, 191), (148, 147, 168, 186),
+ (137, 136, 178, 179),
+ (175, 191, 190, 174, 173, 189, 172, 188, 171, 187, 170, 169, 186, 168, 185, 167, 184, 183, 166, 182, 165,
+ 181, 180, 179, 178, 177, 164, 163, 162, 161, 176, 160)]
+
+ return myvertex, myfaces
+
+
+# ----------------------------------------------
+# Handle model 07
+# ----------------------------------------------
+def handle_model_07():
+ # ------------------------------------
+ # Mesh data
+ # ------------------------------------
+ minx = -0.10910986363887787
+ maxx = 0.10910986363887787
+ maxy = 0
+ minz = -0.0039262366481125355
+ maxz = 0.0039262366481125355
+
+ # Vertex
+ myvertex = [(maxx, -0.017620893195271492, maxz),
+ (maxx, -0.01611838862299919, maxz - 0.00029886653646826744),
+ (maxx, -0.014844624325633049, maxz - 0.0011499673128128052),
+ (maxx, -0.013993524014949799, maxz - 0.002423731260932982),
+ (maxx, -0.013694657012820244, minz + 0.003926236289926277),
+ (maxx, -0.013993524014949799, minz + 0.002423729980364442),
+ (maxx, -0.014844624325633049, minz + 0.001149968709796667),
+ (maxx, -0.016118386760354042, minz + 0.0002988663036376238),
+ (maxx, -0.017620891332626343, minz),
+ (maxx, -0.019123397767543793, minz + 0.00029886653646826744),
+ (maxx, -0.020397160202264786, minz + 0.0011499675456434488),
+ (maxx, -0.021248264238238335, minz + 0.0024237307952716947),
+ (maxx, -0.02154713124036789, maxz - 0.003926236195012284),
+ (maxx, -0.021248262375593185, maxz - 0.0024237297475337982),
+ (maxx, -0.020397160202264786, maxz - 0.0011499666143208742),
+ (maxx, -0.019123397767543793, maxz - 0.0002988646738231182),
+ (maxx - 0.02949388325214386, -0.01396019384264946, maxz - 0.0024807279696688056),
+ (maxx - 0.030047059059143066, -0.01396019384264946, maxz - 0.0025907604722306132),
+ (maxx - 0.030516013503074646, -0.01396019384264946, maxz - 0.002904107444919646),
+ (maxx - 0.030829355120658875, -0.01396019384264946, maxz - 0.0033730645664036274),
+ (maxx - 0.030939392745494843, -0.01396019198000431, minz + 0.003926236608184253),
+ (maxx - 0.030829355120658875, -0.01396019384264946, minz + 0.0033730643335729837),
+ (maxx - 0.030516013503074646, -0.01396019384264946, minz + 0.0029041077941656113),
+ (maxx - 0.030047059059143066, -0.01396019384264946, minz + 0.002590760588645935),
+ (maxx - 0.02949388325214386, -0.01396019384264946, minz + 0.0024807280860841274),
+ (maxx - 0.02894071489572525, -0.01396019384264946, minz + 0.002590760588645935),
+ (maxx - 0.028471753001213074, -0.01396019384264946, minz + 0.002904107444919646),
+ (maxx - 0.028158411383628845, -0.01396019384264946, minz + 0.0033730644499883056),
+ (maxx - 0.028048373758792877, -0.01396019384264946, maxz - 0.0039262363893523555),
+ (maxx - 0.028158411383628845, -0.01396019384264946, maxz - 0.0033730638679116964),
+ (maxx - 0.028471753001213074, -0.01396019384264946, maxz - 0.0029041070956736803),
+ (maxx - 0.02894071489572525, -0.01396019384264946, maxz - 0.0025907597737386823),
+ (maxx - 0.02949388325214386, -1.862645149230957e-09, maxz - 0.0024807279696688056),
+ (maxx - 0.030047059059143066, -1.862645149230957e-09, maxz - 0.0025907604722306132),
+ (maxx - 0.030516013503074646, -1.862645149230957e-09, maxz - 0.002904107444919646),
+ (maxx - 0.030829355120658875, maxy, maxz - 0.0033730645664036274),
+ (maxx - 0.030939392745494843, maxy, minz + 0.003926236608184253),
+ (maxx - 0.030829355120658875, maxy, minz + 0.0033730643335729837),
+ (maxx - 0.030516013503074646, -1.862645149230957e-09, minz + 0.0029041077941656113),
+ (maxx - 0.030047059059143066, -1.862645149230957e-09, minz + 0.002590760588645935),
+ (maxx - 0.02949388325214386, -1.862645149230957e-09, minz + 0.0024807280860841274),
+ (maxx - 0.02894071489572525, -1.862645149230957e-09, minz + 0.002590760588645935),
+ (maxx - 0.028471753001213074, -1.862645149230957e-09, minz + 0.002904107444919646),
+ (maxx - 0.028158411383628845, -1.862645149230957e-09, minz + 0.0033730644499883056),
+ (maxx - 0.028048373758792877, -1.862645149230957e-09, maxz - 0.0039262363893523555),
+ (maxx - 0.028158411383628845, -1.862645149230957e-09, maxz - 0.0033730638679116964),
+ (maxx - 0.028471753001213074, -1.862645149230957e-09, maxz - 0.0029041070956736803),
+ (maxx - 0.02894071489572525, -1.862645149230957e-09, maxz - 0.0025907597737386823),
+ (minx + 0.10910986037924886, -0.017620893195271492, maxz),
+ (minx + 0.10910986037924886, -0.01611838862299919, maxz - 0.00029886653646826744),
+ (minx + 0.10910986037924886, -0.014844624325633049, maxz - 0.0011499673128128052),
+ (minx + 0.10910986037924886, -0.013993524014949799, maxz - 0.002423731260932982),
+ (minx + 0.10910986037924886, -0.013694657012820244, minz + 0.003926236289926277),
+ (minx + 0.10910986037924886, -0.013993524014949799, minz + 0.002423729980364442),
+ (minx + 0.10910986037924886, -0.014844624325633049, minz + 0.001149968709796667),
+ (minx + 0.10910986037924886, -0.016118386760354042, minz + 0.0002988663036376238),
+ (minx + 0.10910986037924886, -0.017620891332626343, minz),
+ (minx + 0.10910986037924886, -0.019123397767543793, minz + 0.00029886653646826744),
+ (minx + 0.10910986037924886, -0.020397160202264786, minz + 0.0011499675456434488),
+ (minx + 0.10910986037924886, -0.021248264238238335, minz + 0.0024237307952716947),
+ (minx + 0.10910986037924886, -0.02154713124036789, maxz - 0.003926236195012284),
+ (minx + 0.10910986037924886, -0.021248262375593185, maxz - 0.0024237297475337982),
+ (minx + 0.10910986037924886, -0.020397160202264786, maxz - 0.0011499666143208742),
+ (minx + 0.10910986037924886, -0.019123397767543793, maxz - 0.0002988646738231182),
+ (minx, -0.017620893195271492, maxz),
+ (minx, -0.01611838862299919, maxz - 0.00029886653646826744),
+ (minx, -0.014844624325633049, maxz - 0.0011499673128128052),
+ (minx, -0.013993524014949799, maxz - 0.002423731260932982),
+ (minx, -0.013694657012820244, minz + 0.003926236289926277),
+ (minx, -0.013993524014949799, minz + 0.002423729980364442),
+ (minx, -0.014844624325633049, minz + 0.001149968709796667),
+ (minx, -0.016118386760354042, minz + 0.0002988663036376238),
+ (minx, -0.017620891332626343, minz),
+ (minx, -0.019123397767543793, minz + 0.00029886653646826744),
+ (minx, -0.020397160202264786, minz + 0.0011499675456434488),
+ (minx, -0.021248264238238335, minz + 0.0024237307952716947),
+ (minx, -0.02154713124036789, maxz - 0.003926236195012284),
+ (minx, -0.021248262375593185, maxz - 0.0024237297475337982),
+ (minx, -0.020397160202264786, maxz - 0.0011499666143208742),
+ (minx, -0.019123397767543793, maxz - 0.0002988646738231182),
+ (minx + 0.02949388325214386, -0.01396019384264946, maxz - 0.0024807279696688056),
+ (minx + 0.030047059059143066, -0.01396019384264946, maxz - 0.0025907604722306132),
+ (minx + 0.030516013503074646, -0.01396019384264946, maxz - 0.002904107444919646),
+ (minx + 0.030829355120658875, -0.01396019384264946, maxz - 0.0033730645664036274),
+ (minx + 0.030939392745494843, -0.01396019198000431, minz + 0.003926236608184253),
+ (minx + 0.030829355120658875, -0.01396019384264946, minz + 0.0033730643335729837),
+ (minx + 0.030516013503074646, -0.01396019384264946, minz + 0.0029041077941656113),
+ (minx + 0.030047059059143066, -0.01396019384264946, minz + 0.002590760588645935),
+ (minx + 0.02949388325214386, -0.01396019384264946, minz + 0.0024807280860841274),
+ (minx + 0.02894071489572525, -0.01396019384264946, minz + 0.002590760588645935),
+ (minx + 0.028471753001213074, -0.01396019384264946, minz + 0.002904107444919646),
+ (minx + 0.028158411383628845, -0.01396019384264946, minz + 0.0033730644499883056),
+ (minx + 0.028048373758792877, -0.01396019384264946, maxz - 0.0039262363893523555),
+ (minx + 0.028158411383628845, -0.01396019384264946, maxz - 0.0033730638679116964),
+ (minx + 0.028471753001213074, -0.01396019384264946, maxz - 0.0029041070956736803),
+ (minx + 0.02894071489572525, -0.01396019384264946, maxz - 0.0025907597737386823),
+ (minx + 0.02949388325214386, -1.862645149230957e-09, maxz - 0.0024807279696688056),
+ (minx + 0.030047059059143066, -1.862645149230957e-09, maxz - 0.0025907604722306132),
+ (minx + 0.030516013503074646, -1.862645149230957e-09, maxz - 0.002904107444919646),
+ (minx + 0.030829355120658875, maxy, maxz - 0.0033730645664036274),
+ (minx + 0.030939392745494843, maxy, minz + 0.003926236608184253),
+ (minx + 0.030829355120658875, maxy, minz + 0.0033730643335729837),
+ (minx + 0.030516013503074646, -1.862645149230957e-09, minz + 0.0029041077941656113),
+ (minx + 0.030047059059143066, -1.862645149230957e-09, minz + 0.002590760588645935),
+ (minx + 0.02949388325214386, -1.862645149230957e-09, minz + 0.0024807280860841274),
+ (minx + 0.02894071489572525, -1.862645149230957e-09, minz + 0.002590760588645935),
+ (minx + 0.028471753001213074, -1.862645149230957e-09, minz + 0.002904107444919646),
+ (minx + 0.028158411383628845, -1.862645149230957e-09, minz + 0.0033730644499883056),
+ (minx + 0.028048373758792877, -1.862645149230957e-09, maxz - 0.0039262363893523555),
+ (minx + 0.028158411383628845, -1.862645149230957e-09, maxz - 0.0033730638679116964),
+ (minx + 0.028471753001213074, -1.862645149230957e-09, maxz - 0.0029041070956736803),
+ (minx + 0.02894071489572525, -1.862645149230957e-09, maxz - 0.0025907597737386823)]
+
+ # Faces
+ myfaces = [(49, 48, 0, 1), (60, 59, 11, 12), (58, 57, 9, 10), (56, 55, 7, 8), (54, 53, 5, 6),
+ (52, 51, 3, 4), (48, 63, 15, 0), (50, 49, 1, 2), (61, 60, 12, 13), (59, 58, 10, 11),
+ (57, 56, 8, 9), (55, 54, 6, 7), (53, 52, 4, 5), (63, 62, 14, 15), (51, 50, 2, 3),
+ (62, 61, 13, 14), (17, 16, 32, 33), (32, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33),
+ (28, 27, 43, 44), (26, 25, 41, 42),
+ (24, 23, 39, 40), (22, 21, 37, 38), (20, 19, 35, 36), (16, 31, 47, 32), (18, 17, 33, 34),
+ (29, 28, 44, 45), (27, 26, 42, 43), (25, 24, 40, 41), (23, 22, 38, 39), (21, 20, 36, 37),
+ (31, 30, 46, 47), (19, 18, 34, 35), (30, 29, 45, 46), (49, 65, 64, 48), (60, 76, 75, 59),
+ (58, 74, 73, 57), (56, 72, 71, 55), (54, 70, 69, 53), (52, 68, 67, 51), (48, 64, 79, 63),
+ (50, 66, 65, 49), (61, 77, 76, 60), (59, 75, 74, 58), (57, 73, 72, 56), (55, 71, 70, 54),
+ (53, 69, 68, 52), (63, 79, 78, 62), (51, 67, 66, 50), (62, 78, 77, 61), (81, 97, 96, 80),
+ (96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111), (92, 108, 107, 91),
+ (90, 106, 105, 89), (88, 104, 103, 87), (86, 102, 101, 85),
+ (84, 100, 99, 83), (80, 96, 111, 95), (82, 98, 97, 81), (93, 109, 108, 92), (91, 107, 106, 90),
+ (89, 105, 104, 88), (87, 103, 102, 86), (85, 101, 100, 84), (95, 111, 110, 94), (83, 99, 98, 82),
+ (94, 110, 109, 93), (0, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1),
+ (64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79)]
+
+ return myvertex, myfaces
+
+
+# ----------------------------------------------
+# Handle model 08
+# ----------------------------------------------
+def handle_model_08():
+ # ------------------------------------
+ # Mesh data
+ # ------------------------------------
+ minx = -0.05910986289381981
+ maxx = 0.05910986289381981
+ maxy = 0
+ minz = -0.0039262366481125355
+ maxz = 0.0039262366481125355
+
+ # Vertex
+ myvertex = [(maxx, -0.017620893195271492, maxz),
+ (maxx, -0.01611838862299919, maxz - 0.00029886653646826744),
+ (maxx, -0.014844624325633049, maxz - 0.0011499673128128052),
+ (maxx, -0.013993524014949799, maxz - 0.002423731260932982),
+ (maxx, -0.013694657012820244, minz + 0.003926236289926277),
+ (maxx, -0.013993524014949799, minz + 0.002423729980364442),
+ (maxx, -0.014844624325633049, minz + 0.001149968709796667),
+ (maxx, -0.016118386760354042, minz + 0.0002988663036376238),
+ (maxx, -0.017620891332626343, minz),
+ (maxx, -0.019123397767543793, minz + 0.00029886653646826744),
+ (maxx, -0.020397160202264786, minz + 0.0011499675456434488),
+ (maxx, -0.021248264238238335, minz + 0.0024237307952716947),
+ (maxx, -0.02154713124036789, maxz - 0.003926236195012284),
+ (maxx, -0.021248262375593185, maxz - 0.0024237297475337982),
+ (maxx, -0.020397160202264786, maxz - 0.0011499666143208742),
+ (maxx, -0.019123397767543793, maxz - 0.0002988646738231182),
+ (maxx - 0.010583892464637756, -0.01396019384264946, maxz - 0.0024807279696688056),
+ (maxx - 0.011137068271636963, -0.01396019384264946, maxz - 0.0025907604722306132),
+ (maxx - 0.011606022715568542, -0.01396019384264946, maxz - 0.002904107444919646),
+ (maxx - 0.011919364333152771, -0.01396019384264946, maxz - 0.0033730645664036274),
+ (maxx - 0.012029401957988739, -0.01396019198000431, minz + 0.003926236608184253),
+ (maxx - 0.011919364333152771, -0.01396019384264946, minz + 0.0033730643335729837),
+ (maxx - 0.011606022715568542, -0.01396019384264946, minz + 0.0029041077941656113),
+ (maxx - 0.011137068271636963, -0.01396019384264946, minz + 0.002590760588645935),
+ (maxx - 0.010583892464637756, -0.01396019384264946, minz + 0.0024807280860841274),
+ (maxx - 0.010030724108219147, -0.01396019384264946, minz + 0.002590760588645935),
+ (maxx - 0.00956176221370697, -0.01396019384264946, minz + 0.002904107444919646),
+ (maxx - 0.009248420596122742, -0.01396019384264946, minz + 0.0033730644499883056),
+ (maxx - 0.009138382971286774, -0.01396019384264946, maxz - 0.0039262363893523555),
+ (maxx - 0.009248420596122742, -0.01396019384264946, maxz - 0.0033730638679116964),
+ (maxx - 0.00956176221370697, -0.01396019384264946, maxz - 0.0029041070956736803),
+ (maxx - 0.010030724108219147, -0.01396019384264946, maxz - 0.0025907597737386823),
+ (maxx - 0.010583892464637756, -1.862645149230957e-09, maxz - 0.0024807279696688056),
+ (maxx - 0.011137068271636963, -1.862645149230957e-09, maxz - 0.0025907604722306132),
+ (maxx - 0.011606022715568542, -1.862645149230957e-09, maxz - 0.002904107444919646),
+ (maxx - 0.011919364333152771, maxy, maxz - 0.0033730645664036274),
+ (maxx - 0.012029401957988739, maxy, minz + 0.003926236608184253),
+ (maxx - 0.011919364333152771, maxy, minz + 0.0033730643335729837),
+ (maxx - 0.011606022715568542, -1.862645149230957e-09, minz + 0.0029041077941656113),
+ (maxx - 0.011137068271636963, -1.862645149230957e-09, minz + 0.002590760588645935),
+ (maxx - 0.010583892464637756, -1.862645149230957e-09, minz + 0.0024807280860841274),
+ (maxx - 0.010030724108219147, -1.862645149230957e-09, minz + 0.002590760588645935),
+ (maxx - 0.00956176221370697, -1.862645149230957e-09, minz + 0.002904107444919646),
+ (maxx - 0.009248420596122742, -1.862645149230957e-09, minz + 0.0033730644499883056),
+ (maxx - 0.009138382971286774, -1.862645149230957e-09, maxz - 0.0039262363893523555),
+ (maxx - 0.009248420596122742, -1.862645149230957e-09, maxz - 0.0033730638679116964),
+ (maxx - 0.00956176221370697, -1.862645149230957e-09, maxz - 0.0029041070956736803),
+ (maxx - 0.010030724108219147, -1.862645149230957e-09, maxz - 0.0025907597737386823),
+ (minx, -0.017620893195271492, maxz),
+ (minx, -0.01611838862299919, maxz - 0.00029886653646826744),
+ (minx, -0.014844624325633049, maxz - 0.0011499673128128052),
+ (minx, -0.013993524014949799, maxz - 0.002423731260932982),
+ (minx, -0.013694657012820244, minz + 0.003926236289926277),
+ (minx, -0.013993524014949799, minz + 0.002423729980364442),
+ (minx, -0.014844624325633049, minz + 0.001149968709796667),
+ (minx, -0.016118386760354042, minz + 0.0002988663036376238),
+ (minx, -0.017620891332626343, minz),
+ (minx, -0.019123397767543793, minz + 0.00029886653646826744),
+ (minx, -0.020397160202264786, minz + 0.0011499675456434488),
+ (minx, -0.021248264238238335, minz + 0.0024237307952716947),
+ (minx, -0.02154713124036789, maxz - 0.003926236195012284),
+ (minx, -0.021248262375593185, maxz - 0.0024237297475337982),
+ (minx, -0.020397160202264786, maxz - 0.0011499666143208742),
+ (minx, -0.019123397767543793, maxz - 0.0002988646738231182),
+ (minx + 0.010583892464637756, -0.01396019384264946, maxz - 0.0024807279696688056),
+ (minx + 0.011137068271636963, -0.01396019384264946, maxz - 0.0025907604722306132),
+ (minx + 0.011606022715568542, -0.01396019384264946, maxz - 0.002904107444919646),
+ (minx + 0.011919364333152771, -0.01396019384264946, maxz - 0.0033730645664036274),
+ (minx + 0.012029401957988739, -0.01396019198000431, minz + 0.003926236608184253),
+ (minx + 0.011919364333152771, -0.01396019384264946, minz + 0.0033730643335729837),
+ (minx + 0.011606022715568542, -0.01396019384264946, minz + 0.0029041077941656113),
+ (minx + 0.011137068271636963, -0.01396019384264946, minz + 0.002590760588645935),
+ (minx + 0.010583892464637756, -0.01396019384264946, minz + 0.0024807280860841274),
+ (minx + 0.010030724108219147, -0.01396019384264946, minz + 0.002590760588645935),
+ (minx + 0.00956176221370697, -0.01396019384264946, minz + 0.002904107444919646),
+ (minx + 0.009248420596122742, -0.01396019384264946, minz + 0.0033730644499883056),
+ (minx + 0.009138382971286774, -0.01396019384264946, maxz - 0.0039262363893523555),
+ (minx + 0.009248420596122742, -0.01396019384264946, maxz - 0.0033730638679116964),
+ (minx + 0.00956176221370697, -0.01396019384264946, maxz - 0.0029041070956736803),
+ (minx + 0.010030724108219147, -0.01396019384264946, maxz - 0.0025907597737386823),
+ (minx + 0.010583892464637756, -1.862645149230957e-09, maxz - 0.0024807279696688056),
+ (minx + 0.011137068271636963, -1.862645149230957e-09, maxz - 0.0025907604722306132),
+ (minx + 0.011606022715568542, -1.862645149230957e-09, maxz - 0.002904107444919646),
+ (minx + 0.011919364333152771, maxy, maxz - 0.0033730645664036274),
+ (minx + 0.012029401957988739, maxy, minz + 0.003926236608184253),
+ (minx + 0.011919364333152771, maxy, minz + 0.0033730643335729837),
+ (minx + 0.011606022715568542, -1.862645149230957e-09, minz + 0.0029041077941656113),
+ (minx + 0.011137068271636963, -1.862645149230957e-09, minz + 0.002590760588645935),
+ (minx + 0.010583892464637756, -1.862645149230957e-09, minz + 0.0024807280860841274),
+ (minx + 0.010030724108219147, -1.862645149230957e-09, minz + 0.002590760588645935),
+ (minx + 0.00956176221370697, -1.862645149230957e-09, minz + 0.002904107444919646),
+ (minx + 0.009248420596122742, -1.862645149230957e-09, minz + 0.0033730644499883056),
+ (minx + 0.009138382971286774, -1.862645149230957e-09, maxz - 0.0039262363893523555),
+ (minx + 0.009248420596122742, -1.862645149230957e-09, maxz - 0.0033730638679116964),
+ (minx + 0.00956176221370697, -1.862645149230957e-09, maxz - 0.0029041070956736803),
+ (minx + 0.010030724108219147, -1.862645149230957e-09, maxz - 0.0025907597737386823),
+ (maxx - 0.0591098596341908, -0.017620893195271492, maxz),
+ (maxx - 0.0591098596341908, -0.01611838862299919, maxz - 0.00029886653646826744),
+ (maxx - 0.0591098596341908, -0.014844624325633049, maxz - 0.0011499673128128052),
+ (maxx - 0.0591098596341908, -0.013993524014949799, maxz - 0.002423731260932982),
+ (maxx - 0.0591098596341908, -0.013694657012820244, minz + 0.003926236289926277),
+ (maxx - 0.0591098596341908, -0.013993524014949799, minz + 0.002423729980364442),
+ (maxx - 0.0591098596341908, -0.014844624325633049, minz + 0.001149968709796667),
+ (maxx - 0.0591098596341908, -0.016118386760354042, minz + 0.0002988663036376238),
+ (maxx - 0.0591098596341908, -0.017620891332626343, minz),
+ (maxx - 0.0591098596341908, -0.019123397767543793, minz + 0.00029886653646826744),
+ (maxx - 0.0591098596341908, -0.020397160202264786, minz + 0.0011499675456434488),
+ (maxx - 0.0591098596341908, -0.021248264238238335, minz + 0.0024237307952716947),
+ (maxx - 0.0591098596341908, -0.02154713124036789, maxz - 0.003926236195012284),
+ (maxx - 0.0591098596341908, -0.021248262375593185, maxz - 0.0024237297475337982),
+ (maxx - 0.0591098596341908, -0.020397160202264786, maxz - 0.0011499666143208742),
+ (maxx - 0.0591098596341908, -0.019123397767543793, maxz - 0.0002988646738231182)]
+
+ # Faces
+ myfaces = [(97, 96, 0, 1), (108, 107, 11, 12), (106, 105, 9, 10), (104, 103, 7, 8), (102, 101, 5, 6),
+ (100, 99, 3, 4), (96, 111, 15, 0), (98, 97, 1, 2), (109, 108, 12, 13), (107, 106, 10, 11),
+ (105, 104, 8, 9), (103, 102, 6, 7), (101, 100, 4, 5), (111, 110, 14, 15), (99, 98, 2, 3),
+ (110, 109, 13, 14), (17, 16, 32, 33), (32, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33),
+ (28, 27, 43, 44), (26, 25, 41, 42),
+ (24, 23, 39, 40), (22, 21, 37, 38), (20, 19, 35, 36), (16, 31, 47, 32), (18, 17, 33, 34),
+ (29, 28, 44, 45), (27, 26, 42, 43), (25, 24, 40, 41), (23, 22, 38, 39), (21, 20, 36, 37),
+ (31, 30, 46, 47), (19, 18, 34, 35), (30, 29, 45, 46),
+ (0, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1),
+ (97, 49, 48, 96),
+ (108, 60, 59, 107), (106, 58, 57, 105), (104, 56, 55, 103), (102, 54, 53, 101), (100, 52, 51, 99),
+ (96, 48, 63, 111), (98, 50, 49, 97), (109, 61, 60, 108), (107, 59, 58, 106), (105, 57, 56, 104),
+ (103, 55, 54, 102), (101, 53, 52, 100), (111, 63, 62, 110), (99, 51, 50, 98), (110, 62, 61, 109),
+ (65, 81, 80, 64), (80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95), (76, 92, 91, 75),
+ (74, 90, 89, 73), (72, 88, 87, 71),
+ (70, 86, 85, 69), (68, 84, 83, 67), (64, 80, 95, 79), (66, 82, 81, 65), (77, 93, 92, 76),
+ (75, 91, 90, 74), (73, 89, 88, 72), (71, 87, 86, 70), (69, 85, 84, 68), (79, 95, 94, 78),
+ (67, 83, 82, 66), (78, 94, 93, 77), (48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)]
+
+ return myvertex, myfaces
+
+
+# ----------------------------------------------
+# Creaate SKU code for inventory
+# ----------------------------------------------
+def createunitsku(self, cabinet):
+ # ------------------
+ # Wall or Floor
+ # ------------------
+ if self.type_cabinet == "1":
+ p1 = "F"
+ else:
+ p1 = "W"
+ # ------------------
+ # Front type
+ # ------------------
+ if cabinet.dType == "1" or cabinet.dType == "2" or cabinet.dType == "3" or cabinet.dType == "8":
+ p2 = "D" # door
+ elif cabinet.dType == "9" or cabinet.dType == "10":
+ p2 = "L" # door
+ elif cabinet.dType == "4" or cabinet.dType == "5" or cabinet.dType == "6" or cabinet.dType == "11":
+ p2 = "G" # glass
+ elif cabinet.dType == "7":
+ p2 = "W" # drawers
+ else:
+ p2 = "N" # none
+ # ------------------
+ # Door number
+ # ------------------
+ if cabinet.dType == "1" or cabinet.dType == "2" or cabinet.dType == "3" or cabinet.dType == "4" \
+ or cabinet.dType == "5" or cabinet.dType == "6" or cabinet.dType == "9" or cabinet.dType == "10":
+ p3 = "01"
+ elif cabinet.dType == "7":
+ p3 = "%02d" % cabinet.dNum
+ elif cabinet.dType == "8" or cabinet.dType == "11":
+ p3 = "02"
+ else:
+ p3 = "00"
+ # ------------------
+ # Handles
+ # ------------------
+ if cabinet.hand is True:
+ p4 = 1
+ else:
+ p4 = 0
+ # ------------------
+ # Shelves
+ # ------------------
+ # noinspection PyBroadException
+ try:
+ if cabinet.dType == "7":
+ p5 = "00" # drawers is always 0
+ else:
+ p5 = "%02d" % cabinet.sNum
+ except:
+ p5 = "00"
+ # ------------------
+ # Size
+ # ------------------
+ x = cabinet.sX
+ y = self.depth + cabinet.wY
+ z = self.height + cabinet.wZ
+
+ p6 = "%06.3fx%06.3fx%06.3f-%06.3f" % (x, y, z, self.thickness)
+
+ # ------------------
+ # Door Size
+ # ------------------
+ if cabinet.dType == "1" or cabinet.dType == "2" or cabinet.dType == "3" \
+ or cabinet.dType == "4" or cabinet.dType == "5" or cabinet.dType == "6":
+ p7 = "%06.3f" % cabinet.sX
+ elif cabinet.dType == "8" or cabinet.dType == "11":
+ p7 = "%06.3f" % (cabinet.sX / 2)
+ elif cabinet.dType == "9" or cabinet.dType == "10": # corners
+ dwidth = cabinet.sX - self.depth - self.thickness - 0.001
+ p7 = "%06.3f" % dwidth
+ else:
+ p7 = "%06.3f" % 0
+
+ sku = "%s%s%s%s%s-%s-%s" % (p1, p2, p3, p4, p5, p6, p7)
+
+ return sku
diff --git a/archimesh/achm_lamp_maker.py b/archimesh/achm_lamp_maker.py
new file mode 100644
index 00000000..2b2b8855
--- /dev/null
+++ b/archimesh/achm_lamp_maker.py
@@ -0,0 +1,786 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+# ----------------------------------------------------------
+# Automatic generation of lamps
+# Author: Antonio Vazquez (antonioya)
+#
+# ----------------------------------------------------------
+import bpy
+import math
+import copy
+from achm_tools import *
+
+
+# ------------------------------------------------------
+# set predefined designs
+#
+# self: self container
+# ------------------------------------------------------
+def set_preset(self):
+ # -----------------------
+ # Sphere
+ # -----------------------
+ if self.preset == "1":
+ self.base_height = 0.22
+ self.base_segments = 16
+ self.base_rings = 6
+ self.smooth = True
+ self.subdivide = True
+ self.br01 = 0.05
+ self.br02 = 0.07
+ self.br03 = 0.11
+ self.br04 = 0.11
+ self.br05 = 0.07
+ self.br06 = 0.03
+
+ self.bz01 = 0
+ self.bz02 = -1
+ self.bz03 = -0.456
+ self.bz04 = 0.089
+ self.bz05 = -0.038
+ self.bz06 = -0.165
+ # -----------------------
+ # Pear
+ # -----------------------
+ if self.preset == "2":
+ self.base_height = 0.20
+ self.base_segments = 16
+ self.base_rings = 6
+ self.smooth = True
+ self.subdivide = True
+ self.br01 = 0.056
+ self.br02 = 0.062
+ self.br03 = 0.072
+ self.br04 = 0.090
+ self.br05 = 0.074
+ self.br06 = 0.03
+
+ self.bz01 = 0
+ self.bz02 = 0
+ self.bz03 = 0
+ self.bz04 = 0
+ self.bz05 = 0
+ self.bz06 = 0
+ # -----------------------
+ # Vase
+ # -----------------------
+ if self.preset == "3":
+ self.base_height = 0.20
+ self.base_segments = 8
+ self.base_rings = 6
+ self.smooth = True
+ self.subdivide = True
+ self.br01 = 0.05
+ self.br02 = 0.11
+ self.br03 = 0.15
+ self.br04 = 0.07
+ self.br05 = 0.05
+ self.br06 = 0.03
+
+ self.bz01 = 0
+ self.bz02 = 0
+ self.bz03 = 0
+ self.bz04 = 0
+ self.bz05 = 0
+ self.bz06 = 0
+ # -----------------------
+ # Rectangular
+ # -----------------------
+ if self.preset == "4":
+ self.base_height = 0.15
+ self.base_segments = 4
+ self.base_rings = 5
+ self.smooth = False
+ self.subdivide = False
+ self.br01 = 0.08
+ self.br02 = 0.08
+ self.br03 = 0.08
+ self.br04 = 0.08
+ self.br05 = 0.03
+
+ self.bz01 = 0
+ self.bz02 = 0
+ self.bz03 = 0
+ self.bz04 = 0.25
+ self.bz05 = 0
+
+
+# ------------------------------------------------------------------
+# Define UI class
+# Lamps
+# ------------------------------------------------------------------
+class AchmLamp(bpy.types.Operator):
+ bl_idname = "mesh.archimesh_lamp"
+ bl_label = "Lamp"
+ bl_description = "Lamp Generator"
+ bl_category = 'Archimesh'
+ bl_options = {'REGISTER', 'UNDO'}
+ # preset
+ preset = bpy.props.EnumProperty(
+ items=(
+ ('0', "None", ""),
+ ('1', "Sphere", ""),
+ ('2', "Pear", ""),
+ ('3', "Vase", ""),
+ ('4', "Rectangular", ""),
+ ),
+ name="Predefined",
+ description="Apply predefined design",
+ )
+ oldpreset = preset
+
+ base_height = bpy.props.FloatProperty(
+ name='Height',
+ min=0.01, max=10, default=0.20, precision=3,
+ description='lamp base height',
+ )
+ base_segments = bpy.props.IntProperty(
+ name='Segments',
+ min=3, max=128, default=16,
+ description='Number of segments (vertical)',
+ )
+ base_rings = bpy.props.IntProperty(
+ name='Rings',
+ min=2, max=12, default=6,
+ description='Number of rings (horizontal)',
+ )
+ holder = bpy.props.FloatProperty(
+ name='Lampholder',
+ min=0.001, max=10, default=0.02, precision=3,
+ description='Lampholder height',
+ )
+ smooth = bpy.props.BoolProperty(
+ name="Smooth",
+ description="Use smooth shader",
+ default=True,
+ )
+ subdivide = bpy.props.BoolProperty(
+ name="Subdivide",
+ description="Add subdivision modifier",
+ default=True,
+ )
+
+ bz01 = bpy.props.FloatProperty(name='S1', min=-1, max=1, default=0, precision=3, description='Z shift factor')
+ bz02 = bpy.props.FloatProperty(name='S2', min=-1, max=1, default=0, precision=3, description='Z shift factor')
+ bz03 = bpy.props.FloatProperty(name='S3', min=-1, max=1, default=0, precision=3, description='Z shift factor')
+ bz04 = bpy.props.FloatProperty(name='S4', min=-1, max=1, default=0, precision=3, description='Z shift factor')
+ bz05 = bpy.props.FloatProperty(name='S5', min=-1, max=1, default=0, precision=3, description='Z shift factor')
+ bz06 = bpy.props.FloatProperty(name='S6', min=-1, max=1, default=0, precision=3, description='Z shift factor')
+ bz07 = bpy.props.FloatProperty(name='S7', min=-1, max=1, default=0, precision=3, description='Z shift factor')
+ bz08 = bpy.props.FloatProperty(name='S8', min=-1, max=1, default=0, precision=3, description='Z shift factor')
+ bz09 = bpy.props.FloatProperty(name='S9', min=-1, max=1, default=0, precision=3, description='Z shift factor')
+ bz10 = bpy.props.FloatProperty(name='S10', min=-1, max=1, default=0, precision=3, description='Z shift factor')
+ bz11 = bpy.props.FloatProperty(name='S11', min=-1, max=1, default=0, precision=3, description='Z shift factor')
+ bz12 = bpy.props.FloatProperty(name='S12', min=-1, max=1, default=0, precision=3, description='Z shift factor')
+
+ br01 = bpy.props.FloatProperty(name='R1', min=0.001, max=10, default=0.06, precision=3, description='Ring radio')
+ br02 = bpy.props.FloatProperty(name='R2', min=0.001, max=10, default=0.08, precision=3, description='Ring radio')
+ br03 = bpy.props.FloatProperty(name='R3', min=0.001, max=10, default=0.09, precision=3, description='Ring radio')
+ br04 = bpy.props.FloatProperty(name='R4', min=0.001, max=10, default=0.08, precision=3, description='Ring radio')
+ br05 = bpy.props.FloatProperty(name='R5', min=0.001, max=10, default=0.06, precision=3, description='Ring radio')
+ br06 = bpy.props.FloatProperty(name='R6', min=0.001, max=10, default=0.03, precision=3, description='Ring radio')
+ br07 = bpy.props.FloatProperty(name='R7', min=0.001, max=10, default=0.10, precision=3, description='Ring radio')
+ br08 = bpy.props.FloatProperty(name='R8', min=0.001, max=10, default=0.10, precision=3, description='Ring radio')
+ br09 = bpy.props.FloatProperty(name='R9', min=0.001, max=10, default=0.10, precision=3, description='Ring radio')
+ br10 = bpy.props.FloatProperty(name='R10', min=0.001, max=10, default=0.10, precision=3, description='Ring radio')
+ br11 = bpy.props.FloatProperty(name='R11', min=0.001, max=10, default=0.10, precision=3, description='Ring radio')
+ br12 = bpy.props.FloatProperty(name='R12', min=0.001, max=10, default=0.10, precision=3, description='Ring radio')
+
+ top_height = bpy.props.FloatProperty(
+ name='Height', min=0.01, max=10,
+ default=0.20, precision=3,
+ description='lampshade height',
+ )
+ top_segments = bpy.props.IntProperty(
+ name='Segments', min=3, max=128,
+ default=32,
+ description='Number of segments (vertical)',
+ )
+ tr01 = bpy.props.FloatProperty(
+ name='R1', min=0.001, max=10,
+ default=0.16, precision=3,
+ description='lampshade bottom radio',
+ )
+ tr02 = bpy.props.FloatProperty(name='R2', min=0.001, max=10,
+ default=0.08, precision=3,
+ description='lampshade top radio')
+ pleats = bpy.props.BoolProperty(
+ name="Pleats", description="Create pleats in the lampshade",
+ default=False,
+ )
+ tr03 = bpy.props.FloatProperty(
+ name='R3', min=0.001, max=1,
+ default=0.01, precision=3, description='Pleats size',
+ )
+ energy = bpy.props.FloatProperty(
+ name='Light', min=0.00, max=1000,
+ default=15, precision=3,
+ description='Light intensity',
+ )
+ opacity = bpy.props.FloatProperty(
+ name='Translucency', min=0.00, max=1,
+ default=0.3, precision=3,
+ description='Lampshade translucency factor (1 completely translucent)',
+ )
+
+ # Materials
+ crt_mat = bpy.props.BoolProperty(
+ name="Create default Cycles materials",
+ description="Create default materials for Cycles render",
+ default=True,
+ )
+ objcol = bpy.props.FloatVectorProperty(
+ name="Color",
+ description="Color for material",
+ default=(1.0, 1.0, 1.0, 1.0),
+ min=0.1, max=1,
+ subtype='COLOR',
+ size=4,
+ )
+
+ # -----------------------------------------------------
+ # Draw (create UI interface)
+ # -----------------------------------------------------
+ # noinspection PyUnusedLocal
+ def draw(self, context):
+ layout = self.layout
+ space = bpy.context.space_data
+ if not space.local_view:
+ # Imperial units warning
+ if bpy.context.scene.unit_settings.system == "IMPERIAL":
+ row = layout.row()
+ row.label("Warning: Imperial units not supported", icon='COLOR_RED')
+
+ box = layout.box()
+ box.label("Lamp base")
+ row = box.row()
+ row.prop(self, 'preset')
+ row = box.row()
+ row.prop(self, 'base_height')
+ row.prop(self, 'base_segments')
+ row.prop(self, 'base_rings')
+ row = box.row()
+ row.prop(self, 'smooth')
+ row.prop(self, 'subdivide')
+ row = box.row()
+ row.prop(self, 'holder')
+
+ if self.base_rings >= 1:
+ row = box.row()
+ row.prop(self, 'br01')
+ row.prop(self, 'bz01', slider=True)
+ if self.base_rings >= 2:
+ row = box.row()
+ row.prop(self, 'br02')
+ row.prop(self, 'bz02', slider=True)
+ if self.base_rings >= 3:
+ row = box.row()
+ row.prop(self, 'br03')
+ row.prop(self, 'bz03', slider=True)
+
+ if self.base_rings >= 4:
+ row = box.row()
+ row.prop(self, 'br04')
+ row.prop(self, 'bz04', slider=True)
+ if self.base_rings >= 5:
+ row = box.row()
+ row.prop(self, 'br05')
+ row.prop(self, 'bz05', slider=True)
+ if self.base_rings >= 6:
+ row = box.row()
+ row.prop(self, 'br06')
+ row.prop(self, 'bz06', slider=True)
+
+ if self.base_rings >= 7:
+ row = box.row()
+ row.prop(self, 'br07')
+ row.prop(self, 'bz07', slider=True)
+ if self.base_rings >= 8:
+ row = box.row()
+ row.prop(self, 'br08')
+ row.prop(self, 'bz08', slider=True)
+ if self.base_rings >= 9:
+ row = box.row()
+ row.prop(self, 'br09')
+ row.prop(self, 'bz09', slider=True)
+
+ if self.base_rings >= 10:
+ row = box.row()
+ row.prop(self, 'br10')
+ row.prop(self, 'bz10', slider=True)
+ if self.base_rings >= 11:
+ row = box.row()
+ row.prop(self, 'br11')
+ row.prop(self, 'bz11', slider=True)
+ if self.base_rings >= 12:
+ row = box.row()
+ row.prop(self, 'br12')
+ row.prop(self, 'bz12', slider=True)
+
+ box = layout.box()
+ box.label("Lampshade")
+ row = box.row()
+ row.prop(self, 'top_height')
+ row.prop(self, 'top_segments')
+ row = box.row()
+ row.prop(self, 'tr01')
+ row.prop(self, 'tr02')
+ row = box.row()
+ row.prop(self, 'energy')
+ row.prop(self, 'opacity', slider=True)
+ row = box.row()
+ row.prop(self, 'pleats')
+ if self.pleats:
+ row.prop(self, 'tr03')
+
+ box = layout.box()
+ box.prop(self, 'crt_mat')
+ if self.crt_mat:
+ row = box.row()
+ row.prop(self, 'objcol')
+ else:
+ row = layout.row()
+ row.label("Warning: Operator does not work in local view mode", icon='ERROR')
+
+ # -----------------------------------------------------
+ # Execute
+ # -----------------------------------------------------
+ # noinspection PyUnusedLocal
+ def execute(self, context):
+ if bpy.context.mode == "OBJECT":
+ if self.oldpreset != self.preset:
+ set_preset(self)
+ self.oldpreset = self.preset
+
+ # Create lamp
+ create_lamp_mesh(self)
+ return {'FINISHED'}
+ else:
+ self.report({'WARNING'}, "Archimesh: Option only valid in Object mode")
+ return {'CANCELLED'}
+
+
+# ------------------------------------------------------------------------------
+# Generate mesh data
+# All custom values are passed using self container (self.myvariable)
+# ------------------------------------------------------------------------------
+def create_lamp_mesh(self):
+ # deactivate others
+ for o in bpy.data.objects:
+ if o.select is True:
+ o.select = False
+ bpy.ops.object.select_all(False)
+ generate_lamp(self)
+
+ return
+
+
+# ------------------------------------------------------------------------------
+# Generate lamps
+# All custom values are passed using self container (self.myvariable)
+# ------------------------------------------------------------------------------
+def generate_lamp(self):
+ location = bpy.context.scene.cursor_location
+ myloc = copy.copy(location) # copy location to keep 3D cursor position
+ # ---------------------
+ # Lamp base
+ # ---------------------
+ mydata = create_lamp_base("Lamp_base", self.base_height,
+ myloc.x, myloc.y, myloc.z,
+ self.base_segments, self.base_rings,
+ [self.br01, self.br02, self.br03, self.br04, self.br05, self.br06,
+ self.br07, self.br08, self.br09, self.br10, self.br11, self.br12],
+ (self.bz01, self.bz02, self.bz03, self.bz04, self.bz05, self.bz06,
+ self.bz07, self.bz08, self.bz09, self.bz10, self.bz11, self.bz12),
+ self.subdivide,
+ self.crt_mat, self.objcol)
+ mybase = mydata[0]
+ posz = mydata[1]
+ # refine
+ remove_doubles(mybase)
+ set_normals(mybase)
+ # Smooth
+ if self.smooth:
+ set_smooth(mybase)
+ if self.subdivide:
+ set_modifier_subsurf(mybase)
+ # ---------------------
+ # Lampholder
+ # ---------------------
+ myholder = create_lampholder("Lampholder", self.holder,
+ myloc.x, myloc.y, myloc.z,
+ self.crt_mat)
+ # refine
+ remove_doubles(myholder)
+ set_normals(myholder)
+ set_smooth(myholder)
+
+ myholder.parent = mybase
+ myholder.location.x = 0
+ myholder.location.y = 0
+ myholder.location.z = posz
+ # ---------------------
+ # Lamp strings
+ # ---------------------
+ mystrings = create_lampholder_strings("Lampstrings", self.holder,
+ myloc.x, myloc.y, myloc.z,
+ self.tr02,
+ self.top_height,
+ self.crt_mat)
+ # refine
+ remove_doubles(mystrings)
+ set_normals(mystrings)
+
+ mystrings.parent = myholder
+ mystrings.location.x = 0
+ mystrings.location.y = 0
+ mystrings.location.z = 0.03
+ # ---------------------
+ # Lampshade
+ # ---------------------
+ mytop = create_lampshade("Lampshade", self.top_height,
+ myloc.x, myloc.y, myloc.z,
+ self.top_segments,
+ self.tr01, self.tr02,
+ self.pleats, self.tr03,
+ self.opacity,
+ self.crt_mat)
+ # refine
+ remove_doubles(mytop)
+ set_normals(mytop)
+ if self.pleats is False:
+ set_smooth(mytop)
+
+ mytop.parent = mybase
+ mytop.location.x = 0
+ mytop.location.y = 0
+ mytop.location.z = posz + self.holder
+ # ---------------------
+ # Light bulb
+ # ---------------------
+ radbulb = 0.02
+ bpy.ops.mesh.primitive_uv_sphere_add(segments=16, size=radbulb)
+ mybulb = bpy.data.objects[bpy.context.active_object.name]
+ mybulb.name = "Lamp_Bulb"
+ mybulb.parent = myholder
+ mybulb.location = (0, 0, radbulb + self.holder + 0.04)
+ if self.crt_mat:
+ mat = create_emission_material(mybulb.name, True, 0.8, 0.8, 0.8, self.energy)
+ set_material(mybulb, mat)
+
+ # deactivate others
+ for o in bpy.data.objects:
+ if o.select is True:
+ o.select = False
+
+ mybase.select = True
+ bpy.context.scene.objects.active = mybase
+
+ return
+
+
+# ------------------------------------------------------------------------------
+# Create lamp base
+#
+# objName: Name for the new object
+# height: Size in Z axis
+# pX: position X axis
+# pY: position Y axis
+# pZ: position Z axis
+# segments: number of segments
+# rings: number of rings
+# radios: ring radios
+# ratios: Z shift ratios
+# subdivide: Subdivision flag
+# mat: Flag for creating materials
+# objcol: Color
+# ------------------------------------------------------------------------------
+def create_lamp_base(objname, height, px, py, pz, segments, rings, radios, ratios, subdivide, mat, objcol):
+ # Calculate heights
+ h = height / (rings - 1)
+ listheight = []
+ z = 0
+ for f in range(0, rings):
+ listheight.extend([z + (z * ratios[f])])
+ z += h
+
+ mydata = create_cylinder_data(segments, listheight,
+ radios,
+ True, True, False, 0, subdivide)
+ myvertex = mydata[0]
+ myfaces = mydata[1]
+
+ mymesh = bpy.data.meshes.new(objname)
+ mycylinder = bpy.data.objects.new(objname, mymesh)
+ bpy.context.scene.objects.link(mycylinder)
+
+ mymesh.from_pydata(myvertex, [], myfaces)
+ mymesh.update(calc_edges=True)
+ # Position
+ mycylinder.location.x = px
+ mycylinder.location.y = py
+ mycylinder.location.z = pz
+ # Materials
+ if mat:
+ rgb = objcol
+ mymat = create_diffuse_material(mycylinder.name + "_material", True, rgb[0], rgb[1], rgb[2], rgb[0], rgb[1],
+ rgb[2], 0.1)
+ set_material(mycylinder, mymat)
+
+ return mycylinder, listheight[len(listheight) - 1]
+
+
+# ------------------------------------------------------------------------------
+# Create lampholder
+#
+# objName: Name for the new object
+# height: Size in Z axis
+# pX: position X axis
+# pY: position Y axis
+# pZ: position Z axis
+# mat: Flag for creating materials
+# ------------------------------------------------------------------------------
+def create_lampholder(objname, height, px, py, pz, mat):
+ mydata = create_cylinder_data(16, [0, height, height + 0.005, height + 0.008, height + 0.05],
+ [0.005, 0.005, 0.010, 0.018, 0.018],
+ False, False, False, 0, False)
+ myvertex = mydata[0]
+ myfaces = mydata[1]
+
+ mymesh = bpy.data.meshes.new(objname)
+ mycylinder = bpy.data.objects.new(objname, mymesh)
+ bpy.context.scene.objects.link(mycylinder)
+
+ mymesh.from_pydata(myvertex, [], myfaces)
+ mymesh.update(calc_edges=True)
+ # Position
+ mycylinder.location.x = px
+ mycylinder.location.y = py
+ mycylinder.location.z = pz
+
+ # Materials
+ if mat:
+ mat = create_diffuse_material(mycylinder.name + "_material", True, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.1)
+ set_material(mycylinder, mat)
+
+ return mycylinder
+
+
+# ------------------------------------------------------------------------------
+# Create lampholder strings
+#
+# objName: Name for the new object
+# height: Size in Z axis
+# pX: position X axis
+# pY: position Y axis
+# pZ: position Z axis
+# radio: radio of lampshade
+# shadeh: height of lampshader
+# mat: Flag for creating materials
+# ------------------------------------------------------------------------------
+def create_lampholder_strings(objname, height, px, py, pz, radio, shadeh, mat):
+ mydata = create_cylinder_data(32, [height + 0.005, height + 0.005, height + 0.006, height + 0.006],
+ [0.018, 0.025, 0.025, 0.018],
+ False, False, False, 0, False)
+ myvertex = mydata[0]
+ myfaces = mydata[1]
+
+ mymesh = bpy.data.meshes.new(objname)
+ mycylinder = bpy.data.objects.new(objname, mymesh)
+ bpy.context.scene.objects.link(mycylinder)
+
+ mymesh.from_pydata(myvertex, [], myfaces)
+ mymesh.update(calc_edges=True)
+ # Position
+ mycylinder.location.x = px
+ mycylinder.location.y = py
+ mycylinder.location.z = pz
+ # Box1
+ box1 = create_box_segments("Lamp_B1", shadeh - 0.036, radio - 0.023)
+ box1.parent = mycylinder
+ box1.location = (0.021, 0, height + 0.004)
+ # Box2
+ box2 = create_box_segments("Lamp_B2", shadeh - 0.036, -radio + 0.023)
+ box2.parent = mycylinder
+ box2.location = (-0.021, 0, height + 0.004)
+
+ # Materials
+ if mat:
+ mat = create_diffuse_material(mycylinder.name + "_material", True, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.1)
+ set_material(mycylinder, mat)
+ set_material(box1, mat)
+ set_material(box2, mat)
+
+ return mycylinder
+
+
+# ------------------------------------------------------------------------------
+# Create lampshade
+#
+# objName: Name for the new object
+# height: Size in Z axis
+# pX: position X axis
+# pY: position Y axis
+# pZ: position Z axis
+# segments: number of segments
+# radio1: ring radio 1
+# radio2: ring radio 2
+# pleats: flag for pleats
+# pleatsize: difference in radios (less)
+# opacity: opacity factor
+# mat: Flag for creating materials
+# ------------------------------------------------------------------------------
+def create_lampshade(objname, height, px, py, pz, segments, radio1, radio2, pleats, pleatsize, opacity, mat):
+ gap = 0.002
+ radios = [radio1 - gap, radio1 - gap, radio1, radio2, radio2 - gap, radio2 - gap]
+ heights = [gap * 2, 0, 0, height, height, height - (gap * 2)]
+ mydata = create_cylinder_data(segments, heights,
+ radios,
+ False, False, pleats, pleatsize, False)
+ myvertex = mydata[0]
+ myfaces = mydata[1]
+
+ mymesh = bpy.data.meshes.new(objname)
+ mycylinder = bpy.data.objects.new(objname, mymesh)
+ bpy.context.scene.objects.link(mycylinder)
+
+ mymesh.from_pydata(myvertex, [], myfaces)
+ mymesh.update(calc_edges=True)
+ # Position
+ mycylinder.location.x = px
+ mycylinder.location.y = py
+ mycylinder.location.z = pz
+ # materials
+ if mat:
+ mymat = create_translucent_material(mycylinder.name + "_material", True, 0.8, 0.65, 0.45, 0.8, 0.65, 0.45,
+ opacity)
+ set_material(mycylinder, mymat)
+
+ return mycylinder
+
+
+# ------------------------------------------------------------------------------
+# Create box segments
+#
+# objName: Name for the new object
+# height: Size in Z axis
+# shift: Shift movement
+# ------------------------------------------------------------------------------
+def create_box_segments(objname, height, shift):
+ gap = 0.001
+ myvertex = [(0, 0, 0), (0, gap, 0), (gap, gap, 0), (gap, 0, 0),
+ (shift, 0, height),
+ (shift, gap, height),
+ (shift + gap, gap, height),
+ (shift + gap, 0, height)]
+ myfaces = [(6, 5, 1, 2), (7, 6, 2, 3), (4, 7, 3, 0), (1, 5, 4, 0)]
+
+ mymesh = bpy.data.meshes.new(objname)
+ mysegment = bpy.data.objects.new(objname, mymesh)
+ bpy.context.scene.objects.link(mysegment)
+
+ mymesh.from_pydata(myvertex, [], myfaces)
+ mymesh.update(calc_edges=True)
+ # Position
+ mysegment.location.x = 0
+ mysegment.location.y = 0
+ mysegment.location.z = 0
+
+ return mysegment
+
+
+# ------------------------------------------------------------------------------
+# Create cylinders data
+#
+# segments: Number of pies
+# listHeight: list of heights
+# listRadio: list of radios
+# top: top face flag
+# bottom: bottom face flag
+# pleats: flag for pleats
+# pleatsize: difference in radios (less)
+# subdiv: fix subdivision problem
+# ------------------------------------------------------------------------------
+def create_cylinder_data(segments, listheight, listradio, bottom, top, pleats, pleatsize, subdiv):
+ myvertex = []
+ myfaces = []
+ if subdiv:
+ # Add at element 0 to fix subdivision problems
+ listheight.insert(0, listheight[0] + 0.001)
+ listradio.insert(0, listradio[0])
+ # Add at last element to fix subdivision problems
+ e = len(listheight) - 1
+ listheight.insert(e, listheight[e] + 0.001)
+ listradio.insert(e, listradio[e])
+ # -------------------------------------
+ # Vertices
+ # -------------------------------------
+ idx = 0
+ rp = 0
+ for z in listheight:
+ seg = 0
+ for i in range(segments):
+ x = math.cos(math.radians(seg)) * (listradio[idx] + rp)
+ y = math.sin(math.radians(seg)) * (listradio[idx] + rp)
+ mypoint = [(x, y, z)]
+ myvertex.extend(mypoint)
+ seg += 360 / segments
+ # pleats
+ if pleats is True and rp == 0:
+ rp = -pleatsize
+ else:
+ rp = 0
+
+ idx += 1
+ # -------------------------------------
+ # Faces
+ # -------------------------------------
+ for r in range(0, len(listheight) - 1):
+ s = r * segments
+ t = 1
+ for n in range(0, segments):
+ t += 1
+ if t > segments:
+ t = 1
+ myface = [(n + s, n + s - segments + 1, n + s + 1, n + s + segments)]
+ myfaces.extend(myface)
+ else:
+ myface = [(n + s, n + s + 1, n + s + segments + 1, n + s + segments)]
+ myfaces.extend(myface)
+
+ # -----------------
+ # bottom face
+ # -----------------
+ if bottom:
+ fa = []
+ for f in range(0, segments):
+ fa.extend([f])
+ myfaces.extend([fa])
+ # -----------------
+ # top face
+ # -----------------
+ if top:
+ fa = []
+ for f in range(len(myvertex) - segments, len(myvertex)):
+ fa.extend([f])
+ myfaces.extend([fa])
+
+ return myvertex, myfaces
diff --git a/archimesh/achm_main_panel.py b/archimesh/achm_main_panel.py
new file mode 100644
index 00000000..b2ebbc38
--- /dev/null
+++ b/archimesh/achm_main_panel.py
@@ -0,0 +1,578 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+# ----------------------------------------------------------
+# Main panel for different Archimesh general actions
+# Author: Antonio Vazquez (antonioya)
+#
+# ----------------------------------------------------------
+# noinspection PyUnresolvedReferences
+import bpy
+# noinspection PyUnresolvedReferences
+import bgl
+from achm_tools import *
+from achm_gltools import *
+
+
+# -----------------------------------------------------
+# Verify if boolean already exist
+# -----------------------------------------------------
+def isboolean(myobject, childobject):
+ flag = False
+ for mod in myobject.modifiers:
+ if mod.type == 'BOOLEAN':
+ if mod.object == childobject:
+ flag = True
+ break
+ return flag
+
+
+# ------------------------------------------------------
+# Button: Action to link windows and doors
+# ------------------------------------------------------
+class AchmHoleAction(bpy.types.Operator):
+ bl_idname = "object.archimesh_cut_holes"
+ bl_label = "Auto Holes"
+ bl_description = "Enable windows and doors holes for any selected object (needs wall thickness)"
+ bl_category = 'Archimesh'
+
+ # ------------------------------
+ # Execute
+ # ------------------------------
+ # noinspection PyMethodMayBeStatic
+ def execute(self, context):
+ scene = context.scene
+ listobj = []
+ # ---------------------------------------------------------------------
+ # Save the list of selected objects because the select flag is missed
+ # only can be windows or doors
+ # ---------------------------------------------------------------------
+ for obj in bpy.context.scene.objects:
+ # noinspection PyBroadException
+ try:
+ if obj["archimesh.hole_enable"]:
+ if obj.select is True or scene.archimesh_select_only is False:
+ listobj.extend([obj])
+ except:
+ continue
+ # ---------------------------
+ # Get the baseboard object
+ # ---------------------------
+ mybaseboard = None
+ for child in context.object.children:
+ # noinspection PyBroadException
+ try:
+ if child["archimesh.room_baseboard"]:
+ mybaseboard = child
+ except:
+ continue
+ # ---------------------------
+ # Get the shell object
+ # ---------------------------
+ myshell = None
+ for child in context.object.children:
+ # noinspection PyBroadException
+ try:
+ if child["archimesh.room_shell"]:
+ myshell = child
+ except:
+ continue
+
+ # -----------------------------
+ # Remove all empty Boolean modifiers
+ # -----------------------------
+ for mod in context.object.modifiers:
+ if mod.type == 'BOOLEAN':
+ if mod.object is None:
+ bpy.ops.object.modifier_remove(modifier=mod.name)
+
+ # if thickness is 0, must be > 0
+ myroom = context.object
+ if myroom.RoomGenerator[0].wall_width == 0:
+ self.report({'WARNING'}, "Walls must have thickness for using autohole function. Change it and run again")
+ # -----------------------------
+ # Now apply Wall holes
+ # -----------------------------
+ for obj in listobj:
+ parentobj = context.object
+ # Parent the empty to the room (the parent of frame)
+ if obj.parent is not None:
+ bpy.ops.object.select_all(action='DESELECT')
+ parentobj.select = True
+ obj.parent.select = True # parent of object
+ bpy.ops.object.parent_set(type='OBJECT', keep_transform=False)
+ # ---------------------------------------
+ # Add the modifier to controller
+ # and the scale to use the same thickness
+ # ---------------------------------------
+ for child in obj.parent.children:
+ # noinspection PyBroadException
+ try:
+ if child["archimesh.ctrl_hole"]:
+ # apply scale
+ t = parentobj.RoomGenerator[0].wall_width
+ if t > 0:
+ child.scale.y = (t + 0.45) / (child.dimensions.y / child.scale.y) # Add some gap
+ else:
+ child.scale.y = 1
+ # add boolean modifier
+ if isboolean(context.object, child) is False:
+ set_modifier_boolean(context.object, child)
+ except:
+ # print("Unexpected error:" + str(sys.exc_info()))
+ pass
+ # ---------------------------------------
+ # Now add the modifiers to baseboard
+ # ---------------------------------------
+ if mybaseboard is not None:
+ for obj in bpy.context.scene.objects:
+ # noinspection PyBroadException
+ try:
+ if obj["archimesh.ctrl_base"]:
+ if obj.select is True or scene.archimesh_select_only is False:
+ # add boolean modifier
+ if isboolean(mybaseboard, obj) is False:
+ set_modifier_boolean(mybaseboard, obj)
+ except:
+ pass
+ # Clear empty booleans
+ for mod in mybaseboard.modifiers:
+ if mod.type == 'BOOLEAN':
+ if mod.object is None:
+ bpy.ops.object.modifier_remove(modifier=mod.name)
+
+ # ---------------------------------------
+ # Now add the modifiers to shell
+ # ---------------------------------------
+ if myshell is not None:
+ # Remove all empty Boolean modifiers
+ for mod in myshell.modifiers:
+ if mod.type == 'BOOLEAN':
+ if mod.object is None:
+ bpy.ops.object.modifier_remove(modifier=mod.name)
+
+ for obj in bpy.context.scene.objects:
+ # noinspection PyBroadException
+ try:
+ if obj["archimesh.ctrl_hole"]:
+ if obj.select is True or scene.archimesh_select_only is False:
+ # add boolean modifier
+ if isboolean(myshell, obj) is False:
+ set_modifier_boolean(myshell, obj)
+ except:
+ pass
+ # Clear empty booleans
+ for mod in myshell.modifiers:
+ if mod.type == 'BOOLEAN':
+ if mod.object is None:
+ bpy.ops.object.modifier_remove(modifier=mod.name)
+
+ return {'FINISHED'}
+
+
+# ------------------------------------------------------
+# Button: Action to create room from grease pencil
+# ------------------------------------------------------
+class AchmPencilAction(bpy.types.Operator):
+ bl_idname = "object.archimesh_pencil_room"
+ bl_label = "Room from Draw"
+ bl_description = "Create a room base on grease pencil strokes (draw from top view (7 key))"
+ bl_category = 'Archimesh'
+
+ # ------------------------------
+ # Execute
+ # ------------------------------
+ def execute(self, context):
+ # Enable for debugging code
+ debugmode = False
+
+ scene = context.scene
+ mypoints = None
+ clearangles = None
+
+ if debugmode is True:
+ print("======================================================================")
+ print("== ==")
+ print("== Grease pencil strokes analysis ==")
+ print("== ==")
+ print("======================================================================")
+
+ # -----------------------------------
+ # Get grease pencil points
+ # -----------------------------------
+ # noinspection PyBroadException
+ try:
+
+ # noinspection PyBroadException
+ try:
+ pencil = bpy.context.object.grease_pencil.layers.active
+ except:
+ pencil = bpy.context.scene.grease_pencil.layers.active
+
+ if pencil.active_frame is not None:
+ for i, stroke in enumerate(pencil.active_frame.strokes):
+ stroke_points = pencil.active_frame.strokes[i].points
+ allpoints = [(point.co.x, point.co.y)
+ for point in stroke_points]
+
+ mypoints = []
+ idx = 0
+ x = 0
+ y = 0
+ orientation = None
+ old_orientation = None
+
+ for point in allpoints:
+ if idx == 0:
+ x = point[0]
+ y = point[1]
+ else:
+ abs_x = abs(point[0] - x)
+ abs_y = abs(point[1] - y)
+
+ if abs_y > abs_x:
+ orientation = "V"
+ else:
+ orientation = "H"
+
+ if old_orientation == orientation:
+ x = point[0]
+ y = point[1]
+ else:
+ mypoints.extend([(x, y)])
+ x = point[0]
+ y = point[1]
+ old_orientation = orientation
+
+ idx += 1
+ # Last point
+ mypoints.extend([(x, y)])
+
+ if debugmode is True:
+ print("\nPoints\n====================")
+ i = 0
+ for p in mypoints:
+ print(str(i) + ":" + str(p))
+ i += 1
+ # -----------------------------------
+ # Calculate distance between points
+ # -----------------------------------
+ if debugmode is True:
+ print("\nDistance\n====================")
+ i = len(mypoints)
+ distlist = []
+ for e in range(1, i):
+ d = math.sqrt(
+ ((mypoints[e][0] - mypoints[e - 1][0]) ** 2) + ((mypoints[e][1] - mypoints[e - 1][1]) ** 2))
+ # Imperial units if needed
+ if bpy.context.scene.unit_settings.system == "IMPERIAL":
+ d *= 3.2808399
+
+ distlist.extend([d])
+
+ if debugmode is True:
+ print(str(e - 1) + ":" + str(d))
+ # -----------------------------------
+ # Calculate angle of walls
+ # clamped to right angles
+ # -----------------------------------
+ if debugmode is True:
+ print("\nAngle\n====================")
+
+ i = len(mypoints)
+ anglelist = []
+ for e in range(1, i):
+ sinv = (mypoints[e][1] - mypoints[e - 1][1]) / math.sqrt(
+ ((mypoints[e][0] - mypoints[e - 1][0]) ** 2) + ((mypoints[e][1] - mypoints[e - 1][1]) ** 2))
+ a = math.asin(sinv)
+ # Clamp to 90 or 0 degrees
+ if math.fabs(a) > math.pi / 4:
+ b = math.pi / 2
+ else:
+ b = 0
+
+ anglelist.extend([b])
+ # Reverse de distance using angles (inverse angle to axis) for Vertical lines
+ if a < 0.0 and b != 0:
+ distlist[e - 1] *= -1 # reverse distance
+
+ # Reverse de distance for horizontal lines
+ if b == 0:
+ if mypoints[e - 1][0] > mypoints[e][0]:
+ distlist[e - 1] *= -1 # reverse distance
+
+ if debugmode is True:
+ print(str(e - 1) + ":" + str((a * 180) / math.pi) + "...:" + str(
+ (b * 180) / math.pi) + "--->" + str(distlist[e - 1]))
+
+ # ---------------------------------------
+ # Verify duplications and reduce noise
+ # ---------------------------------------
+ if len(anglelist) >= 1:
+ clearangles = []
+ cleardistan = []
+ i = len(anglelist)
+ oldangle = anglelist[0]
+ olddist = 0
+ for e in range(0, i):
+ if oldangle != anglelist[e]:
+ clearangles.extend([oldangle])
+ cleardistan.extend([olddist])
+ oldangle = anglelist[e]
+ olddist = distlist[e]
+ else:
+ olddist += distlist[e]
+ # last
+ clearangles.extend([oldangle])
+ cleardistan.extend([olddist])
+
+ # ----------------------------
+ # Create the room
+ # ----------------------------
+ if len(mypoints) > 1 and len(clearangles) > 0:
+ # Move cursor
+ bpy.context.scene.cursor_location.x = mypoints[0][0]
+ bpy.context.scene.cursor_location.y = mypoints[0][1]
+ bpy.context.scene.cursor_location.z = 0 # always on grid floor
+
+ # Add room mesh
+ bpy.ops.mesh.archimesh_room()
+ myroom = context.object
+ mydata = myroom.RoomGenerator[0]
+ # Number of walls
+ mydata.wall_num = len(mypoints) - 1
+ mydata.ceiling = scene.archimesh_ceiling
+ mydata.floor = scene.archimesh_floor
+ mydata.merge = scene.archimesh_merge
+
+ i = len(mypoints)
+ for e in range(0, i - 1):
+ if clearangles[e] == math.pi / 2:
+ if cleardistan[e] > 0:
+ mydata.walls[e].w = round(math.fabs(cleardistan[e]), 2)
+ mydata.walls[e].r = (math.fabs(clearangles[e]) * 180) / math.pi # from radians
+ else:
+ mydata.walls[e].w = round(math.fabs(cleardistan[e]), 2)
+ mydata.walls[e].r = (math.fabs(clearangles[e]) * 180 * -1) / math.pi # from radians
+
+ else:
+ mydata.walls[e].w = round(cleardistan[e], 2)
+ mydata.walls[e].r = (math.fabs(clearangles[e]) * 180) / math.pi # from radians
+
+ # Remove Grease pencil
+ if pencil is not None:
+ for frame in pencil.frames:
+ pencil.frames.remove(frame)
+
+ self.report({'INFO'}, "Archimesh: Room created from grease pencil strokes")
+ else:
+ self.report({'WARNING'}, "Archimesh: Not enough grease pencil strokes for creating room.")
+
+ return {'FINISHED'}
+ except:
+ self.report({'WARNING'}, "Archimesh: No grease pencil strokes. Do strokes in top view before creating room")
+ return {'CANCELLED'}
+
+
+# ------------------------------------------------------------------
+# Define panel class for main functions.
+# ------------------------------------------------------------------
+class ArchimeshMainPanel(bpy.types.Panel):
+ bl_idname = "archimesh_main_panel"
+ bl_label = "Archimesh"
+ bl_space_type = 'VIEW_3D'
+ bl_region_type = "TOOLS"
+ bl_category = 'Archimesh'
+
+ # ------------------------------
+ # Draw UI
+ # ------------------------------
+ def draw(self, context):
+ layout = self.layout
+ scene = context.scene
+
+ myobj = context.object
+ # -------------------------------------------------------------------------
+ # If the selected object didn't be created with the group 'RoomGenerator',
+ # this button is not created.
+ # -------------------------------------------------------------------------
+ # noinspection PyBroadException
+ try:
+ if 'RoomGenerator' in myobj:
+ box = layout.box()
+ box.label("Room Tools", icon='MODIFIER')
+ row = box.row(align=False)
+ row.operator("object.archimesh_cut_holes", icon='GRID')
+ row.prop(scene, "archimesh_select_only")
+
+ # Export/Import
+ row = box.row(align=False)
+ row.operator("io_import.roomdata", text="Import", icon='COPYDOWN')
+ row.operator("io_export.roomdata", text="Export", icon='PASTEDOWN')
+ except:
+ pass
+
+ # -------------------------------------------------------------------------
+ # If the selected object isn't a kitchen
+ # this button is not created.
+ # -------------------------------------------------------------------------
+ # noinspection PyBroadException
+ try:
+ if myobj["archimesh.sku"] is not None:
+ box = layout.box()
+ box.label("Kitchen Tools", icon='MODIFIER')
+ # Export
+ row = box.row(align=False)
+ row.operator("io_export.kitchen_inventory", text="Export inventory", icon='PASTEDOWN')
+ except:
+ pass
+
+ # ------------------------------
+ # Elements Buttons
+ # ------------------------------
+ box = layout.box()
+ box.label("Elements", icon='GROUP')
+ row = box.row()
+ row.operator("mesh.archimesh_room")
+ row.operator("mesh.archimesh_column")
+ row = box.row()
+ row.operator("mesh.archimesh_door")
+ row = box.row()
+ row.operator("mesh.archimesh_window")
+ row.operator("mesh.archimesh_winpanel")
+ row = box.row()
+ row.operator("mesh.archimesh_kitchen")
+ row.operator("mesh.archimesh_shelves")
+ row = box.row()
+ row.operator("mesh.archimesh_stairs")
+ row.operator("mesh.archimesh_roof")
+
+ # ------------------------------
+ # Prop Buttons
+ # ------------------------------
+ box = layout.box()
+ box.label("Props", icon='LAMP_DATA')
+ row = box.row()
+ row.operator("mesh.archimesh_books")
+ row.operator("mesh.archimesh_lamp")
+ row = box.row()
+ row.operator("mesh.archimesh_venetian")
+ row.operator("mesh.archimesh_roller")
+ row = box.row()
+ row.operator("mesh.archimesh_japan")
+
+ # ------------------------------
+ # OpenGL Buttons
+ # ------------------------------
+ box = layout.box()
+ box.label("Display hints", icon='QUESTION')
+ row = box.row()
+ if context.window_manager.archimesh_run_opengl is False:
+ icon = 'PLAY'
+ txt = 'Show'
+ else:
+ icon = "PAUSE"
+ txt = 'Hide'
+ row.operator("archimesh.runopenglbutton", text=txt, icon=icon)
+ row = box.row()
+ row.prop(scene, "archimesh_gl_measure", toggle=True, icon="ALIGN")
+ row.prop(scene, "archimesh_gl_name", toggle=True, icon="OUTLINER_OB_FONT")
+ row.prop(scene, "archimesh_gl_ghost", icon='GHOST_ENABLED')
+ row = box.row()
+ row.prop(scene, "archimesh_text_color", text="")
+ row.prop(scene, "archimesh_walltext_color", text="")
+ row = box.row()
+ row.prop(scene, "archimesh_font_size")
+ row.prop(scene, "archimesh_wfont_size")
+ row = box.row()
+ row.prop(scene, "archimesh_hint_space")
+ # ------------------------------
+ # Grease pencil tools
+ # ------------------------------
+ box = layout.box()
+ box.label("Pencil Tools", icon='MODIFIER')
+ row = box.row(align=False)
+ row.operator("object.archimesh_pencil_room", icon='GREASEPENCIL')
+ row = box.row(align=False)
+ row.prop(scene, "archimesh_ceiling")
+ row.prop(scene, "archimesh_floor")
+ row.prop(scene, "archimesh_merge")
+
+
+# -------------------------------------------------------------
+# Defines button for enable/disable the tip display
+#
+# -------------------------------------------------------------
+class AchmRunHintDisplayButton(bpy.types.Operator):
+ bl_idname = "archimesh.runopenglbutton"
+ bl_label = "Display hint data manager"
+ bl_description = "Display aditional information in the viewport"
+ bl_category = 'Archimesh'
+
+ _handle = None # keep function handler
+
+ # ----------------------------------
+ # Enable gl drawing adding handler
+ # ----------------------------------
+ @staticmethod
+ def handle_add(self, context):
+ if AchmRunHintDisplayButton._handle is None:
+ AchmRunHintDisplayButton._handle = bpy.types.SpaceView3D.draw_handler_add(draw_callback_px, (self, context),
+ 'WINDOW',
+ 'POST_PIXEL')
+ context.window_manager.archimesh_run_opengl = True
+
+ # ------------------------------------
+ # Disable gl drawing removing handler
+ # ------------------------------------
+ # noinspection PyUnusedLocal
+ @staticmethod
+ def handle_remove(self, context):
+ if AchmRunHintDisplayButton._handle is not None:
+ bpy.types.SpaceView3D.draw_handler_remove(AchmRunHintDisplayButton._handle, 'WINDOW')
+ AchmRunHintDisplayButton._handle = None
+ context.window_manager.archimesh_run_opengl = False
+
+ # ------------------------------
+ # Execute button action
+ # ------------------------------
+ def execute(self, context):
+ if context.area.type == 'VIEW_3D':
+ if context.window_manager.archimesh_run_opengl is False:
+ self.handle_add(self, context)
+ context.area.tag_redraw()
+ else:
+ self.handle_remove(self, context)
+ context.area.tag_redraw()
+
+ return {'FINISHED'}
+ else:
+ self.report({'WARNING'},
+ "View3D not found, cannot run operator")
+
+ return {'CANCELLED'}
+
+
+# -------------------------------------------------------------
+# Handler for drawing OpenGl
+# -------------------------------------------------------------
+# noinspection PyUnusedLocal
+def draw_callback_px(self, context):
+ draw_main(context)
diff --git a/archimesh/achm_roof_maker.py b/archimesh/achm_roof_maker.py
new file mode 100644
index 00000000..d7840b81
--- /dev/null
+++ b/archimesh/achm_roof_maker.py
@@ -0,0 +1,586 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+# ----------------------------------------------------------
+# Automatic generation of roofs
+# Author: Antonio Vazquez (antonioya)
+#
+# ----------------------------------------------------------
+# noinspection PyUnresolvedReferences
+import bpy
+import math
+from achm_tools import *
+
+
+# ------------------------------------------------------------------
+# Define UI class
+# Rooms
+# ------------------------------------------------------------------
+class AchmRoof(bpy.types.Operator):
+ bl_idname = "mesh.archimesh_roof"
+ bl_label = "Roof"
+ bl_description = "Roof Generator"
+ bl_category = 'Archimesh'
+ bl_options = {'REGISTER', 'UNDO'}
+
+ # Define properties
+ roof_width = bpy.props.IntProperty(
+ name='Num tiles X',
+ min=1, max=100, default=6,
+ description='Tiles in X axis',
+ )
+ roof_height = bpy.props.IntProperty(
+ name='Num tiles Y',
+ min=1, max=100, default=3,
+ description='Tiles in Y axis',
+ )
+
+ roof_thick = bpy.props.FloatProperty(
+ name='Tile thickness',
+ min=0.000, max=0.50, default=0.012, precision=3,
+ description='Thickness of the roof tile',
+ )
+ roof_angle = bpy.props.FloatProperty(
+ name='Roof slope', min=0.0, max=70.0, default=0.0, precision=1,
+ description='Roof angle of slope',
+ )
+ roof_scale = bpy.props.FloatProperty(
+ name='Tile scale', min=0.001, max=10, default=1, precision=3,
+ description='Scale of roof tile',
+ )
+
+ crt_mat = bpy.props.BoolProperty(
+ name="Create default Cycles materials",
+ description="Create default materials for Cycles render",
+ default=True,
+ )
+
+ model = bpy.props.EnumProperty(
+ items=(
+ ('1', "Model 01", ""),
+ ('2', "Model 02", ""),
+ ('3', "Model 03", ""),
+ ('4', "Model 04", "")),
+ name="Model",
+ description="Roof tile model",
+ )
+
+ # -----------------------------------------------------
+ # Draw (create UI interface)
+ # -----------------------------------------------------
+ # noinspection PyUnusedLocal
+ def draw(self, context):
+ layout = self.layout
+ space = bpy.context.space_data
+ if not space.local_view:
+ # Imperial units warning
+ if bpy.context.scene.unit_settings.system == "IMPERIAL":
+ row = layout.row()
+ row.label("Warning: Imperial units not supported", icon='COLOR_RED')
+ box = layout.box()
+ box.prop(self, 'model')
+ box.prop(self, 'roof_width')
+ box.prop(self, 'roof_height')
+ box.prop(self, 'roof_scale')
+
+ tilesize_x = 0
+ tilesize_y = 0
+ if self.model == "1":
+ tilesize_x = 0.184
+ tilesize_y = 0.413
+
+ if self.model == "2":
+ tilesize_x = 0.103
+ tilesize_y = 0.413
+
+ if self.model == "3":
+ tilesize_x = 0.184
+ tilesize_y = 0.434
+
+ if self.model == "4":
+ tilesize_x = 0.231
+ tilesize_y = 0.39
+
+ x = tilesize_x * self.roof_scale * self.roof_width
+ y = tilesize_y * self.roof_scale * self.roof_height
+
+ buf = 'Size: {0:.2f} * {1:.2f} aprox.'.format(x, y)
+ box.label(buf)
+
+ box = layout.box()
+ box.prop(self, 'roof_thick')
+ box.prop(self, 'roof_angle')
+
+ box = layout.box()
+ box.prop(self, 'crt_mat')
+ else:
+ row = layout.row()
+ row.label("Warning: Operator does not work in local view mode", icon='ERROR')
+
+ # -----------------------------------------------------
+ # Execute
+ # -----------------------------------------------------
+ # noinspection PyUnusedLocal
+ def execute(self, context):
+ if bpy.context.mode == "OBJECT":
+ create_roof_mesh(self)
+ return {'FINISHED'}
+ else:
+ self.report({'WARNING'}, "Archimesh: Option only valid in Object mode")
+ return {'CANCELLED'}
+
+
+# ------------------------------------------------------------------------------
+# Generate mesh data
+# All custom values are passed using self container (self.myvariable)
+# ------------------------------------------------------------------------------
+def create_roof_mesh(self):
+ # deactivate others
+ for o in bpy.data.objects:
+ if o.select is True:
+ o.select = False
+ bpy.ops.object.select_all(False)
+
+ mydata = create_roof(self)
+ myroof = mydata[0]
+
+ # active object and deactivate others
+ if bpy.context.scene.objects.active is not None:
+ bpy.context.scene.objects.active.select = False
+
+ bpy.context.scene.objects.active = myroof
+ myroof.select = True
+
+ # Thicknes
+ if self.roof_thick > 0.0:
+ set_modifier_solidify(myroof, self.roof_thick)
+ # Subsurf
+ set_modifier_subsurf(myroof)
+ set_smooth(myroof)
+
+ a_x = 0.85
+ a_y = 0.85
+
+ if self.model == "1":
+ a_x = 0.85
+ a_y = 0.85
+
+ if self.model == "2":
+ a_x = 0.90
+ a_y = 0.85
+
+ if self.model == "3":
+ a_x = 0.80
+ a_y = 0.85
+
+ if self.model == "4":
+ a_x = 0.80
+ a_y = 0.85
+
+ set_modifier_array(myroof, "X", a_x, self.roof_width)
+ set_modifier_array(myroof, "Y", a_y, self.roof_height)
+
+ # Slope
+ myroof.rotation_euler = (math.radians(self.roof_angle), 0.0, 0.0)
+
+ # Create materials
+ if self.crt_mat:
+ # material
+ mat = create_diffuse_material("Roof_material", False, 0.482, 0.061, 0.003, 0.581, 0.105, 0.068, 0.01)
+ set_material(myroof, mat)
+
+ bpy.ops.object.select_all(False)
+ myroof.select = True
+ bpy.context.scene.objects.active = myroof
+ return
+
+
+# ------------------------------------------------------------------------------
+# Create Roof
+# All custom values are passed using self container (self.myvariable)
+# ------------------------------------------------------------------------------
+def create_roof(self):
+ # Retry mesh data
+ if self.model == "1":
+ mydata = tile_model_01()
+ elif self.model == "2":
+ mydata = tile_model_02()
+ elif self.model == "3":
+ mydata = tile_model_03()
+ elif self.model == "4":
+ mydata = tile_model_04()
+ else:
+ mydata = tile_model_01() # default model
+
+ # move data
+ verts = mydata[0]
+ faces = mydata[1]
+ tile_x = mydata[2]
+ tile_y = mydata[3]
+
+ mymesh = bpy.data.meshes.new("Roof")
+ myobject = bpy.data.objects.new("Roof", mymesh)
+
+ myobject.location = bpy.context.scene.cursor_location
+ bpy.context.scene.objects.link(myobject)
+
+ mymesh.from_pydata(verts, [], faces)
+ mymesh.update(calc_edges=True)
+ # Scale
+ myobject.scale = (self.roof_scale, self.roof_scale, self.roof_scale)
+
+ return myobject, tile_x, tile_y
+
+
+# ----------------------------------------------
+# Tile model 01
+# ----------------------------------------------
+def tile_model_01():
+ # ------------------------------------
+ # Mesh data
+ # ------------------------------------
+ minx = -2.60770320892334e-08
+ maxx = 0.19982914626598358
+ miny = -0.0010638721287250519
+ maxy = 0.46471506357192993
+ minz = -0.03651249408721924
+ maxz = 0.0586184486746788
+
+ # Vertex
+ myvertex = [(maxx - 0.0912834107875824, maxy - 0.0017275810241699219, maxz - 0.046515291556715965),
+ (maxx - 0.08774729073047638, maxy - 0.0021544992923736572, minz + 0.02855057455599308),
+ (minx + 0.007649015635251999, maxy - 0.002105712890625, minz + 0.03084239922463894),
+ (minx + 0.012062381953001022, maxy - 0.0016825199127197266, maxz - 0.044397931545972824),
+ (minx + 0.023753326386213303, maxy - 0.0013274550437927246, maxz - 0.02770993858575821),
+ (minx + 0.04094201326370239, maxy - 0.0010945796966552734, maxz - 0.016765158623456955),
+ (minx + 0.061011623591184616, maxy - 0.0010193586349487305, maxz - 0.013229843229055405),
+ (minx + 0.09759850427508354, maxy - 0.0013619065284729004, maxz - 0.02933049201965332),
+ (minx + 0.0809067152440548, maxy - 0.0011132359504699707, maxz - 0.017642192542552948),
+ (minx + 0.04091371223330498, maxy - 0.005662411451339722, maxz - 0.01663973182439804),
+ (minx + 0.061012353748083115, maxy - 0.00558704137802124, maxz - 0.013099301606416702),
+ (minx + 0.007572557777166367, maxy - 0.006675034761428833, minz + 0.030899077653884888),
+ (minx + 0.011992301791906357, maxy - 0.006251156330108643, maxz - 0.044312480837106705),
+ (minx + 0.09765215590596199, maxy - 0.005930125713348389, maxz - 0.029223240911960602),
+ (maxx - 0.09121392667293549, maxy - 0.006296277046203613, maxz - 0.04643290489912033),
+ (minx + 0.02370016649365425, maxy - 0.00589558482170105, maxz - 0.027600344270467758),
+ (maxx - 0.08767268061637878, maxy - 0.006723880767822266, minz + 0.028603939339518547),
+ (minx + 0.08093622699379921, maxy - 0.005681097507476807, maxz - 0.01751803606748581),
+ (minx + 0.06108579412102699, miny + 0.0018242448568344116, maxz),
+ (minx + 0.0049602799117565155, miny + 0.0010638684034347534, maxz - 0.03573753498494625),
+ (maxx - 0.08424043655395508, miny + 0.0010122060775756836, maxz - 0.038165315985679626),
+ (minx + 0.018365193158388138, miny + 0.0014709830284118652, maxz - 0.016602978110313416),
+ (maxx - 0.0801858901977539, miny + 0.0005226880311965942, minz + 0.03395887836813927),
+ (minx + 0.08389763161540031, miny + 0.0017166286706924438, maxz - 0.005059238523244858),
+ (minx + 0.03807384893298149, miny + 0.001738026738166809, maxz - 0.004053622484207153),
+ (minx + 1.1175870895385742e-08, miny + 0.0010638725943863392, minz + 0.03651248663663864),
+ (maxx - 0.09679263085126877, miny + 0.0014314353466033936, maxz - 0.018461115658283234),
+ (minx + 0.06108483672142029, miny + 0.007804900407791138, maxz - 0.00017091631889343262),
+ (minx + 0.0050520338118076324, miny + 0.0070457905530929565, maxz - 0.03584941849112511),
+ (maxx - 0.08433142304420471, miny + 0.006994202733039856, maxz - 0.03827318921685219),
+ (minx + 0.018434803932905197, miny + 0.007452219724655151, maxz - 0.01674646884202957),
+ (maxx - 0.08028358221054077, miny + 0.006505459547042847, minz + 0.03388900891877711),
+ (minx + 0.08385899290442467, miny + 0.007697448134422302, maxz - 0.005221795290708542),
+ (minx + 0.03811090067028999, miny + 0.007718801498413086, maxz - 0.004217840731143951),
+ (minx, miny + 0.006561309099197388, minz + 0.036512489430606365),
+ (maxx - 0.09686288237571716, miny + 0.007412716746330261, maxz - 0.018601536750793457),
+ (maxx - 0.011097520589828491, maxy - 0.00127333402633667, minz + 0.03322591632604599),
+ (maxx - 0.007561400532722473, maxy, maxz - 0.041875842958688736),
+ (minx + 0.0878349058330059, maxy - 0.00014543533325195312, maxz - 0.04416356980800629),
+ (minx + 0.09224827215075493, maxy - 0.0014076828956604004, minz + 0.03111234214156866),
+ (maxx - 0.09588995575904846, maxy - 0.0024666786193847656, minz + 0.014454199001193047),
+ (maxx - 0.07870127260684967, maxy - 0.003161191940307617, minz + 0.003528997302055359),
+ (maxx - 0.05863165855407715, maxy - 0.0033855140209198, minz),
+ (maxx - 0.022044777870178223, maxy - 0.0023638010025024414, minz + 0.016071850433945656),
+ (maxx - 0.03873656690120697, maxy - 0.0031055212020874023, minz + 0.0044044628739356995),
+ (maxx - 0.07872956991195679, maxy - 0.007723212242126465, minz + 0.003790721297264099),
+ (maxx - 0.05863092839717865, maxy - 0.007947862148284912, minz + 0.0002566203474998474),
+ (minx + 0.08775844797492027, maxy - 0.004703164100646973, maxz - 0.043833211064338684),
+ (minx + 0.09217819198966026, maxy - 0.005967140197753906, minz + 0.03141397051513195),
+ (maxx - 0.021991118788719177, maxy - 0.006924688816070557, minz + 0.016351722180843353),
+ (maxx - 0.01102803647518158, maxy - 0.005832552909851074, minz + 0.03353060130029917),
+ (maxx - 0.09594311565160751, maxy - 0.007027685642242432, minz + 0.01473172940313816),
+ (maxx - 0.007486790418624878, maxy - 0.004557549953460693, maxz - 0.04154217056930065),
+ (maxx - 0.03870706260204315, maxy - 0.007667511701583862, minz + 0.004667460918426514),
+ (maxx - 0.05855749547481537, miny, minz + 0.026008986867964268),
+ (minx + 0.08514617010951042, miny + 0.0022678226232528687, maxz - 0.033448345959186554),
+ (maxx - 0.004054546356201172, miny + 0.0024218857288360596, maxz - 0.031024910509586334),
+ (minx + 0.09855108335614204, miny + 0.0010535866022109985, minz + 0.04258226789534092),
+ (maxx, miny + 0.0038818269968032837, maxz - 0.008059307932853699),
+ (maxx - 0.03574565052986145, miny + 0.00032107532024383545, minz + 0.03105917200446129),
+ (maxx - 0.08156943321228027, miny + 0.0002572685480117798, minz + 0.030055356211960316),
+ (minx + 0.0801859013736248, miny + 0.004204884171485901, maxz - 0.01064956933259964),
+ (maxx - 0.016606733202934265, miny + 0.0011714845895767212, minz + 0.04443708248436451),
+ (maxx - 0.058558449149131775, miny + 0.005973652005195618, minz + 0.0256729768589139),
+ (minx + 0.08523792400956154, miny + 0.008237749338150024, maxz - 0.03384328447282314),
+ (maxx - 0.004145532846450806, miny + 0.008391529321670532, maxz - 0.031423844397068024),
+ (minx + 0.0986206941306591, miny + 0.00702551007270813, minz + 0.04221887979656458),
+ (maxx - 9.769201278686523e-05, miny + 0.00984904170036316, maxz - 0.008496180176734924),
+ (maxx - 0.0357842892408371, miny + 0.0062942057847976685, minz + 0.030714819207787514),
+ (maxx - 0.08153238147497177, miny + 0.006230458617210388, minz + 0.029712661169469357),
+ (minx + 0.08018588647246361, miny + 0.00968259572982788, maxz - 0.011114969849586487),
+ (maxx - 0.016676992177963257, miny + 0.007143184542655945, minz + 0.04407063312828541)]
+
+ # Faces
+ myfaces = [(10, 9, 5, 6), (12, 11, 2, 3), (14, 13, 7, 0), (15, 12, 3, 4), (16, 14, 0, 1),
+ (17, 10, 6, 8), (9, 15, 4, 5), (13, 17, 8, 7), (27, 33, 9, 10), (28, 34, 11, 12),
+ (29, 35, 13, 14), (30, 28, 12, 15), (31, 29, 14, 16), (32, 27, 10, 17), (33, 30, 15, 9),
+ (35, 32, 17, 13), (18, 24, 33, 27), (19, 25, 34, 28), (20, 26, 35, 29), (21, 19, 28, 30),
+ (22, 20, 29, 31), (23, 18, 27, 32), (24, 21, 30, 33), (26, 23, 32, 35), (46, 45, 41, 42),
+ (48, 47, 38, 39), (50, 49, 43, 36), (51, 48, 39, 40), (52, 50, 36, 37), (53, 46, 42, 44),
+ (45, 51, 40, 41), (49, 53, 44, 43), (63, 69, 45, 46), (64, 70, 47, 48), (65, 71, 49, 50),
+ (66, 64, 48, 51), (67, 65, 50, 52), (68, 63, 46, 53), (69, 66, 51, 45), (71, 68, 53, 49),
+ (54, 60, 69, 63), (55, 61, 70, 64), (56, 62, 71, 65), (57, 55, 64, 66), (58, 56, 65, 67),
+ (59, 54, 63, 68), (60, 57, 66, 69), (62, 59, 68, 71)]
+
+ return myvertex, myfaces, maxx - minx, maxy - miny
+
+
+# ----------------------------------------------
+# Tile model 02
+# ----------------------------------------------
+def tile_model_02():
+ # ------------------------------------
+ # Mesh data
+ # ------------------------------------
+ minx = -2.60770320892334e-08
+ maxx = 0.11964325606822968
+ miny = -0.000541184563189745
+ maxy = 0.4636957049369812
+ minz = -0.007961912080645561
+ maxz = 0.0586184561252594
+
+ # Vertex
+ myvertex = [(maxx - 0.011097520589828491, maxy - 0.0007082223892211914, minz + 0.020065076649188995),
+ (maxx - 0.007561400532722473, maxy - 0.0011351406574249268, minz),
+ (minx + 0.007649015635251999, maxy - 0.0010863542556762695, minz + 0.0022918246686458588),
+ (minx + 0.012062381953001022, maxy - 0.0006631612777709961, minz + 0.022182436659932137),
+ (minx + 0.023753326386213303, maxy - 0.00030809640884399414, maxz - 0.02770993858575821),
+ (minx + 0.04094201326370239, maxy - 7.522106170654297e-05, maxz - 0.016765158623456955),
+ (maxx - 0.05863165855407715, maxy, maxz - 0.013229843229055405),
+ (maxx - 0.022044777870178223, maxy - 0.0003425478935241699, maxz - 0.02933049201965332),
+ (maxx - 0.03873656690120697, maxy - 9.387731552124023e-05, maxz - 0.017642192542552948),
+ (minx + 0.04091371223330498, maxy - 0.004643052816390991, maxz - 0.01663973182439804),
+ (maxx - 0.05863092839717865, maxy - 0.00456768274307251, maxz - 0.013099301606416702),
+ (minx + 0.007572557777166367, maxy - 0.0056556761264801025, minz + 0.0023485030978918076),
+ (minx + 0.011992301791906357, maxy - 0.005231797695159912, minz + 0.022267887368798256),
+ (maxx - 0.021991126239299774, maxy - 0.004910767078399658, maxz - 0.029223240911960602),
+ (maxx - 0.01102803647518158, maxy - 0.005276918411254883, minz + 0.02014746330678463),
+ (minx + 0.02370016649365425, maxy - 0.004876226186752319, maxz - 0.027600344270467758),
+ (maxx - 0.007486790418624878, maxy - 0.005704522132873535, minz + 5.336478352546692e-05),
+ (maxx - 0.038707055151462555, maxy - 0.004661738872528076, maxz - 0.01751803606748581),
+ (maxx - 0.05855748802423477, miny + 0.0013015568256378174, maxz),
+ (minx + 0.0049602799117565155, miny + 0.0005411803722381592, minz + 0.03084283322095871),
+ (maxx - 0.004054546356201172, miny + 0.0004895180463790894, minz + 0.028415052220225334),
+ (minx + 0.018365193158388138, miny + 0.000948294997215271, maxz - 0.016602978110313416),
+ (maxx, miny, minz + 0.005408303812146187),
+ (maxx - 0.03574565052986145, miny + 0.0011939406394958496, maxz - 0.005059238523244858),
+ (minx + 0.03807384893298149, miny + 0.0012153387069702148, maxz - 0.004053622484207153),
+ (minx + 1.1175870895385742e-08, miny + 0.000541184563189745, minz + 0.007961912080645561),
+ (maxx - 0.016606740653514862, miny + 0.0009087473154067993, maxz - 0.018461115658283234),
+ (maxx - 0.058558445423841476, miny + 0.0072822123765945435, maxz - 0.00017091631889343262),
+ (minx + 0.0050520338118076324, miny + 0.006523102521896362, minz + 0.030730949714779854),
+ (maxx - 0.004145532846450806, miny + 0.006471514701843262, minz + 0.028307178989052773),
+ (minx + 0.018434803932905197, miny + 0.006929531693458557, maxz - 0.01674646884202957),
+ (maxx - 9.769201278686523e-05, miny + 0.0059827715158462524, minz + 0.005338434362784028),
+ (maxx - 0.0357842892408371, miny + 0.007174760103225708, maxz - 0.005221795290708542),
+ (minx + 0.03811090067028999, miny + 0.007196113467216492, maxz - 0.004217840731143951),
+ (minx, miny + 0.0060386210680007935, minz + 0.007961914874613285),
+ (maxx - 0.016676992177963257, miny + 0.006890028715133667, maxz - 0.018601536750793457)]
+
+ # Faces
+ myfaces = [(10, 9, 5, 6), (12, 11, 2, 3), (14, 13, 7, 0), (15, 12, 3, 4), (16, 14, 0, 1),
+ (17, 10, 6, 8), (9, 15, 4, 5), (13, 17, 8, 7), (27, 33, 9, 10), (28, 34, 11, 12),
+ (29, 35, 13, 14), (30, 28, 12, 15), (31, 29, 14, 16), (32, 27, 10, 17), (33, 30, 15, 9),
+ (35, 32, 17, 13), (18, 24, 33, 27), (19, 25, 34, 28), (20, 26, 35, 29), (21, 19, 28, 30),
+ (22, 20, 29, 31), (23, 18, 27, 32), (24, 21, 30, 33), (26, 23, 32, 35)]
+
+ return myvertex, myfaces, maxx - minx, maxy - miny
+
+
+# ----------------------------------------------
+# Tile model 03
+# ----------------------------------------------
+def tile_model_03():
+ # ------------------------------------
+ # Mesh data
+ # ------------------------------------
+ minx = -1.1175870895385742e-08
+ maxx = 0.19973646104335785
+ miny = -0.007466380018740892
+ maxy = 0.4636957049369812
+ minz = -0.014226417988538742
+ maxz = 0.0586184561252594
+
+ # Vertex
+ myvertex = [(maxx - 0.09119071066379547, maxy - 0.0007082223892211914, minz + 0.026329582557082176),
+ (maxx - 0.08765459060668945, maxy - 0.0011351406574249268, minz + 0.006264505907893181),
+ (minx + 0.007649015635251999, maxy - 0.0010863542556762695, minz + 0.00855633057653904),
+ (minx + 0.012062381953001022, maxy - 0.0006631612777709961, minz + 0.028446942567825317),
+ (minx + 0.023753326386213303, maxy - 0.00030809640884399414, maxz - 0.02770993858575821),
+ (minx + 0.04094201326370239, maxy - 7.522106170654297e-05, maxz - 0.016765158623456955),
+ (minx + 0.061011623591184616, maxy, maxz - 0.013229843229055405),
+ (minx + 0.09759850427508354, maxy - 0.0003425478935241699, maxz - 0.02933049201965332),
+ (minx + 0.0809067152440548, maxy - 9.387731552124023e-05, maxz - 0.017642192542552948),
+ (maxx, miny, minz + 0.009998040273785591),
+ (maxx, maxy - 0.0012684464454650879, minz),
+ (maxx - 0.011666849255561829, miny + 5.453824996948242e-06, minz + 0.01025407388806343),
+ (maxx - 0.012786239385604858, maxy - 0.0012489855289459229, minz + 0.0009138062596321106),
+ (maxx - 0.00027532875537872314, miny + 0.00016899406909942627, minz + 0.017940200865268707),
+ (maxx - 0.00027532875537872314, maxy - 0.0010994374752044678, minz + 0.007942160591483116),
+ (maxx - 0.011416733264923096, miny + 0.00017443299293518066, minz + 0.018196236342191696),
+ (maxx - 0.012485697865486145, maxy - 0.0010799765586853027, minz + 0.008855968713760376),
+ (minx + 0.04091371223330498, maxy - 0.004643052816390991, maxz - 0.01663973182439804),
+ (minx + 0.061012353748083115, maxy - 0.00456768274307251, maxz - 0.013099301606416702),
+ (minx + 0.007572557777166367, maxy - 0.0056556761264801025, minz + 0.008613009005784988),
+ (minx + 0.011992301791906357, maxy - 0.005231797695159912, minz + 0.028532393276691437),
+ (minx + 0.09765215590596199, maxy - 0.004910767078399658, maxz - 0.029223240911960602),
+ (maxx - 0.09112122654914856, maxy - 0.005276918411254883, minz + 0.02641196921467781),
+ (minx + 0.02370016649365425, maxy - 0.004876226186752319, maxz - 0.027600344270467758),
+ (maxx - 0.08757998049259186, maxy - 0.005704522132873535, minz + 0.006317870691418648),
+ (minx + 0.08093622699379921, maxy - 0.004661738872528076, maxz - 0.01751803606748581),
+ (maxx, maxy - 0.00583687424659729, minz + 9.720027446746826e-05),
+ (maxx - 0.01277536153793335, maxy - 0.0058175623416900635, minz + 0.0010046139359474182),
+ (maxx - 0.00027532875537872314, maxy - 0.00566786527633667, minz + 0.008039364591240883),
+ (maxx - 0.012475311756134033, maxy - 0.005648583173751831, minz + 0.008946776390075684),
+ (minx + 0.06108579412102699, miny + 0.008226752281188965, maxz),
+ (minx + 0.0049602799117565155, miny + 0.007466375827789307, maxz - 0.03573753498494625),
+ (maxx - 0.08414773643016815, miny + 0.007414713501930237, minz + 0.034679558128118515),
+ (minx + 0.018365193158388138, miny + 0.007873490452766418, maxz - 0.016602978110313416),
+ (maxx - 0.08009319007396698, miny + 0.0069251954555511475, minz + 0.011672809720039368),
+ (minx + 0.08389763161540031, miny + 0.008119136095046997, maxz - 0.005059238523244858),
+ (maxx, miny + 0.00688643753528595, minz + 0.009851515293121338),
+ (maxx - 0.011683255434036255, miny + 0.006892099976539612, minz + 0.010117188096046448),
+ (maxx - 0.00027532875537872314, miny + 0.007055431604385376, minz + 0.017793675884604454),
+ (maxx - 0.01143239438533783, miny + 0.007061079144477844, minz + 0.018059348687529564),
+ (minx + 0.03807384893298149, miny + 0.008140534162521362, maxz - 0.004053622484207153),
+ (minx + 1.1175870895385742e-08, miny + 0.007466380018740892, minz + 0.014226417988538742),
+ (maxx - 0.09669993072748184, miny + 0.007833942770957947, maxz - 0.018461115658283234),
+ (minx + 0.06108483672142029, miny + 0.014207407832145691, maxz - 0.00017091631889343262),
+ (minx + 0.0050520338118076324, miny + 0.01344829797744751, maxz - 0.03584941849112511),
+ (maxx - 0.08423872292041779, miny + 0.01339671015739441, minz + 0.03457168489694595),
+ (minx + 0.018434803932905197, miny + 0.013854727149009705, maxz - 0.01674646884202957),
+ (maxx - 0.08019088208675385, miny + 0.0129079669713974, minz + 0.011602940270677209),
+ (minx + 0.08385899290442467, miny + 0.014099955558776855, maxz - 0.005221795290708542),
+ (maxx, miny + 0.012868016958236694, minz + 0.00972424354404211),
+ (maxx - 0.011697500944137573, miny + 0.012873843312263489, minz + 0.009998289868235588),
+ (maxx - 0.00027532875537872314, miny + 0.01303701102733612, minz + 0.017666404135525227),
+ (maxx - 0.011445999145507812, miny + 0.013042852282524109, minz + 0.017940450459718704),
+ (minx + 0.03811090067028999, miny + 0.01412130892276764, maxz - 0.004217840731143951),
+ (minx, miny + 0.012963816523551941, minz + 0.014226420782506466),
+ (maxx - 0.09677018225193024, miny + 0.013815224170684814, maxz - 0.018601536750793457)]
+
+ # Faces
+ myfaces = [(18, 17, 5, 6), (20, 19, 2, 3), (22, 21, 7, 0), (23, 20, 3, 4), (24, 22, 0, 1),
+ (25, 18, 6, 8), (17, 23, 4, 5), (21, 25, 8, 7), (12, 10, 14, 16), (24, 1, 12, 27),
+ (29, 16, 14, 28), (9, 11, 15, 13), (36, 9, 13, 38), (27, 12, 16, 29), (43, 53, 17, 18),
+ (44, 54, 19, 20), (45, 55, 21, 22), (46, 44, 20, 23), (47, 45, 22, 24), (48, 43, 18, 25),
+ (53, 46, 23, 17), (55, 48, 25, 21), (47, 24, 27, 50), (52, 29, 28, 51), (10, 26, 28, 14),
+ (50, 27, 29, 52), (49, 36, 38, 51), (15, 39, 38, 13), (11, 37, 39, 15), (30, 40, 53, 43),
+ (31, 41, 54, 44), (32, 42, 55, 45), (33, 31, 44, 46), (34, 32, 45, 47), (35, 30, 43, 48),
+ (40, 33, 46, 53), (42, 35, 48, 55), (34, 47, 50, 37), (39, 52, 51, 38), (37, 50, 52, 39),
+ (26, 49, 51, 28)]
+
+ return myvertex, myfaces, maxx - minx, maxy - miny
+
+
+# ----------------------------------------------
+# Tile model 04
+# ----------------------------------------------
+def tile_model_04():
+ # ------------------------------------
+ # Mesh data
+ # ------------------------------------
+ minx = 0
+ maxx = 0.2706337571144104
+ miny = -0.0008960736449807882
+ maxy = 0.4393549859523773
+ minz = -0.021988021209836006
+ maxz = 0.01913231611251831
+
+ # Vertex
+ myvertex = [(maxx - 0.0009386539459228516, miny + 9.811518248170614e-05, minz + 0.009184492751955986),
+ (minx + 2.9802322387695312e-08, miny + 0.0008960723644122481, maxz - 0.01913231797516346),
+ (maxx, maxy - 0.000797957181930542, minz + 0.0015743095427751541),
+ (minx + 0.0009386688470840454, maxy, minz + 0.014377830550074577),
+ (maxx - 0.03795182704925537, miny + 0.00020762975327670574, minz + 0.010941661894321442),
+ (minx + 0.03701320290565491, miny + 0.0007865577936172485, minz + 0.020230852998793125),
+ (maxx - 0.037013158202171326, maxy - 0.0006884634494781494, minz + 0.003331473097205162),
+ (minx + 0.037951841950416565, maxy - 0.00010952353477478027, minz + 0.01262066513299942),
+ (minx + 0.1184280663728714, miny + 0.000545668532140553, minz + 0.016365760006010532),
+ (maxx - 0.11936667561531067, miny + 0.00044850551057606936, minz + 0.014806757681071758),
+ (minx + 0.11936671286821365, maxy - 0.0003504157066345215, minz + 0.008755568414926529),
+ (maxx - 0.11842802166938782, maxy - 0.0004475712776184082, minz + 0.007196567952632904),
+ (maxx, miny + 0.010358194587752223, maxz - 0.012803521938621998),
+ (minx + 0.0009386688470840454, miny + 0.01115613873116672, maxz),
+ (minx + 0.037951841950416565, miny + 0.011046637548133731, maxz - 0.0017571654170751572),
+ (maxx - 0.037013158202171326, miny + 0.010467695770785213, maxz - 0.011046357452869415),
+ (minx + 0.11922238767147064, miny + 0.010617014719173312, maxz - 0.008650526404380798),
+ (maxx - 0.11857235431671143, miny + 0.010519851697608829, maxz - 0.010209528729319572),
+ (maxx, maxy - 0.0072495341300964355, minz + 0.001976391300559044),
+ (minx + 0.037951841950416565, maxy - 0.006561100482940674, minz + 0.01302274689078331),
+ (maxx - 0.037013158202171326, maxy - 0.007140040397644043, minz + 0.003733554854989052),
+ (minx + 0.11936454474925995, maxy - 0.006804823875427246, minz + 0.009112119674682617),
+ (maxx - 0.11843019723892212, maxy - 0.006901979446411133, minz + 0.007553117349743843),
+ (minx + 0.0009386688470840454, maxy - 0.0064515769481658936, minz + 0.014779912307858467),
+ (minx + 0.00011220574378967285, miny + 0.0021222709910944104, maxz - 0.016845770180225372),
+ (maxx - 0.0008264482021331787, miny + 0.0013243272551335394, minz + 0.011471047066152096),
+ (minx + 0.03712538629770279, miny + 0.002012769808061421, maxz - 0.01860293745994568),
+ (maxx - 0.0378396213054657, miny + 0.001433828438166529, minz + 0.013228209689259529),
+ (minx + 0.1185230016708374, miny + 0.0017493232735432684, minz + 0.018290389329195023),
+ (maxx - 0.11927174031734467, miny + 0.0016521602519787848, minz + 0.01673138700425625),
+ (maxx, miny + 0.01807751110754907, maxz - 0.013284613378345966),
+ (minx + 0.037951841950416565, miny + 0.01876595593057573, maxz - 0.0022382568567991257),
+ (maxx - 0.037013158202171326, miny + 0.01818701229058206, maxz - 0.011527448892593384),
+ (minx + 0.11922498792409897, miny + 0.01833972311578691, maxz - 0.009077141061425209),
+ (maxx - 0.1185697615146637, miny + 0.018242560094222426, maxz - 0.010636141523718834),
+ (minx + 0.0009386688470840454, miny + 0.018875457113608718, maxz - 0.0004810914397239685),
+ (maxx, maxy - 0.09558254480361938, minz + 0.007481573149561882),
+ (minx + 0.037951841950416565, maxy - 0.09489411115646362, minz + 0.018527928739786148),
+ (maxx - 0.037013158202171326, maxy - 0.09547305107116699, minz + 0.00923873856663704),
+ (minx + 0.1202642098069191, maxy - 0.09396132826805115, maxz - 0.00762566365301609),
+ (maxx - 0.11753053963184357, maxy - 0.09405851364135742, maxz - 0.009184665977954865),
+ (minx + 0.0009386688470840454, maxy - 0.09478458762168884, minz + 0.02028509508818388),
+ (maxx - 0.07891011238098145, miny, minz + 0.007610190659761429),
+ (maxx - 0.07797147333621979, maxy - 0.0008960962295532227, minz),
+ (maxx - 0.07804363965988159, miny + 0.010165706044062972, maxz - 0.0158919645473361),
+ (maxx - 0.07797256112098694, maxy - 0.007349073886871338, minz + 0.0003793146461248398),
+ (maxx - 0.0788065642118454, miny + 0.0012149333488196135, minz + 0.009715777821838856),
+ (maxx - 0.07804234325885773, miny + 0.01788672781549394, maxz - 0.016345815733075142),
+ (maxx - 0.07752272486686707, maxy - 0.09509384632110596, minz + 0.015323184430599213),
+ (minx + 0.07725311815738678, miny + 5.473045166581869e-05, minz + 0.008488442748785019),
+ (minx + 0.07819175720214844, maxy - 0.0008413791656494141, minz + 0.0008782520890235901),
+ (minx + 0.07811960577964783, miny + 0.010220450116321445, maxz - 0.015013711526989937),
+ (minx + 0.07819066941738129, maxy - 0.007294327020645142, minz + 0.001257568597793579),
+ (minx + 0.07735666632652283, miny + 0.0012696638295892626, minz + 0.010594029910862446),
+ (minx + 0.07812090218067169, miny + 0.017941456055268645, maxz - 0.015467563644051552),
+ (minx + 0.07864050567150116, maxy - 0.09503909945487976, minz + 0.016201436519622803)]
+
+ # Faces
+ myfaces = [(20, 18, 2, 6), (23, 19, 7, 3), (45, 20, 6, 43), (52, 21, 10, 50), (21, 22, 11, 10),
+ (27, 25, 12, 15), (24, 26, 14, 13), (46, 27, 15, 44), (53, 28, 16, 51), (28, 29, 17, 16),
+ (38, 36, 18, 20), (41, 37, 19, 23), (48, 38, 20, 45), (55, 39, 21, 52), (39, 40, 22, 21),
+ (4, 0, 25, 27), (1, 5, 26, 24), (42, 4, 27, 46), (49, 8, 28, 53), (8, 9, 29, 28),
+ (15, 12, 30, 32), (13, 14, 31, 35), (44, 15, 32, 47), (51, 16, 33, 54), (16, 17, 34, 33),
+ (32, 30, 36, 38), (35, 31, 37, 41), (47, 32, 38, 48), (54, 33, 39, 55), (33, 34, 40, 39),
+ (22, 45, 43, 11), (29, 46, 44, 17), (40, 48, 45, 22), (9, 42, 46, 29), (17, 44, 47, 34),
+ (34, 47, 48, 40), (19, 52, 50, 7), (26, 53, 51, 14), (37, 55, 52, 19), (5, 49, 53, 26),
+ (14, 51, 54, 31), (31, 54, 55, 37)]
+
+ return myvertex, myfaces, maxx - minx, maxy - miny
diff --git a/archimesh/achm_room_maker.py b/archimesh/achm_room_maker.py
new file mode 100644
index 00000000..f7b03131
--- /dev/null
+++ b/archimesh/achm_room_maker.py
@@ -0,0 +1,1700 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+# ----------------------------------------------------------
+# Automatic generation of rooms
+# Author: Antonio Vazquez (antonioya) and Eduardo Gutierrez
+#
+# ----------------------------------------------------------
+# noinspection PyUnresolvedReferences
+import bpy
+import math
+# noinspection PyUnresolvedReferences
+import mathutils
+import datetime
+import time
+from achm_tools import *
+# noinspection PyUnresolvedReferences
+from bpy_extras.io_utils import ExportHelper, ImportHelper
+
+
+# ----------------------------------------------------------
+# Export menu UI
+# ----------------------------------------------------------
+class AchmExportRoom(bpy.types.Operator, ExportHelper):
+ bl_idname = "io_export.roomdata"
+ bl_description = 'Export Room data (.dat)'
+ bl_category = 'Archimesh'
+ bl_label = "Export"
+
+ # From ExportHelper. Filter filenames.
+ filename_ext = ".dat"
+ filter_glob = bpy.props.StringProperty(
+ default="*.dat",
+ options={'HIDDEN'},
+ )
+
+ filepath = bpy.props.StringProperty(
+ name="File Path",
+ description="File path used for exporting room data file",
+ maxlen=1024, default="",
+ )
+
+ # ----------------------------------------------------------
+ # Execute
+ # ----------------------------------------------------------
+ # noinspection PyUnusedLocal
+ def execute(self, context):
+ print("Exporting:", self.properties.filepath)
+ # noinspection PyBroadException
+ try:
+ myobj = bpy.context.active_object
+ mydata = myobj.RoomGenerator[0]
+
+ # -------------------------------
+ # extract path and filename
+ # -------------------------------
+ (filepath, filename) = os.path.split(self.properties.filepath)
+ print('Exporting %s' % filename)
+ # -------------------------------
+ # Open output file
+ # -------------------------------
+ realpath = os.path.realpath(os.path.expanduser(self.properties.filepath))
+ fout = open(realpath, 'w')
+
+ st = datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S')
+ fout.write("# Archimesh room export data\n")
+ fout.write("# " + st + "\n")
+ fout.write("#======================================================\n")
+
+ fout.write("name=" + myobj.name + "\n")
+ fout.write("height=" + str(round(mydata.room_height, 3)) + "\n")
+ fout.write("thickness=" + str(round(mydata.wall_width, 3)) + "\n")
+ fout.write("inverse=" + str(mydata.inverse) + "\n")
+ fout.write("ceiling=" + str(mydata.ceiling) + "\n")
+ fout.write("floor=" + str(mydata.floor) + "\n")
+ fout.write("close=" + str(mydata.merge) + "\n")
+
+ # Walls
+ fout.write("#\n# Walls\n#\n")
+ fout.write("walls=" + str(mydata.wall_num) + "\n")
+ i = 0
+ for w in mydata.walls:
+ if i < mydata.wall_num:
+ i += 1
+ fout.write("w=" + str(round(w.w, 3)))
+ # if w.a == True: # advance
+ fout.write(",a=" + str(w.a) + ",")
+ fout.write("r=" + str(round(w.r, 1)) + ",")
+ fout.write("h=" + str(w.h) + ",")
+ fout.write("m=" + str(round(w.m, 3)) + ",")
+ fout.write("f=" + str(round(w.f, 3)) + ",")
+ fout.write("c=" + str(w.curved) + ",")
+ fout.write("cf=" + str(round(w.curve_factor, 1)) + ",")
+ fout.write("cd=" + str(round(w.curve_arc_deg, 1)) + ",")
+ fout.write("cs=" + str(w.curve_steps) + "\n")
+ # else:
+ # fOut.write("\n")
+
+ # Baseboard
+ fout.write("#\n# Baseboard\n#\n")
+ fout.write("baseboard=" + str(mydata.baseboard) + "\n")
+ fout.write("baseh=" + str(round(mydata.base_height, 3)) + "\n")
+ fout.write("baset=" + str(round(mydata.base_width, 3)) + "\n")
+ # Shell
+ fout.write("#\n# Wall Cover\n#\n")
+ fout.write("shell=" + str(mydata.shell) + "\n")
+ fout.write("shellh=" + str(round(mydata.shell_height, 3)) + "\n")
+ fout.write("shellt=" + str(round(mydata.shell_thick, 3)) + "\n")
+ fout.write("shellf=" + str(round(mydata.shell_factor, 3)) + "\n")
+ fout.write("shellb=" + str(round(mydata.shell_bfactor, 3)) + "\n")
+
+ # Materials
+ fout.write("#\n# Materials\n#\n")
+ fout.write("materials=" + str(mydata.crt_mat) + "\n")
+
+ fout.close()
+ self.report({'INFO'}, realpath + "successfully exported")
+ except:
+ self.report({'ERROR'}, "Unable to export room data")
+
+ return {'FINISHED'}
+
+ # ----------------------------------------------------------
+ # Invoke
+ # ----------------------------------------------------------
+
+ # noinspection PyUnusedLocal
+ def invoke(self, context, event):
+ context.window_manager.fileselect_add(self)
+ return {'RUNNING_MODAL'}
+
+
+# ----------------------------------------------------------
+# Import menu UI
+# ----------------------------------------------------------
+class AchmImportRoom(bpy.types.Operator, ImportHelper):
+ bl_idname = "io_import.roomdata"
+ bl_description = 'Import Room data (.dat)'
+ bl_category = 'Archimesh'
+ bl_label = "Import"
+
+ # From Helper. Filter filenames.
+ filename_ext = ".dat"
+ filter_glob = bpy.props.StringProperty(
+ default="*.dat",
+ options={'HIDDEN'},
+ )
+
+ filepath = bpy.props.StringProperty(
+ name="File Path",
+ description="File path used for exporting room data file",
+ maxlen=1024, default="",
+ )
+
+ # ----------------------------------------------------------
+ # Execute
+ # ----------------------------------------------------------
+ # noinspection PyUnusedLocal
+ def execute(self, context):
+ print("Importing:", self.properties.filepath)
+ # noinspection PyBroadException
+ try:
+ realpath = os.path.realpath(os.path.expanduser(self.properties.filepath))
+ finput = open(realpath)
+ line = finput.readline()
+
+ myobj = bpy.context.active_object
+ mydata = myobj.RoomGenerator[0]
+ # ----------------------------------
+ # Loop all records from file
+ # ----------------------------------
+ idx = 0 # index of each wall
+ while line:
+ if line[:1] != '#':
+ if "name=" in line.lower():
+ myobj.name = line[5:-1]
+
+ elif "height=" in line.lower():
+ mydata.room_height = float(line[7:-1])
+
+ elif "thickness=" in line.lower():
+ mydata.wall_width = float(line[10:-1])
+
+ elif "inverse=" in line.lower():
+ if line[8:-4].upper() == "T":
+ mydata.inverse = True
+ else:
+ mydata.inverse = False
+
+ elif "ceiling=" in line.lower():
+ if line[8:-4].upper() == "T":
+ mydata.ceiling = True
+ else:
+ mydata.ceiling = False
+
+ elif "floor=" in line.lower():
+ if line[6:-4].upper() == "T":
+ mydata.floor = True
+ else:
+ mydata.floor = False
+
+ elif "close=" in line.lower():
+ if line[6:-4].upper() == "T":
+ mydata.merge = True
+ else:
+ mydata.merge = False
+ elif "baseboard=" in line.lower():
+ if line[10:-4].upper() == "T":
+ mydata.baseboard = True
+ else:
+ mydata.baseboard = False
+ elif "baseh=" in line.lower():
+ mydata.base_height = float(line[6:-1])
+ elif "baset=" in line.lower():
+ mydata.base_width = float(line[6:-1])
+ elif "shell=" in line.lower():
+ if line[6:-4].upper() == "T":
+ mydata.shell = True
+ else:
+ mydata.shell = False
+ elif "shellh=" in line.lower():
+ mydata.shell_height = float(line[7:-1])
+ elif "shellt=" in line.lower():
+ mydata.shell_thick = float(line[6:-1])
+ elif "shellf=" in line.lower():
+ mydata.shell_factor = float(line[6:-1])
+ elif "shellb=" in line.lower():
+ mydata.shell_bfactor = float(line[6:-1])
+ elif "walls=" in line.lower():
+ mydata.wall_num = int(line[6:-1])
+
+ # ---------------------
+ # Walls Data
+ # ---------------------
+ elif "w=" in line.lower() and idx < mydata.wall_num:
+ # get all pieces
+ buf = line[:-1] + ","
+ s = buf.split(",")
+ for e in s:
+ param = e.lower()
+ if "w=" in param:
+ mydata.walls[idx].w = float(e[2:])
+ elif "a=" in param:
+ if "true" == param[2:]:
+ mydata.walls[idx].a = True
+ else:
+ mydata.walls[idx].a = False
+ elif "r=" in param:
+ mydata.walls[idx].r = float(e[2:])
+ elif "h=" in param:
+ mydata.walls[idx].h = e[2:]
+ elif "m=" in param:
+ mydata.walls[idx].m = float(e[2:])
+ elif "f=" == param[0:2]:
+ mydata.walls[idx].f = float(e[2:])
+ elif "c=" in param:
+ if "true" == param[2:]:
+ mydata.walls[idx].curved = True
+ else:
+ mydata.walls[idx].curved = False
+ elif "cf=" in param:
+ mydata.walls[idx].curve_factor = float(e[3:])
+ elif "cd=" in param:
+ mydata.walls[idx].curve_arc_deg = float(e[3:])
+ elif "cs=" in param:
+ mydata.walls[idx].curve_steps = int(e[3:])
+ idx += 1
+
+ elif "materials=" in line.lower():
+ if line[10:-4].upper() == "T":
+ mydata.crt_mat = True
+ else:
+ mydata.crt_mat = False
+
+ line = finput.readline()
+
+ finput.close()
+ self.report({'INFO'}, realpath + "successfully imported")
+ except:
+ self.report({'ERROR'}, "Unable to import room data")
+
+ return {'FINISHED'}
+
+ # ----------------------------------------------------------
+ # Invoke
+ # ----------------------------------------------------------
+ # noinspection PyUnusedLocal
+ def invoke(self, context, event):
+ context.window_manager.fileselect_add(self)
+ return {'RUNNING_MODAL'}
+
+
+# ------------------------------------------------------------------
+# Define operator class to create rooms
+# ------------------------------------------------------------------
+class AchmRoom(bpy.types.Operator):
+ bl_idname = "mesh.archimesh_room"
+ bl_label = "Room"
+ bl_description = "Generate room with walls, baseboard, floor and ceiling"
+ bl_category = 'Archimesh'
+ bl_options = {'REGISTER', 'UNDO'}
+
+ # -----------------------------------------------------
+ # Draw (create UI interface)
+ # -----------------------------------------------------
+ # noinspection PyUnusedLocal
+ def draw(self, context):
+ layout = self.layout
+ row = layout.row()
+ row.label("Use Properties panel (N) to define parms", icon='INFO')
+ row = layout.row(align=False)
+ row.operator("io_import.roomdata", text="Import", icon='COPYDOWN')
+
+ # -----------------------------------------------------
+ # Execute
+ # -----------------------------------------------------
+ def execute(self, context):
+ if bpy.context.mode == "OBJECT":
+ create_room(self, context)
+ return {'FINISHED'}
+ else:
+ self.report({'WARNING'}, "Archimesh: Option only valid in Object mode")
+ return {'CANCELLED'}
+
+
+# ------------------------------------------------------------------------------
+# Create main object for the room. The other objects of room will be children of this.
+# ------------------------------------------------------------------------------
+# noinspection PyUnusedLocal
+def create_room(self, context):
+ # deselect all objects
+ for o in bpy.data.objects:
+ o.select = False
+
+ # we create main object and mesh for walls
+ roommesh = bpy.data.meshes.new("Room")
+ roomobject = bpy.data.objects.new("Room", roommesh)
+ roomobject.location = bpy.context.scene.cursor_location
+ bpy.context.scene.objects.link(roomobject)
+ roomobject.RoomGenerator.add()
+ roomobject.RoomGenerator[0].walls.add()
+
+ # we shape the walls and create other objects as children of 'RoomObject'.
+ shape_walls_and_create_children(roomobject, roommesh)
+
+ # we select, and activate, main object for the room.
+ roomobject.select = True
+ bpy.context.scene.objects.active = roomobject
+
+
+# -----------------------------------------------------
+# Verify if solidify exist
+# -----------------------------------------------------
+def is_solidify(myobject):
+ flag = False
+ try:
+ if myobject.modifiers is None:
+ return False
+
+ for mod in myobject.modifiers:
+ if mod.type == 'SOLIDIFY':
+ flag = True
+ break
+ return flag
+ except AttributeError:
+ return False
+
+
+# ------------------------------------------------------------------------------
+# Update wall mesh and children objects (baseboard, floor and ceiling).
+# ------------------------------------------------------------------------------
+# noinspection PyUnusedLocal
+def update_room(self, context):
+ # When we update, the active object is the main object of the room.
+ o = bpy.context.active_object
+ oldmesh = o.data
+ oldname = o.data.name
+ # Now we deselect that room object to not delete it.
+ o.select = False
+ # and we create a new mesh for the walls:
+ tmp_mesh = bpy.data.meshes.new("temp")
+ # deselect all objects
+ for obj in bpy.data.objects:
+ obj.select = False
+ # Remove children created by this addon:
+ for child in o.children:
+ # noinspection PyBroadException
+ try:
+ if child["archimesh.room_object"]:
+ # noinspection PyBroadException
+ try:
+ # remove child relationship
+ for grandchild in child.children:
+ grandchild.parent = None
+ # remove modifiers
+ for mod in child.modifiers:
+ bpy.ops.object.modifier_remove(mod)
+ except:
+ pass
+ # clear data
+ old = child.data
+ child.select = True
+ bpy.ops.object.delete()
+ bpy.data.meshes.remove(old)
+ except:
+ pass
+ # Finally we create all that again (except main object),
+ shape_walls_and_create_children(o, tmp_mesh, True)
+ o.data = tmp_mesh
+ # Remove data (mesh of active object),
+ bpy.data.meshes.remove(oldmesh)
+ tmp_mesh.name = oldname
+ # and select, and activate, the main object of the room.
+ o.select = True
+ bpy.context.scene.objects.active = o
+
+
+# -----------------------------------------------------
+# Move Solidify to Top
+# -----------------------------------------------------
+def movetotopsolidify(myobject):
+ mymod = None
+ try:
+ if myobject.modifiers is not None:
+ for mod in myobject.modifiers:
+ if mod.type == 'SOLIDIFY':
+ mymod = mod
+
+ if mymod is not None:
+ while myobject.modifiers[0] != mymod:
+ bpy.ops.object.modifier_move_up(modifier=mymod.name)
+ except AttributeError:
+ return
+
+
+# ------------------------------------------------------------------------------
+# Generate walls, baseboard, floor, ceiling and materials.
+# For walls, it only shapes mesh and creates modifier solidify (the modifier, only the first time).
+# And, for the others, it creates object and mesh.
+# ------------------------------------------------------------------------------
+def shape_walls_and_create_children(myroom, tmp_mesh, update=False):
+ rp = myroom.RoomGenerator[0] # "rp" means "room properties".
+ mybase = None
+ myfloor = None
+ myceiling = None
+ myshell = None
+ # Create the walls (only mesh, because the object is 'myRoom', created before).
+ create_walls(rp, tmp_mesh, get_blendunits(rp.room_height))
+ # Mark Seams
+ select_vertices(myroom, [0, 1])
+ mark_seam(myroom)
+ # Unwrap
+ unwrap_mesh(myroom)
+
+ remove_doubles(myroom)
+ set_normals(myroom, not rp.inverse) # inside/outside
+
+ if rp.wall_width > 0.0:
+ if update is False or is_solidify(myroom) is False:
+ set_modifier_solidify(myroom, get_blendunits(rp.wall_width))
+ else:
+ for mod in myroom.modifiers:
+ if mod.type == 'SOLIDIFY':
+ mod.thickness = rp.wall_width
+ # Move to Top SOLIDIFY
+ movetotopsolidify(myroom)
+
+ else: # clear not used SOLIDIFY
+ for mod in myroom.modifiers:
+ if mod.type == 'SOLIDIFY':
+ myroom.modifiers.remove(mod)
+
+ # Create baseboard
+ if rp.baseboard:
+ baseboardmesh = bpy.data.meshes.new("Baseboard")
+ mybase = bpy.data.objects.new("Baseboard", baseboardmesh)
+ mybase.location = (0, 0, 0)
+ bpy.context.scene.objects.link(mybase)
+ mybase.parent = myroom
+ mybase.select = True
+ mybase["archimesh.room_object"] = True
+ mybase["archimesh.room_baseboard"] = True
+
+ create_walls(rp, baseboardmesh, get_blendunits(rp.base_height), True)
+ set_normals(mybase, rp.inverse) # inside/outside room
+ if rp.base_width > 0.0:
+ set_modifier_solidify(mybase, get_blendunits(rp.base_width))
+ # Move to Top SOLIDIFY
+ movetotopsolidify(mybase)
+ # Mark Seams
+ select_vertices(mybase, [0, 1])
+ mark_seam(mybase)
+ # Unwrap
+ unwrap_mesh(mybase)
+
+ # Create floor
+ if rp.floor and rp.wall_num > 1:
+ myfloor = create_floor(rp, "Floor", myroom)
+ myfloor["archimesh.room_object"] = True
+ myfloor.parent = myroom
+ # Unwrap
+ unwrap_mesh(myfloor)
+
+ # Create ceiling
+ if rp.ceiling and rp.wall_num > 1:
+ myceiling = create_floor(rp, "Ceiling", myroom)
+ myceiling["archimesh.room_object"] = True
+ myceiling.parent = myroom
+ # Unwrap
+ unwrap_mesh(myceiling)
+
+ # Create Shell
+ #
+ if rp.shell:
+ myshell = add_shell(myroom, "Wall_cover", rp)
+ myshell["archimesh.room_object"] = True
+ myshell["archimesh.room_shell"] = True
+ parentobject(myroom, myshell)
+ myshell.rotation_euler = myroom.rotation_euler
+ if rp.wall_width > 0.0:
+ # Solidify (need for boolean)
+ set_modifier_solidify(myshell, 0.01)
+ # Move to Top SOLIDIFY
+ movetotopsolidify(mybase)
+
+ # Create materials
+ if rp.crt_mat:
+ # Wall material (two faces)
+ mat = create_diffuse_material("Wall_material", False, 0.765, 0.650, 0.588, 0.8, 0.621, 0.570, 0.1, True)
+ set_material(myroom, mat)
+
+ # Baseboard material
+ if rp.baseboard and mybase is not None:
+ mat = create_diffuse_material("Baseboard_material", False, 0.8, 0.8, 0.8)
+ set_material(mybase, mat)
+
+ # Ceiling material
+ if rp.ceiling and myceiling is not None:
+ mat = create_diffuse_material("Ceiling_material", False, 0.95, 0.95, 0.95)
+ set_material(myceiling, mat)
+
+ # Floor material
+ if rp.floor and myfloor is not None:
+ mat = create_brick_material("Floor_material", False, 0.711, 0.668, 0.668, 0.8, 0.636, 0.315)
+ set_material(myfloor, mat)
+
+ # Shell material
+ if rp.shell and myshell is not None:
+ mat = create_diffuse_material("Wall_cover_material", False, 0.507, 0.309, 0.076, 0.507, 0.309, 0.076)
+ set_material(myshell, mat)
+
+ # deactivate others
+ for o in bpy.data.objects:
+ if o.select is True and o.name != myroom.name:
+ o.select = False
+
+
+# ------------------------------------------------------------------------------
+# Create walls or baseboard (indicated with baseboard parameter).
+# Some custom values are passed using the rp ("room properties" group) parameter (rp.myvariable).
+# ------------------------------------------------------------------------------
+def create_walls(rp, mymesh, height, baseboard=False):
+ myvertex = [(0.0, 0.0, height), (0.0, 0.0, 0.0)]
+ myfaces = []
+ lastface = 0
+ lastx = lasty = 0
+ idf = 0
+ # Iterate the walls
+ for i in range(0, rp.wall_num):
+ if 0 == i:
+ prv = False
+ else:
+ prv = rp.walls[i - 1].a and not rp.walls[i - 1].curved
+
+ mydat = make_wall(prv, rp.walls[i], baseboard, lastface,
+ lastx, lasty, height, myvertex, myfaces)
+ lastx = mydat[0]
+ lasty = mydat[1]
+ lastface = mydat[2]
+
+ # --------------------------------------
+ # saves vertex data for opengl
+ # --------------------------------------
+ point_a = None
+ point_b = None
+ try:
+ for mf in myfaces[idf]:
+ if myvertex[mf][2] == 0:
+ if point_a is None:
+ point_a = myvertex[mf]
+ else:
+ point_b = myvertex[mf]
+
+ rp.walls[i].glpoint_a = point_a
+ rp.walls[i].glpoint_b = point_b
+ except IndexError:
+ pass
+
+ idf = len(myfaces)
+
+ # Close room
+ if rp.merge is True:
+ if baseboard is False:
+ if rp.walls[rp.wall_num - 1].a is not True:
+ myfaces.extend([(0, 1, lastface + 1, lastface)])
+ else:
+ if rp.walls[rp.wall_num - 1].curved is True:
+ myfaces.extend([(0, 1, lastface + 1, lastface)])
+ else:
+ myfaces.extend([(0, 1, lastface, lastface + 1)])
+ else:
+ myfaces.extend([(0, 1, lastface + 1, lastface)])
+
+ mymesh.from_pydata(myvertex, [], myfaces)
+ mymesh.update(calc_edges=True)
+
+
+# ------------------------------------------------------------------------------
+# Make a Wall
+# prv: If previous wall has 'curved' activate.
+# lastFace: Number of faces of all before walls.
+# lastX: X position of the end of the last wall.
+# lastY: Y position of the end of the last wall.
+# height: Height of the last wall, without peak.
+# ------------------------------------------------------------------------------
+def make_wall(prv, wall, baseboard, lastface, lastx, lasty, height, myvertex, myfaces):
+ # size: Length of the wall.
+ # over: Height of the peak from "height".
+ # factor: Displacement of the peak (between -1 and 1; 0 is the middle of the wall).
+ advanced = wall.a
+ size = wall.w
+ over = wall.m
+ factor = wall.f
+ angle = wall.r
+ hide = wall.h
+
+ # if angle negative, calculate real
+ # use add because the angle is negative
+ if angle < 0:
+ angle += 360
+ # Verify Units
+ size = get_blendunits(size)
+ over = get_blendunits(over)
+
+ # Calculate size using angle
+ sizex = math.cos(math.radians(angle)) * size
+ sizey = math.sin(math.radians(angle)) * size
+
+ # Create faces
+ if advanced is False or baseboard is True:
+ # Cases of this first option: Baseboard or wall without peak and without curve.
+ if baseboard is True and advanced is True and wall.curved is True:
+ (myvertex, myfaces, sizex, sizey, lastface) = make_curved_wall(myvertex, myfaces, size, angle,
+ lastx, lasty, height, lastface,
+ wall.curve_factor, int(wall.curve_arc_deg),
+ int(wall.curve_arc_deg / wall.curve_steps),
+ hide, baseboard)
+ else:
+ myvertex.extend([(lastx + sizex, lasty + sizey, height),
+ (lastx + sizex, lasty + sizey, 0.0)])
+ if check_visibility(hide, baseboard):
+ if prv is False or baseboard is True:
+ # Previous no advance or advance with curve
+ myfaces.extend([(lastface, lastface + 2, lastface + 3, lastface + 1)])
+ else:
+ # Previous advance without curve
+ myfaces.extend([(lastface, lastface + 1, lastface + 2, lastface + 3)])
+ lastface += 2
+ else:
+ # Case of this second option: Wall with advanced features (orientation, visibility and peak or curve).
+ # Orientation and visibility options ('angle' and 'hide' variables) are only visible in panel
+ # with advanced features, but are taken in account in any case.
+ if wall.curved:
+ # Wall with curve and without peak.
+ (myvertex, myfaces, sizex, sizey, lastface) = make_curved_wall(myvertex, myfaces, size, angle,
+ lastx, lasty, height, lastface,
+ wall.curve_factor, int(wall.curve_arc_deg),
+ int(wall.curve_arc_deg / wall.curve_steps),
+ hide, baseboard)
+ else:
+ # Wall with peak and without curve.
+ mid = size / 2 + ((size / 2) * factor)
+ midx = math.cos(math.radians(angle)) * mid
+ midy = math.sin(math.radians(angle)) * mid
+ # first face
+ myvertex.extend([(lastx + midx, lasty + midy, height + over),
+ (lastx + midx, lasty + midy, 0.0)])
+ if check_visibility(hide, baseboard):
+ if math.fabs(factor) != 1:
+ if prv is False:
+ # Previous no advance or advance with curve
+ myfaces.extend([(lastface, lastface + 2, lastface + 3, lastface + 1)])
+ else:
+ # Previous advance without curve
+ myfaces.extend([(lastface, lastface + 1, lastface + 2, lastface + 3)])
+ # second face
+ myvertex.extend([(lastx + sizex, lasty + sizey, 0.0),
+ (lastx + sizex, lasty + sizey, height)])
+ if check_visibility(hide, baseboard):
+ if math.fabs(factor) != 1:
+ myfaces.extend([(lastface + 2, lastface + 3, lastface + 4, lastface + 5)])
+ else:
+ if prv is False:
+ myfaces.extend([(lastface, lastface + 5, lastface + 4, lastface + 1),
+ (lastface, lastface + 2, lastface + 5)])
+ else:
+ myfaces.extend([(lastface, lastface + 4, lastface + 5, lastface + 1),
+ (lastface + 1, lastface + 2, lastface + 5)])
+
+ lastface += 4
+
+ lastx += sizex
+ lasty += sizey
+
+ return lastx, lasty, lastface
+
+
+# ------------------------------------------------------------------------------
+# Verify visibility of walls
+# ------------------------------------------------------------------------------
+def check_visibility(h, base):
+ # Visible
+ if h == '0':
+ return True
+ # Wall
+ if h == '2':
+ if base is True:
+ return False
+ else:
+ return True
+ # Baseboard
+ if h == '1':
+ if base is True:
+ return True
+ else:
+ return False
+ # Hidden
+ if h == '3':
+ return False
+
+
+# ------------------------------------------------------------------------------
+# Create a curved wall.
+# ------------------------------------------------------------------------------
+def make_curved_wall(myvertex, myfaces, size, wall_angle, lastx, lasty, height,
+ lastface, curve_factor, arc_angle, step_angle, hide, baseboard):
+ curvex = None
+ curvey = None
+ # Calculate size using angle
+ sizex = math.cos(math.radians(wall_angle)) * size
+ sizey = math.sin(math.radians(wall_angle)) * size
+
+ for step in range(0, arc_angle + step_angle, step_angle):
+ curvex = sizex / 2 - math.cos(math.radians(step + wall_angle)) * size / 2
+ curvey = sizey / 2 - math.sin(math.radians(step + wall_angle)) * size / 2
+ curvey = curvey * curve_factor
+ myvertex.extend([(lastx + curvex, lasty + curvey, height),
+ (lastx + curvex, lasty + curvey, 0.0)])
+ if check_visibility(hide, baseboard):
+ myfaces.extend([(lastface, lastface + 2, lastface + 3, lastface + 1)])
+ lastface += 2
+ return myvertex, myfaces, curvex, curvey, lastface
+
+
+# ------------------------------------------------------------------------------
+# Create floor or ceiling (create object and mesh)
+# Parameters:
+# rm: "room properties" group
+# typ: Name of new object and mesh ('Floor' or 'Ceiling')
+# myRoom: Main object for the room
+# ------------------------------------------------------------------------------
+
+def create_floor(rp, typ, myroom):
+ bpy.context.scene.objects.active = myroom
+
+ myvertex = []
+ myfaces = []
+ verts = []
+
+ obverts = bpy.context.active_object.data.vertices
+ for vertex in obverts:
+ verts.append(tuple(vertex.co))
+ # Loop only selected
+ i = 0
+ for e in verts:
+ if typ == "Floor":
+ if e[2] == 0.0:
+ myvertex.extend([(e[0], e[1], e[2])])
+ i += 1
+ else: # ceiling
+ if round(e[2], 5) == round(get_blendunits(rp.room_height), 5):
+ myvertex.extend([(e[0], e[1], e[2])])
+ i += 1
+
+ # Create faces
+ fa = []
+ for f in range(0, i):
+ fa.extend([f])
+
+ myfaces.extend([fa])
+
+ mymesh = bpy.data.meshes.new(typ)
+ myobject = bpy.data.objects.new(typ, mymesh)
+
+ myobject.location = (0, 0, 0)
+ bpy.context.scene.objects.link(myobject)
+
+ mymesh.from_pydata(myvertex, [], myfaces)
+ mymesh.update(calc_edges=True)
+
+ return myobject
+
+
+# ------------------------------------------------------------------
+# Define property group class to create, or modify, room walls.
+# ------------------------------------------------------------------
+class WallProperties(bpy.types.PropertyGroup):
+ w = bpy.props.FloatProperty(
+ name='Length',
+ min=-150, max=150,
+ default=1, precision=3,
+ description='Length of the wall (negative to reverse direction)',
+ update=update_room,
+ )
+
+ a = bpy.props.BoolProperty(
+ name="Advance",
+ description="Define advance parameters of the wall",
+ default=False,
+ update=update_room,
+ )
+
+ curved = bpy.props.BoolProperty(
+ name="Curved",
+ description="Enable curved wall parameters",
+ default=False,
+ update=update_room,
+ )
+ curve_factor = bpy.props.FloatProperty(
+ name='Factor',
+ min=-5, max=5,
+ default=1, precision=1,
+ description='Curvature variation',
+ update=update_room,
+ )
+ curve_arc_deg = bpy.props.FloatProperty(
+ name='Degrees', min=1, max=359,
+ default=180, precision=1,
+ description='Degrees of the curve arc (must be >= steps)',
+ update=update_room,
+ )
+ curve_steps = bpy.props.IntProperty(
+ name='Steps',
+ min=2, max=50,
+ default=12,
+ description='Curve steps',
+ update=update_room,
+ )
+
+ m = bpy.props.FloatProperty(
+ name='Peak', min=0, max=50,
+ default=0, precision=3,
+ description='Middle height variation',
+ update=update_room,
+ )
+ f = bpy.props.FloatProperty(
+ name='Factor', min=-1, max=1,
+ default=0, precision=3,
+ description='Middle displacement',
+ update=update_room,
+ )
+ r = bpy.props.FloatProperty(
+ name='Angle',
+ min=-180, max=180,
+ default=0, precision=1,
+ description='Wall Angle (-180 to +180)',
+ update=update_room,
+ )
+
+ h = bpy.props.EnumProperty(
+ items=(
+ ('0', "Visible", ""),
+ ('1', "Baseboard", ""),
+ ('2', "Wall", ""),
+ ('3', "Hidden", ""),
+ ),
+ name="",
+ description="Wall visibility",
+ update=update_room,
+ )
+
+ # opengl internal data
+ glpoint_a = bpy.props.FloatVectorProperty(
+ name="glpointa",
+ description="Hidden property for opengl",
+ default=(0, 0, 0),
+ )
+ glpoint_b = bpy.props.FloatVectorProperty(
+ name="glpointb",
+ description="Hidden property for opengl",
+ default=(0, 0, 0),
+ )
+
+bpy.utils.register_class(WallProperties)
+
+
+# ------------------------------------------------------------------
+# Add a new room wall.
+# First add a parameter group for that new wall, and then update the room.
+# ------------------------------------------------------------------
+def add_room_wall(self, context):
+ rp = context.object.RoomGenerator[0]
+ for cont in range(len(rp.walls) - 1, rp.wall_num):
+ rp.walls.add()
+ # by default, we alternate the direction of the walls.
+ if 1 == cont % 2:
+ rp.walls[cont].r = 90
+ update_room(self, context)
+
+
+# ------------------------------------
+# Get if some vertex is highest
+# ------------------------------------
+def get_hight(verts, faces_4, faces_3, face_index, face_num):
+ rtn = face_index
+ a = faces_4[face_num][0]
+ b = faces_4[face_num][1]
+ c = faces_4[face_num][2]
+ d = faces_4[face_num][3]
+
+ for face3 in faces_3:
+ for idx3 in face3:
+ if idx3 != face_index:
+ # check x and y position (must be equal)
+ if verts[idx3][0] == verts[face_index][0] and verts[idx3][1] == verts[face_index][1]:
+ # only if z is > that previous z
+ if verts[idx3][2] > verts[face_index][2]:
+ # checking if the original vertex is in the same face
+ # must have 2 vertices on the original face
+ t = 0
+ for e in face3:
+ if e == a or e == b or e == c or e == d:
+ t += 1
+ if t >= 2:
+ rtn = idx3
+
+ return rtn
+
+
+# ------------------------------------
+# Sort list of faces
+# ------------------------------------
+def sort_facelist(activefaces, activenormals):
+ totfaces = len(activefaces)
+ newlist = []
+ newnormal = []
+ # -----------------------
+ # Only one face
+ # -----------------------
+ if totfaces == 1:
+ newlist.append(activefaces[0])
+ newnormal.append(activenormals[0])
+ return newlist, newnormal
+
+ # -----------------------
+ # Look for first element
+ # -----------------------
+ flag = False
+ for x in range(1, totfaces):
+ if flag is False:
+ idx = 0
+ for face in activefaces:
+ c = 0
+ for i in face:
+ if i == 0 or i == 1:
+ c += 1
+ # avoid close
+ if i > 3:
+ c -= 1
+
+ if c >= 2 and face not in newlist:
+ newlist.append(face)
+ newnormal.append(activenormals[idx])
+ flag = True
+ idx += 1
+
+ # -----------------------
+ # Look for second element
+ # -----------------------
+ flag = False
+ for x in range(1, totfaces):
+ if flag is False:
+ idx = 0
+ for face in activefaces:
+ c = 0
+ for i in face:
+ if i == 2 or i == 3:
+ c += 1
+ if c >= 2 and face not in newlist:
+ newlist.append(face)
+ newnormal.append(activenormals[idx])
+ flag = True
+ idx += 1
+
+ # -----------------------
+ # Add next faces
+ # -----------------------
+ for x in range(2, totfaces):
+ idx = 0
+ for face in activefaces:
+ c = 0
+ for i in face:
+ if i == newlist[x - 1][0] or i == newlist[x - 1][1] or i == newlist[x - 1][2] or i == newlist[x - 1][3]:
+ c += 1
+ if c >= 2 and face not in newlist:
+ newlist.append(face)
+ newnormal.append(activenormals[idx])
+ idx += 1
+
+ return newlist, newnormal
+
+
+# ------------------------------------
+# Get points of the walls
+# selobject: room
+# ------------------------------------
+def get_wall_points(selobject):
+ obverts = selobject.data.vertices
+ obfaces = selobject.data.polygons
+
+ verts = []
+ faces_3 = []
+ faces_4 = []
+ normals = []
+ activefaces = []
+ activenormals = []
+
+ # --------------------------
+ # Recover all vertex
+ # --------------------------
+ for vertex in obverts:
+ verts.append(list(vertex.co))
+
+ # --------------------------
+ # Recover 3 faces
+ # --------------------------
+ for face in obfaces:
+ # get only 4 corners faces
+ if len(list(face.vertices)) == 3:
+ faces_3.append(list(face.vertices))
+ # --------------------------
+ # Recover 4 faces
+ # --------------------------
+ for face in obfaces:
+ # get only 4 corners faces
+ if len(list(face.vertices)) == 4:
+ faces_4.append(list(face.vertices))
+ normals.append(face.normal)
+ # --------------------------
+ # Replace highest
+ # --------------------------
+ idx = 0
+ for face in faces_4:
+ mylist = []
+ for e in face: # e contains the number of vertex element
+ if verts[e][2] == 0:
+ mylist.append(e)
+ # Only if Z > 0, recalculate
+ if verts[e][2] != 0:
+ mylist.append(get_hight(verts, faces_4, faces_3, e, idx))
+
+ activefaces.append(mylist)
+ activenormals.append(normals[idx])
+ idx += 1
+
+ # ------------------------
+ # Sort faces
+ # ------------------------
+ newlist, newnormal = sort_facelist(activefaces, activenormals)
+ return verts, newlist, newnormal
+
+
+# ------------------------------------
+# Create a shell of boards
+# selobject: room
+# objname: Name for new object
+# rp: room properties
+# ------------------------------------
+def add_shell(selobject, objname, rp):
+
+ myvertex = []
+ myfaces = []
+
+ verts, activefaces, activenormals = get_wall_points(selobject)
+
+ # --------------------------
+ # Get line points
+ # --------------------------
+ i = 0
+ idx = 0
+ for face in activefaces:
+ a1 = None
+ b1 = None
+ a2 = None
+ b2 = None
+ # Bottom
+ for e in face:
+ if verts[e][2] == 0:
+ if a1 is None:
+ a1 = e
+ else:
+ b1 = e
+ # Top
+ for e in face:
+ if verts[e][2] != 0:
+ if verts[a1][0] == verts[e][0] and verts[a1][1] == verts[e][1]:
+ a2 = e
+ else:
+ b2 = e
+ # Create the mesh
+ mydata = create_cover_mesh(idx, verts, activefaces, activenormals, i, a1, a2, b1, b2,
+ rp.merge, 0.005,
+ rp.shell_height, rp.shell_thick, rp.shell_factor, rp.shell_bfactor)
+ i = mydata[0]
+ myvertex.extend(mydata[1])
+ myfaces.extend(mydata[2])
+ idx += 1
+ # --------------------------
+ # Create the mesh
+ # --------------------------
+ mesh = bpy.data.meshes.new(objname)
+ myobject = bpy.data.objects.new(objname, mesh)
+
+ myobject.location = selobject.location
+ bpy.context.scene.objects.link(myobject)
+
+ mesh.from_pydata(myvertex, [], myfaces)
+ mesh.update(calc_edges=True)
+
+ remove_doubles(myobject)
+ set_normals(myobject)
+
+ return myobject
+
+
+# ---------------------------------------------------------
+# Project point using face normals
+#
+# m: Magnitud
+# pf: Comparision face +/-
+# ---------------------------------------------------------
+def project_point(idx, point, normals, m, pf):
+ v1 = mathutils.Vector(normals[idx])
+ if idx + pf >= len(normals):
+ vf = v1
+ elif idx + pf < 0:
+ vf = v1
+ else:
+ v2 = mathutils.Vector(normals[idx + pf])
+ if v1 != v2:
+ vf = v1 + v2
+ vf.normalize() # must be length equal to 1
+ else:
+ vf = v1
+
+ n1 = (vf[0] * m, vf[1] * m, vf[2] * m)
+ p1 = (point[0] + n1[0], point[1] + n1[1], point[2] + n1[2])
+ return p1
+
+
+# ---------------------------------------------------------
+# Create wall cover mesh
+#
+# Uses linear equation for cutting
+#
+# Z = This value is the z axis value
+# so, we can replace t with ((Z-Z1) / (Z2-Z1))
+#
+# X = X1 + ((X2 - X1) * t)
+#
+# X = X1 + ((X2 - X1) * ((Z-Z1) / (Z2-Z1)))
+# Y = Y1 + ((Y2 - Y1) * ((Z-Z1) / (Z2-Z1)))
+#
+# height refers to the height of the cover piece
+# width refers to the width of the cover piece
+# ---------------------------------------------------------
+
+
+def create_cover_mesh(idx, verts, activefaces, normals, i, a1, a2, b1, b2, merge, space=0.005,
+ height=0.20, thickness=0.025, shell_factor=1, shell_bfactor=1):
+ pvertex = []
+ pfaces = []
+
+ a1_x = verts[a1][0]
+ a1_y = verts[a1][1]
+ a1_z = verts[a1][2]
+
+ a2_x = verts[a2][0]
+ a2_y = verts[a2][1]
+ a2_z = verts[a2][2]
+
+ b1_x = verts[b1][0]
+ b1_y = verts[b1][1]
+ b1_z = verts[b1][2]
+
+ b2_x = verts[b2][0]
+ b2_y = verts[b2][1]
+ b2_z = verts[b2][2]
+
+ # Get highest
+ if a2_z >= b2_z:
+ top = a2_z
+ limit = b2_z
+ else:
+ top = b2_z
+ limit = a2_z
+
+ # apply factor
+ # get high point of walls
+ maxh = 0
+ for v in verts:
+ if v[2] > maxh:
+ maxh = v[2]
+ maxh *= shell_factor
+ minh = maxh * (1 - shell_bfactor)
+ if minh < 0:
+ minh = 0
+
+ if shell_factor < 1:
+ if top > maxh:
+ top = maxh
+
+ # --------------------------------------
+ # Loop to generate each piece of cover
+ # --------------------------------------
+ zpos = minh # initial position
+ f = 0
+ f2 = 0
+ # detect what face must use to compare
+ face_num = len(activefaces) - 1
+ if idx == 0 and merge is True:
+ if is_in_nextface(idx + 1, activefaces, verts, a1_x, a1_y) is True:
+ side_a = 1
+ side_b = face_num
+ else:
+ side_a = face_num
+ side_b = 1
+ elif idx == face_num and merge is True:
+ if is_in_nextface(face_num, activefaces, verts, a1_x, a1_y) is False:
+ side_b = -face_num
+ side_a = -1
+ else:
+ side_b = -1
+ side_a = -face_num
+ else:
+ if is_in_nextface(idx + 1, activefaces, verts, a1_x, a1_y) is True:
+ side_a = 1
+ side_b = -1
+ else:
+ side_a = -1
+ side_b = 1
+ # Last wall
+ if idx + 1 >= len(activefaces):
+ if is_in_nextface(idx - 1, activefaces, verts, a1_x, a1_y) is True:
+ side_a = -1
+ side_b = 1
+ else:
+ side_a = 1
+ side_b = -1
+
+ na1_x = 0
+ na1_y = 0
+ na2_x = 0
+ na2_y = 0
+
+ nb1_x = 0
+ nb1_y = 0
+ nb2_x = 0
+ nb2_y = 0
+
+ nc1_x = 0
+ nc1_y = 0
+ nc2_x = 0
+ nc2_y = 0
+
+ nd1_x = 0
+ nd1_y = 0
+ nd2_x = 0
+ nd2_y = 0
+
+ while zpos <= top:
+ # ----------------------
+ # Full cover piece
+ # ----------------------
+ if zpos <= limit:
+ # ----------------
+ # Point A
+ # ----------------
+ mypoint = project_point(idx, (a1_x, a1_y, zpos), normals, space, side_a)
+
+ pvertex.extend([mypoint])
+ na1_x = mypoint[0]
+ na1_y = mypoint[1]
+ # external point
+ mypoint = project_point(idx, (a1_x, a1_y, zpos), normals, space + thickness, side_a)
+ pvertex.extend([mypoint])
+ nc1_x = mypoint[0]
+ nc1_y = mypoint[1]
+ # get second point (vertical)
+ mypoint = project_point(idx, (a2_x, a2_y, zpos), normals, space, side_a)
+ na2_x = mypoint[0]
+ na2_y = mypoint[1]
+ mypoint = project_point(idx, (a2_x, a2_y, zpos), normals, space + thickness, side_a)
+ nc2_x = mypoint[0]
+ nc2_y = mypoint[1]
+
+ # ----------------
+ # Point B
+ # ----------------
+ mypoint = project_point(idx, (b1_x, b1_y, zpos), normals, space, side_b)
+ pvertex.extend([mypoint])
+ nb1_x = mypoint[0]
+ nb1_y = mypoint[1]
+ # external point
+ mypoint = project_point(idx, (b1_x, b1_y, zpos), normals, space + thickness, side_b)
+ pvertex.extend([mypoint])
+ nd1_x = mypoint[0]
+ nd1_y = mypoint[1]
+ # get second point (vertical)
+ mypoint = project_point(idx, (b2_x, b2_y, zpos), normals, space, side_b)
+ nb2_x = mypoint[0]
+ nb2_y = mypoint[1]
+ mypoint = project_point(idx, (b2_x, b2_y, zpos), normals, space + thickness, side_b)
+ nd2_x = mypoint[0]
+ nd2_y = mypoint[1]
+
+ # Faces
+ if zpos != top:
+ pfaces.extend([(i, i + 1, i + 3, i + 2)])
+
+ if f >= 1:
+ pfaces.extend([(i - 3, i, i + 2, i - 1)])
+
+ i += 4
+ f += 1
+ # ----------------------
+ # Cut pieces
+ # ----------------------
+ else:
+ # -------------------------------
+ # Internal Points
+ # -------------------------------
+ # Get highest
+ if a2_z >= b2_z:
+ ax1 = na1_x
+ ay1 = na1_y
+ az1 = a1_z
+ ax2 = na2_x
+ ay2 = na2_y
+ az2 = a2_z
+
+ bx1 = na2_x
+ by1 = na2_y
+ bz1 = a2_z
+ bx2 = nb2_x
+ by2 = nb2_y
+ bz2 = b2_z
+ else:
+ ax1 = na2_x
+ ay1 = na2_y
+ az1 = a2_z
+ ax2 = nb2_x
+ ay2 = nb2_y
+ az2 = b2_z
+
+ bx1 = nb1_x
+ by1 = nb1_y
+ bz1 = b1_z
+ bx2 = nb2_x
+ by2 = nb2_y
+ bz2 = b2_z
+
+ # ----------------
+ # Point A
+ # ----------------
+ x = ax1 + ((ax2 - ax1) * ((zpos - az1) / (az2 - az1)))
+ y = ay1 + ((ay2 - ay1) * ((zpos - az1) / (az2 - az1)))
+ pvertex.extend([(x, y, zpos)])
+ # ----------------
+ # Point B
+ # ----------------
+ x = bx1 + ((bx2 - bx1) * ((zpos - bz1) / (bz2 - bz1)))
+ y = by1 + ((by2 - by1) * ((zpos - bz1) / (bz2 - bz1)))
+ pvertex.extend([(x, y, zpos)])
+ # -------------------------------
+ # External Points
+ # -------------------------------
+ # Get highest
+ if a2_z >= b2_z:
+ ax1 = nc1_x
+ ay1 = nc1_y
+ az1 = a1_z
+ ax2 = nc2_x
+ ay2 = nc2_y
+ az2 = a2_z
+
+ bx1 = nc2_x
+ by1 = nc2_y
+ bz1 = a2_z
+ bx2 = nd2_x
+ by2 = nd2_y
+ bz2 = b2_z
+ else:
+ ax1 = nc2_x
+ ay1 = nc2_y
+ az1 = a2_z
+ ax2 = nd2_x
+ ay2 = nd2_y
+ az2 = b2_z
+
+ bx1 = nd1_x
+ by1 = nd1_y
+ bz1 = b1_z
+ bx2 = nd2_x
+ by2 = nd2_y
+ bz2 = b2_z
+
+ # ----------------
+ # Point A
+ # ----------------
+ x = ax1 + ((ax2 - ax1) * ((zpos - az1) / (az2 - az1)))
+ y = ay1 + ((ay2 - ay1) * ((zpos - az1) / (az2 - az1)))
+ pvertex.extend([(x, y, zpos)])
+ # ----------------
+ # Point B
+ # ----------------
+ x = bx1 + ((bx2 - bx1) * ((zpos - bz1) / (bz2 - bz1)))
+ y = by1 + ((by2 - by1) * ((zpos - bz1) / (bz2 - bz1)))
+ pvertex.extend([(x, y, zpos)])
+ # Faces
+ if zpos != top:
+ pfaces.extend([(i, i + 1, i + 3, i + 2)])
+
+ if f2 == 0:
+ pfaces.extend([(i - 1, i - 3, i, i + 1)])
+ else:
+ pfaces.extend([(i - 1, i - 2, i, i + 1)])
+
+ i += 4
+ f2 += 1
+ # avoid infinite loop
+ if zpos == top:
+ break
+
+ # add new piece
+ zpos += height
+ # cut oversized
+ if zpos > top:
+ zpos = top
+
+ return i, pvertex, pfaces
+
+
+# -------------------------------------------------------------
+# Detect if the vertex is face
+# -------------------------------------------------------------
+def is_in_nextface(idx, activefaces, verts, x, y):
+ if idx >= len(activefaces):
+ return False
+
+ for f in activefaces[idx]:
+ if verts[f][2] == 0: # only ground
+ if verts[f][0] == x and verts[f][1] == y:
+ return True
+
+ return False
+
+
+# ------------------------------------------------------------------
+# Define property group class to create or modify a rooms.
+# ------------------------------------------------------------------
+class RoomProperties(bpy.types.PropertyGroup):
+ room_height = bpy.props.FloatProperty(
+ name='Height', min=0.001, max=50,
+ default=2.4, precision=3,
+ description='Room height', update=update_room,
+ )
+ wall_width = bpy.props.FloatProperty(
+ name='Thickness', min=0.000, max=10,
+ default=0.0, precision=3,
+ description='Thickness of the walls', update=update_room,
+ )
+ inverse = bpy.props.BoolProperty(
+ name="Inverse", description="Inverse normals to outside",
+ default=False,
+ update=update_room,
+ )
+ crt_mat = bpy.props.BoolProperty(
+ name="Create default Cycles materials",
+ description="Create default materials for Cycles render",
+ default=True,
+ update=update_room,
+ )
+
+ wall_num = bpy.props.IntProperty(
+ name='Number of Walls', min=1, max=50,
+ default=1,
+ description='Number total of walls in the room', update=add_room_wall,
+ )
+
+ baseboard = bpy.props.BoolProperty(
+ name="Baseboard", description="Create a baseboard automatically",
+ default=True,
+ update=update_room,
+ )
+
+ base_width = bpy.props.FloatProperty(
+ name='Width', min=0.001, max=10,
+ default=0.015, precision=3,
+ description='Baseboard width', update=update_room,
+ )
+ base_height = bpy.props.FloatProperty(
+ name='Height', min=0.05, max=20,
+ default=0.12, precision=3,
+ description='Baseboard height', update=update_room,
+ )
+
+ ceiling = bpy.props.BoolProperty(
+ name="Ceiling", description="Create a ceiling",
+ default=False, update=update_room,
+ )
+ floor = bpy.props.BoolProperty(
+ name="Floor", description="Create a floor automatically",
+ default=False,
+ update=update_room,
+ )
+
+ merge = bpy.props.BoolProperty(
+ name="Close walls", description="Close walls to create a full closed room",
+ default=False, update=update_room,
+ )
+
+ walls = bpy.props.CollectionProperty(
+ type=WallProperties,
+ )
+
+ shell = bpy.props.BoolProperty(
+ name="Wall cover", description="Create a cover of boards",
+ default=False, update=update_room,
+ )
+ shell_thick = bpy.props.FloatProperty(
+ name='Thickness', min=0.001, max=1,
+ default=0.025, precision=3,
+ description='Cover board thickness', update=update_room,
+ )
+ shell_height = bpy.props.FloatProperty(
+ name='Height', min=0.05, max=1,
+ default=0.20, precision=3,
+ description='Cover board height', update=update_room,
+ )
+ shell_factor = bpy.props.FloatProperty(
+ name='Top', min=0.1, max=1,
+ default=1, precision=1,
+ description='Percentage for top covering (1 Full)', update=update_room,
+ )
+ shell_bfactor = bpy.props.FloatProperty(
+ name='Bottom', min=0.1, max=1,
+ default=1, precision=1,
+ description='Percentage for bottom covering (1 Full)', update=update_room,
+ )
+
+bpy.utils.register_class(RoomProperties)
+bpy.types.Object.RoomGenerator = bpy.props.CollectionProperty(type=RoomProperties)
+
+
+# -----------------------------------------------------
+# Add wall parameters to the panel.
+# -----------------------------------------------------
+def add_wall(idx, box, wall):
+ box.label("Wall " + str(idx))
+ row = box.row()
+ row.prop(wall, 'w')
+ row.prop(wall, 'a')
+ # row.prop(wall, 'curved')
+ if wall.a is True:
+ srow = box.row()
+ srow.prop(wall, 'r')
+ srow.prop(wall, 'h')
+
+ srow = box.row()
+ srow.prop(wall, 'curved')
+
+ if wall.curved is False:
+ srow.prop(wall, 'm')
+ srow.prop(wall, 'f')
+
+ if wall.curved is True:
+ srow.prop(wall, 'curve_factor')
+ srow.prop(wall, 'curve_arc_deg')
+ srow.prop(wall, 'curve_steps')
+
+
+# ------------------------------------------------------------------
+# Define panel class to modify rooms.
+# ------------------------------------------------------------------
+class AchmRoomGeneratorPanel(bpy.types.Panel):
+ bl_idname = "OBJECT_PT_room_generator"
+ bl_label = "Room"
+ bl_space_type = 'VIEW_3D'
+ bl_region_type = 'UI'
+ bl_category = 'Archimesh'
+
+ # -----------------------------------------------------
+ # Verify if visible
+ # -----------------------------------------------------
+ @classmethod
+ def poll(cls, context):
+ o = context.object
+ if o is None:
+ return False
+ if 'RoomGenerator' not in o:
+ return False
+ else:
+ return True
+
+ # -----------------------------------------------------
+ # Draw (create UI interface)
+ # -----------------------------------------------------
+ def draw(self, context):
+ o = context.object
+ # If the selected object didn't be created with the group 'RoomGenerator', this panel is not created.
+ # noinspection PyBroadException
+ try:
+ if 'RoomGenerator' not in o:
+ return
+ except:
+ return
+
+ layout = self.layout
+ if bpy.context.mode == 'EDIT_MESH':
+ layout.label('Warning: Operator does not work in edit mode.', icon='ERROR')
+ else:
+ room = o.RoomGenerator[0]
+ row = layout.row()
+ row.prop(room, 'room_height')
+ row.prop(room, 'wall_width')
+ row.prop(room, 'inverse')
+
+ row = layout.row()
+ if room.wall_num > 1:
+ row.prop(room, 'ceiling')
+ row.prop(room, 'floor')
+ row.prop(room, 'merge')
+
+ # Wall number
+ row = layout.row()
+ row.prop(room, 'wall_num')
+
+ # Add menu for walls
+ if room.wall_num > 0:
+ for wall_index in range(0, room.wall_num):
+ box = layout.box()
+ add_wall(wall_index + 1, box, room.walls[wall_index])
+
+ box = layout.box()
+ box.prop(room, 'baseboard')
+ if room.baseboard is True:
+ row = box.row()
+ row.prop(room, 'base_width')
+ row.prop(room, 'base_height')
+
+ box = layout.box()
+ box.prop(room, 'shell')
+ if room.shell is True:
+ row = box.row()
+ row.prop(room, 'shell_height')
+ row.prop(room, 'shell_thick')
+ row = box.row()
+ row.prop(room, 'shell_factor', slider=True)
+ row.prop(room, 'shell_bfactor', slider=True)
+
+ box = layout.box()
+ box.prop(room, 'crt_mat')
diff --git a/archimesh/achm_shelves_maker.py b/archimesh/achm_shelves_maker.py
new file mode 100644
index 00000000..178b1898
--- /dev/null
+++ b/archimesh/achm_shelves_maker.py
@@ -0,0 +1,466 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+# ----------------------------------------------------------
+# Automatic generation of shelves
+# Author: Antonio Vazquez (antonioya)
+#
+# ----------------------------------------------------------
+import bpy
+import copy
+from achm_tools import *
+
+
+# ------------------------------------------------------------------
+# Define property group class for shelves properties
+# ------------------------------------------------------------------
+class ShelvesProperties(bpy.types.PropertyGroup):
+ sX = bpy.props.FloatProperty(name='width', min=0.001, max=10, default=1,
+ precision=3, description='Furniture width')
+ wY = bpy.props.FloatProperty(name='', min=-10, max=10, default=0, precision=3, description='Modify y size')
+ wZ = bpy.props.FloatProperty(name='', min=-10, max=10, default=0, precision=3, description='Modify z size')
+ # Cabinet position shift
+ pX = bpy.props.FloatProperty(name='', min=0, max=10, default=0, precision=3, description='Position x shift')
+ pY = bpy.props.FloatProperty(name='', min=-10, max=10, default=0, precision=3, description='Position y shift')
+ pZ = bpy.props.FloatProperty(name='', min=-10, max=10, default=0, precision=3, description='Position z shift')
+
+ # Shelves
+ sNum = bpy.props.IntProperty(name='Shelves', min=0, max=12, default=6, description='Number total of shelves')
+
+ # 12 shelves (shelf)
+ Z01 = bpy.props.FloatProperty(name='zS1', min=-10, max=10, default=0, precision=3, description='Position z shift')
+ Z02 = bpy.props.FloatProperty(name='zS2', min=-10, max=10, default=0, precision=3, description='Position z shift')
+ Z03 = bpy.props.FloatProperty(name='zS3', min=-10, max=10, default=0, precision=3, description='Position z shift')
+ Z04 = bpy.props.FloatProperty(name='zS4', min=-10, max=10, default=0, precision=3, description='Position z shift')
+ Z05 = bpy.props.FloatProperty(name='zS5', min=-10, max=10, default=0, precision=3, description='Position z shift')
+ Z06 = bpy.props.FloatProperty(name='zS6', min=-10, max=10, default=0, precision=3, description='Position z shift')
+ Z07 = bpy.props.FloatProperty(name='zS7', min=-10, max=10, default=0, precision=3, description='Position z shift')
+ Z08 = bpy.props.FloatProperty(name='zS8', min=-10, max=10, default=0, precision=3, description='Position z shift')
+ Z09 = bpy.props.FloatProperty(name='zS9', min=-10, max=10, default=0, precision=3, description='Position z shift')
+ Z10 = bpy.props.FloatProperty(name='zS10', min=-10, max=10, default=0, precision=3, description='Position z shift')
+ Z11 = bpy.props.FloatProperty(name='zS11', min=-10, max=10, default=0, precision=3, description='Position z shift')
+ Z12 = bpy.props.FloatProperty(name='zS12', min=-10, max=10, default=0, precision=3, description='Position z shift')
+
+ right = bpy.props.BoolProperty(name="Right", description="Create right side", default=True)
+ left = bpy.props.BoolProperty(name="Left", description="Create left side", default=True)
+
+bpy.utils.register_class(ShelvesProperties)
+
+
+# ------------------------------------------------------------------
+# Define UI class
+# Shelves
+# ------------------------------------------------------------------
+class AchmShelves(bpy.types.Operator):
+ bl_idname = "mesh.archimesh_shelves"
+ bl_label = "Shelves"
+ bl_description = "Shelves Generator"
+ bl_category = 'Archimesh'
+ bl_options = {'REGISTER', 'UNDO'}
+
+ thickness = bpy.props.FloatProperty(
+ name='Side Thickness', min=0.001, max=5,
+ default=0.03, precision=3,
+ description='Board thickness',
+ )
+ sthickness = bpy.props.FloatProperty(
+ name='Shelves Thickness', min=0.001, max=5,
+ default=0.03, precision=3,
+ description='Board thickness',
+ )
+ depth = bpy.props.FloatProperty(
+ name='Depth', min=0.001, max=50,
+ default=0.28, precision=3,
+ description='Default unit depth',
+ )
+ height = bpy.props.FloatProperty(
+ name='Height', min=0.001, max=50,
+ default=2, precision=3,
+ description='Default unit height',
+ )
+ top = bpy.props.FloatProperty(
+ name='Top', min=0, max=50,
+ default=0.03, precision=3,
+ description='Default top shelf position',
+ )
+ bottom = bpy.props.FloatProperty(
+ name='Bottom', min=0, max=50,
+ default=0.07, precision=3,
+ description='Default bottom self position',
+ )
+ stype = bpy.props.EnumProperty(
+ items=(
+ ('1', "Full side", ""),
+ ('4', "4 Legs", ""),
+ ('99', "None", "")),
+ name="Sides",
+ description="Type of side construction",
+ )
+
+ fitZ = bpy.props.BoolProperty(
+ name="Floor origin in Z=0",
+ description="Use Z=0 axis as vertical origin floor position",
+ default=True,
+ )
+
+ shelves_num = bpy.props.IntProperty(
+ name='Number of Units',
+ min=1, max=10,
+ default=1,
+ description='Number total of shelves units',
+ )
+ shelves = bpy.props.CollectionProperty(type=ShelvesProperties)
+
+ # Materials
+ crt_mat = bpy.props.BoolProperty(
+ name="Create default Cycles materials",
+ description="Create default materials for Cycles render",
+ default=True,
+ )
+
+ # -----------------------------------------------------
+ # Draw (create UI interface)
+ # -----------------------------------------------------
+ # noinspection PyUnusedLocal
+ def draw(self, context):
+ layout = self.layout
+ space = bpy.context.space_data
+ if not space.local_view:
+ # Imperial units warning
+ if bpy.context.scene.unit_settings.system == "IMPERIAL":
+ row = layout.row()
+ row.label("Warning: Imperial units not supported", icon='COLOR_RED')
+
+ box = layout.box()
+ row = box.row()
+ row.prop(self, 'thickness')
+ row.prop(self, 'sthickness')
+ row = box.row()
+ row.prop(self, 'depth')
+ row.prop(self, 'height')
+ row = box.row()
+ row.prop(self, 'top')
+ row.prop(self, 'bottom')
+ row = box.row()
+ row.prop(self, 'stype')
+ row.prop(self, 'fitZ')
+
+ # Furniture number
+ row = layout.row()
+ row.prop(self, 'shelves_num')
+ # Add menu for shelves
+ if self.shelves_num > 0:
+ for idx in range(0, self.shelves_num):
+ box = layout.box()
+ add_shelves(self, box, idx + 1, self.shelves[idx])
+
+ box = layout.box()
+ box.prop(self, 'crt_mat')
+ else:
+ row = layout.row()
+ row.label("Warning: Operator does not work in local view mode", icon='ERROR')
+
+ # -----------------------------------------------------
+ # Execute
+ # -----------------------------------------------------
+ # noinspection PyUnusedLocal
+ def execute(self, context):
+ if bpy.context.mode == "OBJECT":
+ # Create all elements
+ for i in range(len(self.shelves) - 1, self.shelves_num):
+ self.shelves.add()
+
+ # Create shelves
+ create_shelves_mesh(self)
+ return {'FINISHED'}
+ else:
+ self.report({'WARNING'}, "Archimesh: Option only valid in Object mode")
+ return {'CANCELLED'}
+
+
+# -----------------------------------------------------
+# Add shelves parameters
+# -----------------------------------------------------
+def add_shelves(self, box, num, sh):
+ row = box.row()
+ row.label("Unit " + str(num))
+ row.prop(sh, 'sX')
+
+ row = box.row()
+ row.prop(sh, 'wY')
+ row.prop(sh, 'wZ')
+ if self.stype != "99":
+ row.prop(sh, 'left')
+ row.prop(sh, 'right')
+
+ row = box.row()
+ row.prop(sh, 'pX')
+ row.prop(sh, 'pY')
+ row.prop(sh, 'pZ')
+
+ row = box.row()
+ row.prop(sh, 'sNum', slider=True)
+
+ if sh.sNum >= 1:
+ row = box.row()
+ row.prop(sh, 'Z01')
+ if sh.sNum >= 2:
+ row.prop(sh, 'Z02')
+ if sh.sNum >= 3:
+ row.prop(sh, 'Z03')
+
+ if sh.sNum >= 4:
+ row = box.row()
+ row.prop(sh, 'Z04')
+ if sh.sNum >= 5:
+ row.prop(sh, 'Z05')
+ if sh.sNum >= 6:
+ row.prop(sh, 'Z06')
+
+ if sh.sNum >= 7:
+ row = box.row()
+ row.prop(sh, 'Z07')
+ if sh.sNum >= 8:
+ row.prop(sh, 'Z08')
+ if sh.sNum >= 9:
+ row.prop(sh, 'Z09')
+
+ if sh.sNum >= 10:
+ row = box.row()
+ row.prop(sh, 'Z10')
+ if sh.sNum >= 11:
+ row.prop(sh, 'Z11')
+ if sh.sNum >= 12:
+ row.prop(sh, 'Z12')
+
+
+# ------------------------------------------------------------------------------
+# Generate mesh data
+# All custom values are passed using self container (self.myvariable)
+# ------------------------------------------------------------------------------
+def create_shelves_mesh(self):
+ # deactivate others
+ for o in bpy.data.objects:
+ if o.select is True:
+ o.select = False
+ bpy.ops.object.select_all(False)
+ # Create units
+ generate_shelves(self)
+
+ return
+
+
+# ------------------------------------------------------------------------------
+# Generate Units
+# All custom values are passed using self container (self.myvariable)
+# ------------------------------------------------------------------------------
+def generate_shelves(self):
+
+ boxes = []
+ location = bpy.context.scene.cursor_location
+ myloc = copy.copy(location) # copy location to keep 3D cursor position
+ # Fit to floor
+ if self.fitZ:
+ myloc[2] = 0
+
+ # Create units
+ lastx = myloc[0]
+ # ------------------------------------------------------------------------------
+ # Shelves
+ # ------------------------------------------------------------------------------
+ for i in range(0, self.shelves_num):
+ mydata = create_unit(self.stype, "Shelves" + str(i + 1),
+ self.thickness, self.sthickness,
+ self.shelves[i].sX, self.depth + self.shelves[i].wY, self.height + self.shelves[i].wZ,
+ self.shelves[i].pX + lastx, myloc[1] + self.shelves[i].pY, myloc[2] + self.shelves[i].pZ,
+ self.shelves[i].left, self.shelves[i].right,
+ self.shelves[i].sNum,
+ (self.shelves[i].Z01, self.shelves[i].Z02, self.shelves[i].Z03,
+ self.shelves[i].Z04, self.shelves[i].Z05, self.shelves[i].Z06,
+ self.shelves[i].Z07, self.shelves[i].Z08, self.shelves[i].Z09,
+ self.shelves[i].Z10, self.shelves[i].Z11, self.shelves[i].Z12),
+ self.top, self.bottom)
+ boxes.extend([mydata[0]])
+ lastx = mydata[1]
+
+ # refine units
+ for box in boxes:
+ remove_doubles(box)
+ set_normals(box)
+
+ # deactivate others
+ for o in bpy.data.objects:
+ if o.select is True:
+ o.select = False
+
+ boxes[0].select = True
+ bpy.context.scene.objects.active = boxes[0]
+
+ # Create materials
+ if self.crt_mat:
+ mat = create_diffuse_material("Shelves_material", False, 0.8, 0.8, 0.8)
+ for box in boxes:
+ set_material(box, mat)
+
+ return
+
+
+# ------------------------------------------------------------------------------
+# Create shelves unit
+#
+# stype: type of sides
+# objName: Name for the new object
+# thickness: wood thickness (sides)
+# sthickness: wood thickness (shelves)
+# sX: Size in X axis
+# sY: Size in Y axis
+# sZ: Size in Z axis
+# pX: position X axis
+# pY: position Y axis
+# pZ: position Z axis
+# right: True-> create right side
+# left: True-> create left side
+# shelves: Number of shelves
+# zPos: List with z shift for each self
+# top: position of top shelf
+# bottom: position of bottom shelf
+# ------------------------------------------------------------------------------
+def create_unit(stype, objname, thickness, sthickness, sx, sy, sz, px, py, pz, left, right, shelves, zpos,
+ top, bottom):
+
+ myvertex = []
+ myfaces = []
+ v = 0
+
+ # no Sides, then no thickness
+ if stype == "99":
+ thickness = 0
+
+ # ------------------------------
+ # Left side
+ # ------------------------------
+ if left and stype != "99":
+ # Full side
+ if stype == "1":
+ myvertex.extend([(0, 0, 0), (0, -sy, 0), (0, -sy, sz), (0, 0, sz),
+ (thickness, 0, 0), (thickness, -sy, 0), (thickness, -sy, sz), (thickness, 0, sz)])
+ myfaces.extend([(v, v + 1, v + 2, v + 3), (v + 4, v + 5, v + 6, v + 7), (v, v + 4, v + 7, v + 3),
+ (v, v + 1, v + 5, v + 4),
+ (v + 3, v + 2, v + 6, v + 7), (v + 1, v + 2, v + 6, v + 5)])
+ v += 8
+ # Four legs
+ if stype == "4":
+ # back
+ myvertex.extend([(0, 0, 0), (0, -thickness, 0), (0, -thickness, sz), (0, 0, sz),
+ (thickness, 0, 0), (thickness, -thickness, 0), (thickness, -thickness, sz),
+ (thickness, 0, sz)])
+ myfaces.extend([(v, v + 1, v + 2, v + 3), (v + 4, v + 5, v + 6, v + 7), (v, v + 4, v + 7, v + 3),
+ (v, v + 1, v + 5, v + 4),
+ (v + 3, v + 2, v + 6, v + 7), (v + 1, v + 2, v + 6, v + 5)])
+ v += 8
+ # Front
+ myvertex.extend([(0, -sy + thickness, 0), (0, -sy, 0), (0, -sy, sz), (0, -sy + thickness, sz),
+ (thickness, -sy + thickness, 0), (thickness, -sy, 0), (thickness, -sy, sz),
+ (thickness, -sy + thickness, sz)])
+ myfaces.extend([(v, v + 1, v + 2, v + 3), (v + 4, v + 5, v + 6, v + 7), (v, v + 4, v + 7, v + 3),
+ (v, v + 1, v + 5, v + 4),
+ (v + 3, v + 2, v + 6, v + 7), (v + 1, v + 2, v + 6, v + 5)])
+ v += 8
+
+ # -----------------
+ # Right side
+ # -----------------
+ if right and stype != "99":
+ width = sx - thickness
+ # Full side
+ if stype == "1":
+ myvertex.extend([(width, 0, 0), (width, -sy, 0), (width, -sy, sz), (width, 0, sz),
+ (width + thickness, 0, 0), (width + thickness, -sy, 0), (width + thickness, -sy, sz),
+ (width + thickness, 0, sz)])
+ myfaces.extend([(v, v + 1, v + 2, v + 3), (v + 4, v + 5, v + 6, v + 7), (v, v + 4, v + 7, v + 3),
+ (v, v + 1, v + 5, v + 4), (v + 3, v + 2, v + 6, v + 7), (v + 1, v + 2, v + 6, v + 5)])
+ v += 8
+ # Four legs
+ if stype == "4":
+ # back
+ myvertex.extend([(width, 0, 0), (width, -thickness, 0), (width, -thickness, sz), (width, 0, sz),
+ (width + thickness, 0, 0), (width + thickness, -thickness, 0),
+ (width + thickness, -thickness, sz), (width + thickness, 0, sz)])
+ myfaces.extend([(v, v + 1, v + 2, v + 3), (v + 4, v + 5, v + 6, v + 7), (v, v + 4, v + 7, v + 3),
+ (v, v + 1, v + 5, v + 4), (v + 3, v + 2, v + 6, v + 7), (v + 1, v + 2, v + 6, v + 5)])
+ v += 8
+ # Front
+ myvertex.extend(
+ [(width, -sy + thickness, 0), (width, -sy, 0), (width, -sy, sz), (width, -sy + thickness, sz),
+ (width + thickness, -sy + thickness, 0), (width + thickness, -sy, 0), (width + thickness, -sy, sz),
+ (width + thickness, -sy + thickness, sz)])
+ myfaces.extend([(v, v + 1, v + 2, v + 3), (v + 4, v + 5, v + 6, v + 7), (v, v + 4, v + 7, v + 3),
+ (v, v + 1, v + 5, v + 4), (v + 3, v + 2, v + 6, v + 7), (v + 1, v + 2, v + 6, v + 5)])
+ v += 8
+ # -----------------
+ # shelves
+ # -----------------
+ posx = 0
+ # calculate width
+ width = sx - thickness
+ posx = posx + thickness
+
+ # calculate vertical spaces
+ dist = sz - top - bottom - sthickness
+ # if only top/bottom the space is not necessary
+ if shelves > 2:
+ space = dist / (shelves - 1)
+ else:
+ space = 0
+
+ posz1 = bottom
+
+ for x in range(shelves):
+ # bottom
+ if x == 0:
+ posz1 = bottom
+ # top
+ if x == shelves - 1:
+ posz1 = sz - top - sthickness
+
+ posz2 = posz1 - sthickness
+ myvertex.extend([(posx, 0, posz1 + zpos[x]), (posx, -sy, posz1 + zpos[x]),
+ (posx, -sy, posz2 + zpos[x]), (posx, 0, posz2 + zpos[x]),
+ (width, 0, posz1 + zpos[x]), (width, -sy, posz1 + zpos[x]),
+ (width, -sy, posz2 + zpos[x]), (width, 0, posz2 + zpos[x])])
+
+ myfaces.extend(
+ [(v, v + 1, v + 2, v + 3), (v + 4, v + 5, v + 6, v + 7), (v, v + 4, v + 7, v + 3), (v, v + 1, v + 5, v + 4),
+ (v + 3, v + 2, v + 6, v + 7), (v + 1, v + 2, v + 6, v + 5)])
+ v += 8
+ posz1 += space
+
+ mymesh = bpy.data.meshes.new(objname)
+ myobject = bpy.data.objects.new(objname, mymesh)
+
+ myobject.location[0] = px
+ myobject.location[1] = py
+ myobject.location[2] = pz
+ bpy.context.scene.objects.link(myobject)
+
+ mymesh.from_pydata(myvertex, [], myfaces)
+ mymesh.update(calc_edges=True)
+
+ return myobject, px + sx - thickness
diff --git a/archimesh/achm_stairs_maker.py b/archimesh/achm_stairs_maker.py
new file mode 100644
index 00000000..92558dc5
--- /dev/null
+++ b/archimesh/achm_stairs_maker.py
@@ -0,0 +1,434 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+# ----------------------------------------------------------
+# Automatic generation of stairs
+# Author: Antonio Vazquez (antonioya)
+#
+# ----------------------------------------------------------
+# noinspection PyUnresolvedReferences
+import bpy
+import math
+from achm_tools import *
+
+
+# ------------------------------------------------------------------
+# Define UI class
+# Stairs
+# ------------------------------------------------------------------
+class AchmStairs(bpy.types.Operator):
+ bl_idname = "mesh.archimesh_stairs"
+ bl_label = "Stairs"
+ bl_description = "Stairs Generator"
+ bl_category = 'Archimesh'
+ bl_options = {'REGISTER', 'UNDO'}
+
+ # Define properties
+ model = bpy.props.EnumProperty(
+ items=(
+ ('1', "Rectangular", ""),
+ ('2', "Rounded", ""),
+ ),
+ name="Model",
+ description="Type of steps",
+ )
+ radio = bpy.props.FloatProperty(
+ name='',
+ min=0.001, max=0.500,
+ default=0.20, precision=3,
+ description='Radius factor for rounded',
+ )
+ curve = bpy.props.BoolProperty(
+ name="Include deformation handles",
+ description="Include a curve to modify the stairs curve",
+ default=False,
+ )
+
+ step_num = bpy.props.IntProperty(
+ name='Number of steps',
+ min=1, max=1000,
+ default=3,
+ description='Number total of steps',
+ )
+ max_width = bpy.props.FloatProperty(
+ name='Width',
+ min=0.001, max=10,
+ default=1, precision=3,
+ description='Step maximum width',
+ )
+ depth = bpy.props.FloatProperty(
+ name='Depth',
+ min=0.001, max=10,
+ default=0.30, precision=3,
+ description='Depth of the step',
+ )
+ shift = bpy.props.FloatProperty(
+ name='Shift',
+ min=0.001, max=1,
+ default=1, precision=3,
+ description='Step shift in Y axis',
+ )
+ thickness = bpy.props.FloatProperty(
+ name='Thickness',
+ min=0.001, max=10,
+ default=0.03, precision=3,
+ description='Step thickness',
+ )
+ sizev = bpy.props.BoolProperty(
+ name="Variable width",
+ description="Steps are not equal in width",
+ default=False,
+ )
+ back = bpy.props.BoolProperty(
+ name="Close sides",
+ description="Close all steps side to make a solid structure",
+ default=False,
+ )
+ min_width = bpy.props.FloatProperty(
+ name='',
+ min=0.001, max=10,
+ default=1, precision=3,
+ description='Step minimum width',
+ )
+
+ height = bpy.props.FloatProperty(
+ name='height',
+ min=0.001, max=10,
+ default=0.14, precision=3,
+ description='Step height',
+ )
+ front_gap = bpy.props.FloatProperty(
+ name='Front',
+ min=0, max=10,
+ default=0.03,
+ precision=3,
+ description='Front gap',
+ )
+ side_gap = bpy.props.FloatProperty(
+ name='Side',
+ min=0, max=10,
+ default=0, precision=3,
+ description='Side gap',
+ )
+ crt_mat = bpy.props.BoolProperty(
+ name="Create default Cycles materials",
+ description="Create default materials for Cycles render",
+ default=True,
+ )
+
+ # -----------------------------------------------------
+ # Draw (create UI interface)
+ # -----------------------------------------------------
+ # noinspection PyUnusedLocal
+ def draw(self, context):
+ layout = self.layout
+ space = bpy.context.space_data
+ if not space.local_view:
+ # Imperial units warning
+ if bpy.context.scene.unit_settings.system == "IMPERIAL":
+ row = layout.row()
+ row.label("Warning: Imperial units not supported", icon='COLOR_RED')
+
+ box = layout.box()
+ row = box.row()
+ row.prop(self, 'model')
+ if self.model == "2":
+ row.prop(self, 'radio')
+
+ box.prop(self, 'step_num')
+ row = box.row()
+ row.prop(self, 'max_width')
+ row.prop(self, 'depth')
+ row.prop(self, 'shift')
+ row = box.row()
+ row.prop(self, 'back')
+ row.prop(self, 'sizev')
+ row = box.row()
+ row.prop(self, 'curve')
+ # all equal
+ if self.sizev is True:
+ row.prop(self, 'min_width')
+
+ box = layout.box()
+ row = box.row()
+ row.prop(self, 'thickness')
+ row.prop(self, 'height')
+ row = box.row()
+ row.prop(self, 'front_gap')
+ if self.model == "1":
+ row.prop(self, 'side_gap')
+
+ box = layout.box()
+ box.prop(self, 'crt_mat')
+ else:
+ row = layout.row()
+ row.label("Warning: Operator does not work in local view mode", icon='ERROR')
+
+ # -----------------------------------------------------
+ # Execute
+ # -----------------------------------------------------
+ # noinspection PyUnusedLocal
+ def execute(self, context):
+ if bpy.context.mode == "OBJECT":
+ create_stairs_mesh(self)
+ return {'FINISHED'}
+ else:
+ self.report({'WARNING'}, "Archimesh: Option only valid in Object mode")
+ return {'CANCELLED'}
+
+
+# ------------------------------------------------------------------------------
+# Generate mesh data
+# All custom values are passed using self container (self.myvariable)
+# ------------------------------------------------------------------------------
+def create_stairs_mesh(self):
+
+ # deactivate others
+ for o in bpy.data.objects:
+ if o.select is True:
+ o.select = False
+
+ bpy.ops.object.select_all(False)
+
+ # ------------------------
+ # Create stairs
+ # ------------------------
+ mydata = create_stairs(self, "Stairs")
+ mystairs = mydata[0]
+ mystairs.select = True
+ bpy.context.scene.objects.active = mystairs
+ remove_doubles(mystairs)
+ set_normals(mystairs)
+ set_modifier_mirror(mystairs, "X")
+ # ------------------------
+ # Create curve handles
+ # ------------------------
+ if self.curve:
+ x = mystairs.location.x
+ y = mystairs.location.y
+ z = mystairs.location.z
+
+ last = mydata[1]
+ x1 = last[1] # use y
+
+ myp = [((0, 0, 0), (- 0.25, 0, 0), (0.25, 0, 0)),
+ ((x1, 0, 0), (x1 - 0.25, 0, 0), (x1 + 0.25, 0, 0))] # double element
+ mycurve = create_bezier("Stairs_handle", myp, (x, y, z))
+ set_modifier_curve(mystairs, mycurve)
+
+ # ------------------------
+ # Create materials
+ # ------------------------
+ if self.crt_mat:
+ # Stairs material
+ mat = create_diffuse_material("Stairs_material", False, 0.8, 0.8, 0.8)
+ set_material(mystairs, mat)
+
+ bpy.ops.object.select_all(False)
+ mystairs.select = True
+ bpy.context.scene.objects.active = mystairs
+
+ return
+
+
+# ------------------------------------------------------------------------------
+# Create rectangular Stairs
+# ------------------------------------------------------------------------------
+def create_stairs(self, objname):
+
+ myvertex = []
+ myfaces = []
+ index = 0
+
+ lastpoint = (0, 0, 0)
+ for s in range(0, self.step_num):
+ if self.model == "1":
+ mydata = create_rect_step(self, lastpoint, myvertex, myfaces, index, s)
+ if self.model == "2":
+ mydata = create_round_step(self, lastpoint, myvertex, myfaces, index, s)
+ index = mydata[0]
+ lastpoint = mydata[1]
+
+ mesh = bpy.data.meshes.new(objname)
+ myobject = bpy.data.objects.new(objname, mesh)
+
+ myobject.location = bpy.context.scene.cursor_location
+ bpy.context.scene.objects.link(myobject)
+
+ mesh.from_pydata(myvertex, [], myfaces)
+ mesh.update(calc_edges=True)
+
+ return myobject, lastpoint
+
+
+# ------------------------------------------------------------------------------
+# Create rectangular step
+# ------------------------------------------------------------------------------
+def create_rect_step(self, origin, myvertex, myfaces, index, step):
+ x = origin[0]
+ y = origin[1]
+ z = origin[2]
+ i = index
+ max_depth = y + self.depth
+ if self.back is True:
+ max_depth = self.depth * self.step_num
+
+ # calculate width (no side gap)
+ if self.sizev is False:
+ width = self.max_width / 2
+ else:
+ width = (self.max_width / 2) - (step * (((self.max_width - self.min_width) / 2) / self.step_num))
+
+ # Vertical Rectangle
+ myvertex.extend([(x, y, z), (x, y, z + self.height), (x + width, y, z + self.height), (x + width, y, z)])
+ val = y + self.thickness
+ myvertex.extend([(x, val, z), (x, val, z + self.height), (x + width, val, z + self.height), (x + width, val, z)])
+
+ myfaces.extend([(i + 0, i + 1, i + 2, i + 3), (i + 4, i + 5, i + 6, i + 7), (i + 0, i + 3, i + 7, i + 4),
+ (i + 1, i + 2, i + 6, i + 5), (i + 0, i + 1, i + 5, i + 4), (i + 3, i + 2, i + 6, i + 7)])
+ # Side plane
+ myvertex.extend([(x + width, max_depth, z + self.height), (x + width, max_depth, z)])
+ myfaces.extend([(i + 7, i + 6, i + 8, i + 9)])
+ i += 10
+ # calculate width (side gap)
+ width = width + self.side_gap
+
+ # Horizontal Rectangle
+ z = z + self.height
+ myvertex.extend([(x, y - self.front_gap, z), (x, max_depth, z), (x + width, max_depth, z),
+ (x + width, y - self.front_gap, z)])
+ z = z + self.thickness
+ myvertex.extend([(x, y - self.front_gap, z), (x, max_depth, z), (x + width, max_depth, z),
+ (x + width, y - self.front_gap, z)])
+ myfaces.extend([(i + 0, i + 1, i + 2, i + 3), (i + 4, i + 5, i + 6, i + 7), (i + 0, i + 3, i + 7, i + 4),
+ (i + 1, i + 2, i + 6, i + 5), (i + 3, i + 2, i + 6, i + 7)])
+ i += 8
+ # remap origin
+ y = y + (self.depth * self.shift)
+
+ return i, (x, y, z)
+
+
+# ------------------------------------------------------------------------------
+# Create rounded step
+# ------------------------------------------------------------------------------
+def create_round_step(self, origin, myvertex, myfaces, index, step):
+ x = origin[0]
+ y = origin[1]
+ z = origin[2]
+ pos_x = None
+ i = index
+ li = [math.radians(270), math.radians(288), math.radians(306), math.radians(324), math.radians(342),
+ math.radians(0)]
+
+ max_width = self.max_width
+ max_depth = y + self.depth
+ if self.back is True:
+ max_depth = self.depth * self.step_num
+
+ # Resize for width
+ if self.sizev is True:
+ max_width = max_width - (step * ((self.max_width - self.min_width) / self.step_num))
+
+ half = max_width / 2
+ # ------------------------------------
+ # Vertical
+ # ------------------------------------
+ # calculate width
+ width = half - (half * self.radio)
+ myradio = half - width
+
+ myvertex.extend([(x, y, z), (x, y, z + self.height)])
+ # Round
+ for e in li:
+ pos_x = (math.cos(e) * myradio) + x + width - myradio
+ pos_y = (math.sin(e) * myradio) + y + myradio
+
+ myvertex.extend([(pos_x, pos_y, z), (pos_x, pos_y, z + self.height)])
+
+ # back point
+ myvertex.extend([(x + width, max_depth, z), (x + width, max_depth, z + self.height)])
+
+ myfaces.extend([(i, i + 1, i + 3, i + 2), (i + 2, i + 3, i + 5, i + 4), (i + 4, i + 5, i + 7, i + 6),
+ (i + 6, i + 7, i + 9, i + 8),
+ (i + 8, i + 9, i + 11, i + 10), (i + 10, i + 11, i + 13, i + 12), (i + 12, i + 13, i + 15, i + 14)])
+
+ i += 16
+ # ------------------------------------
+ # Horizontal
+ # ------------------------------------
+ # calculate width gap
+ width = half + self.front_gap - (half * self.radio)
+
+ z = z + self.height
+ # Vertical
+ myvertex.extend([(x, y - self.front_gap, z), (x, y - self.front_gap, z + self.thickness)])
+ # Round
+ for e in li:
+ pos_x = (math.cos(e) * myradio) + x + width - myradio
+ pos_y = (math.sin(e) * myradio) + y + myradio - self.front_gap
+
+ myvertex.extend([(pos_x, pos_y, z), (pos_x, pos_y, z + self.thickness)])
+
+ # back points
+ myvertex.extend([(pos_x, max_depth, z), (pos_x, max_depth, z + self.thickness),
+ (x, max_depth, z), (x, max_depth, z + self.thickness)])
+
+ myfaces.extend([(i, i + 1, i + 3, i + 2), (i + 2, i + 3, i + 5, i + 4), (i + 4, i + 5, i + 7, i + 6),
+ (i + 6, i + 7, i + 9, i + 8),
+ (i + 8, i + 9, i + 11, i + 10), (i + 10, i + 11, i + 13, i + 12), (i + 12, i + 13, i + 15, i + 14),
+ (i, i + 2, i + 4, i + 6, i + 8, i + 10, i + 12, i + 14, i + 16),
+ (i + 1, i + 3, i + 5, i + 7, i + 9, i + 11, i + 13, i + 15, i + 17),
+ (i + 14, i + 15, i + 17, i + 16)])
+
+ i += 18
+ z = z + self.thickness
+
+ # remap origin
+ y = y + (self.depth * self.shift)
+
+ return i, (x, y, z)
+
+
+# ------------------------------------------------------------------------------
+# Create bezier curve
+# ------------------------------------------------------------------------------
+def create_bezier(objname, points, origin):
+ curvedata = bpy.data.curves.new(name=objname, type='CURVE')
+ curvedata.dimensions = '3D'
+
+ myobject = bpy.data.objects.new(objname, curvedata)
+ myobject.location = origin
+ myobject.rotation_euler[2] = math.radians(90)
+
+ bpy.context.scene.objects.link(myobject)
+
+ polyline = curvedata.splines.new('BEZIER')
+ polyline.bezier_points.add(len(points) - 1)
+
+ for idx, (knot, h1, h2) in enumerate(points):
+ point = polyline.bezier_points[idx]
+ point.co = knot
+ point.handle_left = h1
+ point.handle_right = h2
+ point.handle_left_type = 'FREE'
+ point.handle_right_type = 'FREE'
+
+ return myobject
diff --git a/archimesh/achm_tools.py b/archimesh/achm_tools.py
new file mode 100644
index 00000000..7af503ef
--- /dev/null
+++ b/archimesh/achm_tools.py
@@ -0,0 +1,1043 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+# ----------------------------------------------------------
+# support routines and general functions
+# Author: Antonio Vazquez (antonioya)
+#
+# ----------------------------------------------------------
+# noinspection PyUnresolvedReferences
+import bpy
+import os
+
+
+# --------------------------------------------------------------------
+# Get length Blender units
+# --------------------------------------------------------------------
+def get_blendunits(units):
+ if bpy.context.scene.unit_settings.system == "IMPERIAL":
+ return units * 0.3048
+ else:
+ return units
+
+
+# --------------------------------------------------------------------
+# Set normals
+# True= faces to inside
+# False= faces to outside
+# --------------------------------------------------------------------
+def set_normals(myobject, direction=False):
+ bpy.context.scene.objects.active = myobject
+ # go edit mode
+ bpy.ops.object.mode_set(mode='EDIT')
+ # select all faces
+ bpy.ops.mesh.select_all(action='SELECT')
+ # recalculate outside normals�
+ bpy.ops.mesh.normals_make_consistent(inside=direction)
+ # go object mode again
+ bpy.ops.object.editmode_toggle()
+
+
+# --------------------------------------------------------------------
+# Remove doubles
+# --------------------------------------------------------------------
+def remove_doubles(myobject):
+ bpy.context.scene.objects.active = myobject
+ # go edit mode
+ bpy.ops.object.mode_set(mode='EDIT')
+ # select all faces
+ bpy.ops.mesh.select_all(action='SELECT')
+ # remove
+ bpy.ops.mesh.remove_doubles()
+ # go object mode again
+ bpy.ops.object.editmode_toggle()
+
+
+# --------------------------------------------------------------------
+# Set shade smooth
+# --------------------------------------------------------------------
+def set_smooth(myobject):
+ # deactivate others
+ for o in bpy.data.objects:
+ if o.select is True:
+ o.select = False
+
+ myobject.select = True
+ bpy.context.scene.objects.active = myobject
+ if bpy.context.scene.objects.active.name == myobject.name:
+ bpy.ops.object.shade_smooth()
+
+
+# --------------------------------------------------------------------
+# Add modifier (subdivision)
+# --------------------------------------------------------------------
+def set_modifier_subsurf(myobject):
+ bpy.context.scene.objects.active = myobject
+ if bpy.context.scene.objects.active.name == myobject.name:
+ bpy.ops.object.modifier_add(type='SUBSURF')
+ for mod in myobject.modifiers:
+ if mod.type == 'SUBSURF':
+ mod.levels = 2
+
+
+# --------------------------------------------------------------------
+# Add modifier (mirror)
+# --------------------------------------------------------------------
+def set_modifier_mirror(myobject, axis="Y"):
+ bpy.ops.object.select_all(False)
+ myobject.select = True
+ bpy.context.scene.objects.active = myobject
+ if bpy.context.scene.objects.active.name == myobject.name:
+ bpy.ops.object.modifier_add(type='MIRROR')
+ for mod in myobject.modifiers:
+ if mod.type == 'MIRROR':
+ if axis == "X":
+ mod.use_x = True
+ else:
+ mod.use_x = False
+
+ if axis == "Y":
+ mod.use_y = True
+ else:
+ mod.use_y = False
+
+ if axis == "Z":
+ mod.use_z = True
+ else:
+ mod.use_z = False
+
+ mod.use_clip = True
+
+
+# --------------------------------------------------------------------
+# Add modifier (array)
+# --------------------------------------------------------------------
+def set_modifier_array(myobject, axis, move, repeat, fix=False, fixmove=0, zmove=0):
+ bpy.ops.object.select_all(False)
+ myobject.select = True
+ bpy.context.scene.objects.active = myobject
+ if bpy.context.scene.objects.active.name == myobject.name:
+ bpy.ops.object.modifier_add(type='ARRAY')
+ for mod in myobject.modifiers:
+ if mod.type == 'ARRAY':
+ if mod.name == "Array":
+ mod.name = "Array_" + axis
+ mod.count = repeat
+ mod.use_constant_offset = fix
+ if axis == "X":
+ mod.relative_offset_displace[0] = move
+ mod.constant_offset_displace[0] = fixmove
+ mod.relative_offset_displace[1] = 0.0
+ mod.constant_offset_displace[1] = 0.0
+ mod.relative_offset_displace[2] = 0.0
+ mod.constant_offset_displace[2] = zmove
+
+ if axis == "Y":
+ mod.relative_offset_displace[0] = 0.0
+ mod.constant_offset_displace[0] = 0.0
+ mod.relative_offset_displace[1] = move
+ mod.constant_offset_displace[1] = fixmove
+ mod.relative_offset_displace[2] = 0.0
+ mod.constant_offset_displace[2] = 0.0
+
+
+# --------------------------------------------------------------------
+# Add modifier (curve)
+# --------------------------------------------------------------------
+def set_modifier_curve(myobject, mycurve):
+ bpy.context.scene.objects.active = myobject
+ if bpy.context.scene.objects.active.name == myobject.name:
+ bpy.ops.object.modifier_add(type='CURVE')
+ for mod in myobject.modifiers:
+ if mod.type == 'CURVE':
+ mod.deform_axis = 'POS_X'
+ mod.object = mycurve
+
+
+# --------------------------------------------------------------------
+# Add modifier (solidify)
+# --------------------------------------------------------------------
+def set_modifier_solidify(myobject, width):
+ bpy.context.scene.objects.active = myobject
+ if bpy.context.scene.objects.active.name == myobject.name:
+ bpy.ops.object.modifier_add(type='SOLIDIFY')
+ for mod in myobject.modifiers:
+ if mod.type == 'SOLIDIFY':
+ mod.thickness = width
+ mod.use_even_offset = True
+ mod.use_quality_normals = True
+ break
+
+
+# --------------------------------------------------------------------
+# Add modifier (boolean)
+# --------------------------------------------------------------------
+def set_modifier_boolean(myobject, bolobject):
+ bpy.context.scene.objects.active = myobject
+ if bpy.context.scene.objects.active.name == myobject.name:
+ bpy.ops.object.modifier_add(type='BOOLEAN')
+ mod = myobject.modifiers[len(myobject.modifiers) - 1]
+ mod.operation = 'DIFFERENCE'
+ mod.object = bolobject
+
+
+# --------------------------------------------------------------------
+# Set material to object
+# --------------------------------------------------------------------
+def set_material(myobject, mymaterial):
+ bpy.context.scene.objects.active = myobject
+ if bpy.context.scene.objects.active.name == myobject.name:
+ myobject.data.materials.append(mymaterial)
+
+
+# --------------------------------------------------------------------
+# Set material to selected faces
+# --------------------------------------------------------------------
+def set_material_faces(myobject, idx):
+ bpy.context.scene.objects.active = myobject
+ myobject.select = True
+ bpy.context.object.active_material_index = idx
+ if bpy.context.scene.objects.active.name == myobject.name:
+ bpy.ops.object.mode_set(mode='EDIT')
+ bpy.ops.object.material_slot_assign()
+ # Deselect
+ bpy.ops.mesh.select_all(action='DESELECT')
+ bpy.ops.object.mode_set(mode='OBJECT')
+
+
+# --------------------------------------------------------------------
+# Select faces
+# --------------------------------------------------------------------
+def select_faces(myobject, selface, clear):
+ myobject.select = True
+ bpy.context.scene.objects.active = myobject
+ if bpy.context.scene.objects.active.name == myobject.name:
+ # deselect everything
+ if clear:
+ bpy.ops.object.mode_set(mode='EDIT')
+ bpy.ops.mesh.select_all(action='DESELECT')
+
+ # reselect the originally selected face
+ bpy.ops.object.mode_set(mode='OBJECT')
+ myobject.data.polygons[selface].select = True
+
+
+# --------------------------------------------------------------------
+# Select vertices
+# --------------------------------------------------------------------
+def select_vertices(myobject, selvertices, clear=True):
+ myobject.select = True
+ bpy.context.scene.objects.active = myobject
+ if bpy.context.scene.objects.active.name == myobject.name:
+ # deselect everything
+ if clear:
+ bpy.ops.object.mode_set(mode='EDIT')
+ bpy.ops.mesh.select_all(action='DESELECT')
+
+ # Select Vertices
+ bpy.ops.object.mode_set(mode='EDIT', toggle=False)
+ sel_mode = bpy.context.tool_settings.mesh_select_mode
+
+ bpy.context.tool_settings.mesh_select_mode = [True, False, False]
+ bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
+
+ for i in selvertices:
+ myobject.data.vertices[i].select = True
+
+ bpy.ops.object.mode_set(mode='EDIT', toggle=False)
+ bpy.context.tool_settings.mesh_select_mode = sel_mode
+ bpy.ops.object.mode_set(mode='OBJECT')
+
+
+# --------------------------------------------------------------------
+# Mark Seam
+# --------------------------------------------------------------------
+def mark_seam(myobject):
+ # noinspection PyBroadException
+ try:
+ myobject.select = True
+ bpy.context.scene.objects.active = myobject
+ if bpy.context.scene.objects.active.name == myobject.name:
+ bpy.ops.object.mode_set(mode='EDIT', toggle=False)
+ bpy.ops.mesh.mark_seam()
+ bpy.ops.object.mode_set(mode='OBJECT')
+ except:
+ bpy.ops.object.mode_set(mode='OBJECT')
+
+
+# --------------------------------------------------------------------
+# Unwrap mesh
+# --------------------------------------------------------------------
+def unwrap_mesh(myobject, allfaces=True):
+ # noinspection PyBroadException
+ try:
+ myobject.select = True
+ bpy.context.scene.objects.active = myobject
+ if bpy.context.scene.objects.active.name == myobject.name:
+ # Unwrap
+ bpy.ops.object.mode_set(mode='EDIT', toggle=False)
+ if allfaces is True:
+ bpy.ops.mesh.select_all(action='DESELECT')
+ bpy.ops.mesh.select_all()
+ bpy.ops.uv.unwrap()
+ bpy.ops.object.mode_set(mode='OBJECT')
+ except:
+ bpy.ops.object.mode_set(mode='OBJECT')
+
+
+# --------------------------------------------------------------------
+# Get Node Index(multilanguage support)
+# --------------------------------------------------------------------
+def get_node_index(nodes, datatype):
+ idx = 0
+ for m in nodes:
+ if m.type == datatype:
+ return idx
+ idx += 1
+
+ # by default
+ return 1
+
+
+# --------------------------------------------------------------------
+# Create cycles diffuse material
+# --------------------------------------------------------------------
+def create_diffuse_material(matname, replace, r, g, b, rv=0.8, gv=0.8, bv=0.8, mix=0.1, twosides=False):
+ # Avoid duplicate materials
+ if replace is False:
+ matlist = bpy.data.materials
+ for m in matlist:
+ if m.name == matname:
+ return m
+ # Create material
+ scn = bpy.context.scene
+ # Set cycles render engine if not selected
+ if not scn.render.engine == 'CYCLES':
+ scn.render.engine = 'CYCLES'
+
+ mat = bpy.data.materials.new(matname)
+ mat.diffuse_color = (rv, gv, bv) # viewport color
+ mat.use_nodes = True
+ nodes = mat.node_tree.nodes
+
+ # support for multilanguage
+ node = nodes[get_node_index(nodes, 'BSDF_DIFFUSE')]
+ node.name = 'Diffuse BSDF'
+ node.label = 'Diffuse BSDF'
+
+ node.inputs[0].default_value = [r, g, b, 1]
+ node.location = 200, 320
+
+ node = nodes.new('ShaderNodeBsdfGlossy')
+ node.name = 'Glossy_0'
+ node.location = 200, 0
+
+ node = nodes.new('ShaderNodeMixShader')
+ node.name = 'Mix_0'
+ node.inputs[0].default_value = mix
+ node.location = 500, 160
+
+ node = nodes[get_node_index(nodes, 'OUTPUT_MATERIAL')]
+ node.location = 1100, 160
+
+ # Connect nodes
+ outn = nodes['Diffuse BSDF'].outputs[0]
+ inn = nodes['Mix_0'].inputs[1]
+ mat.node_tree.links.new(outn, inn)
+
+ outn = nodes['Glossy_0'].outputs[0]
+ inn = nodes['Mix_0'].inputs[2]
+ mat.node_tree.links.new(outn, inn)
+
+ if twosides is False:
+ outn = nodes['Mix_0'].outputs[0]
+ inn = nodes[get_node_index(nodes, 'OUTPUT_MATERIAL')].inputs[0]
+ mat.node_tree.links.new(outn, inn)
+
+ if twosides is True:
+ node = nodes.new('ShaderNodeNewGeometry')
+ node.name = 'Input_1'
+ node.location = -80, -70
+
+ node = nodes.new('ShaderNodeBsdfDiffuse')
+ node.name = 'Diffuse_1'
+ node.inputs[0].default_value = [0.30, 0.30, 0.30, 1]
+ node.location = 200, -280
+
+ node = nodes.new('ShaderNodeMixShader')
+ node.name = 'Mix_1'
+ node.inputs[0].default_value = mix
+ node.location = 800, -70
+
+ outn = nodes['Input_1'].outputs[6]
+ inn = nodes['Mix_1'].inputs[0]
+ mat.node_tree.links.new(outn, inn)
+
+ outn = nodes['Diffuse_1'].outputs[0]
+ inn = nodes['Mix_1'].inputs[2]
+ mat.node_tree.links.new(outn, inn)
+
+ outn = nodes['Mix_0'].outputs[0]
+ inn = nodes['Mix_1'].inputs[1]
+ mat.node_tree.links.new(outn, inn)
+
+ outn = nodes['Mix_1'].outputs[0]
+ inn = nodes[get_node_index(nodes, 'OUTPUT_MATERIAL')].inputs[0]
+ mat.node_tree.links.new(outn, inn)
+
+ return mat
+
+
+# --------------------------------------------------------------------
+# Create cycles translucent material
+# --------------------------------------------------------------------
+def create_translucent_material(matname, replace, r, g, b, rv=0.8, gv=0.8, bv=0.8, mix=0.1):
+ # Avoid duplicate materials
+ if replace is False:
+ matlist = bpy.data.materials
+ for m in matlist:
+ if m.name == matname:
+ return m
+ # Create material
+ scn = bpy.context.scene
+ # Set cycles render engine if not selected
+ if not scn.render.engine == 'CYCLES':
+ scn.render.engine = 'CYCLES'
+
+ mat = bpy.data.materials.new(matname)
+ mat.diffuse_color = (rv, gv, bv) # viewport color
+ mat.use_nodes = True
+ nodes = mat.node_tree.nodes
+
+ # support for multilanguage
+ node = nodes[get_node_index(nodes, 'BSDF_DIFFUSE')]
+ node.name = 'Diffuse BSDF'
+ node.label = 'Diffuse BSDF'
+
+ node.inputs[0].default_value = [r, g, b, 1]
+ node.location = 200, 320
+
+ node = nodes.new('ShaderNodeBsdfTranslucent')
+ node.name = 'Translucent_0'
+ node.location = 200, 0
+
+ node = nodes.new('ShaderNodeMixShader')
+ node.name = 'Mix_0'
+ node.inputs[0].default_value = mix
+ node.location = 500, 160
+
+ node = nodes[get_node_index(nodes, 'OUTPUT_MATERIAL')]
+ node.location = 1100, 160
+
+ # Connect nodes
+ outn = nodes['Diffuse BSDF'].outputs[0]
+ inn = nodes['Mix_0'].inputs[1]
+ mat.node_tree.links.new(outn, inn)
+
+ outn = nodes['Translucent_0'].outputs[0]
+ inn = nodes['Mix_0'].inputs[2]
+ mat.node_tree.links.new(outn, inn)
+
+ outn = nodes['Mix_0'].outputs[0]
+ inn = nodes[get_node_index(nodes, 'OUTPUT_MATERIAL')].inputs[0]
+ mat.node_tree.links.new(outn, inn)
+
+ return mat
+
+
+# --------------------------------------------------------------------
+# Create cycles glass material
+# --------------------------------------------------------------------
+def create_glass_material(matname, replace, rv=0.333, gv=0.342, bv=0.9):
+ # Avoid duplicate materials
+ if replace is False:
+ matlist = bpy.data.materials
+ for m in matlist:
+ if m.name == matname:
+ return m
+ # Create material
+ scn = bpy.context.scene
+ # Set cycles render engine if not selected
+ if not scn.render.engine == 'CYCLES':
+ scn.render.engine = 'CYCLES'
+
+ mat = bpy.data.materials.new(matname)
+ mat.use_nodes = True
+ mat.diffuse_color = (rv, gv, bv)
+ nodes = mat.node_tree.nodes
+
+ # support for multilanguage
+ node = nodes[get_node_index(nodes, 'BSDF_DIFFUSE')]
+ mat.node_tree.nodes.remove(node) # remove not used
+
+ node = nodes.new('ShaderNodeLightPath')
+ node.name = 'Light_0'
+ node.location = 10, 160
+
+ node = nodes.new('ShaderNodeBsdfRefraction')
+ node.name = 'Refraction_0'
+ node.inputs[2].default_value = 1 # IOR 1.0
+ node.location = 250, 400
+
+ node = nodes.new('ShaderNodeBsdfGlossy')
+ node.name = 'Glossy_0'
+ node.distribution = 'SHARP'
+ node.location = 250, 100
+
+ node = nodes.new('ShaderNodeBsdfTransparent')
+ node.name = 'Transparent_0'
+ node.location = 500, 10
+
+ node = nodes.new('ShaderNodeMixShader')
+ node.name = 'Mix_0'
+ node.inputs[0].default_value = 0.035
+ node.location = 500, 160
+
+ node = nodes.new('ShaderNodeMixShader')
+ node.name = 'Mix_1'
+ node.inputs[0].default_value = 0.1
+ node.location = 690, 290
+
+ node = nodes[get_node_index(nodes, 'OUTPUT_MATERIAL')]
+ node.location = 920, 290
+
+ # Connect nodes
+ outn = nodes['Light_0'].outputs[1]
+ inn = nodes['Mix_1'].inputs[0]
+ mat.node_tree.links.new(outn, inn)
+
+ outn = nodes['Refraction_0'].outputs[0]
+ inn = nodes['Mix_0'].inputs[1]
+ mat.node_tree.links.new(outn, inn)
+
+ outn = nodes['Glossy_0'].outputs[0]
+ inn = nodes['Mix_0'].inputs[2]
+ mat.node_tree.links.new(outn, inn)
+
+ outn = nodes['Mix_0'].outputs[0]
+ inn = nodes['Mix_1'].inputs[1]
+ mat.node_tree.links.new(outn, inn)
+
+ outn = nodes['Transparent_0'].outputs[0]
+ inn = nodes['Mix_1'].inputs[2]
+ mat.node_tree.links.new(outn, inn)
+
+ outn = nodes['Mix_1'].outputs[0]
+ inn = nodes[get_node_index(nodes, 'OUTPUT_MATERIAL')].inputs[0]
+ mat.node_tree.links.new(outn, inn)
+
+ return mat
+
+
+# ---------------------------------------------
+# Create cycles transparents material
+# --------------------------------------------------------------------
+def create_transparent_material(matname, replace, r=1, g=1, b=1, alpha=0):
+ # Avoid duplicate materials
+ if replace is False:
+ matlist = bpy.data.materials
+ for m in matlist:
+ if m.name == matname:
+ return m
+ # Create material
+ scn = bpy.context.scene
+ # Set cycles render engine if not selected
+ if not scn.render.engine == 'CYCLES':
+ scn.render.engine = 'CYCLES'
+
+ mat = bpy.data.materials.new(matname)
+ mat.use_nodes = True
+ mat.diffuse_color = (r, g, b)
+ nodes = mat.node_tree.nodes
+
+ # support for multilanguage
+ node = nodes[get_node_index(nodes, 'BSDF_DIFFUSE')]
+ mat.node_tree.nodes.remove(node) # remove not used
+
+ node = nodes.new('ShaderNodeBsdfTransparent')
+ node.name = 'Transparent_0'
+ node.location = 250, 160
+ node.inputs[0].default_value = [r, g, b, alpha]
+
+ node = nodes[get_node_index(nodes, 'OUTPUT_MATERIAL')]
+ node.location = 700, 160
+
+ # Connect nodes
+ outn = nodes['Transparent_0'].outputs[0]
+ inn = nodes[get_node_index(nodes, 'OUTPUT_MATERIAL')].inputs[0]
+ mat.node_tree.links.new(outn, inn)
+
+ return mat
+
+
+# --------------------------------------------------------------------
+# Create cycles glossy material
+# --------------------------------------------------------------------
+def create_glossy_material(matname, replace, r, g, b, rv=0.578, gv=0.555, bv=0.736, rvalue=0.2):
+ # Avoid duplicate materials
+ if replace is False:
+ matlist = bpy.data.materials
+ for m in matlist:
+ if m.name == matname:
+ return m
+ # Create material
+ scn = bpy.context.scene
+ # Set cycles render engine if not selected
+ if not scn.render.engine == 'CYCLES':
+ scn.render.engine = 'CYCLES'
+
+ mat = bpy.data.materials.new(matname)
+ mat.use_nodes = True
+ mat.diffuse_color = (rv, gv, bv)
+ nodes = mat.node_tree.nodes
+
+ # support for multilanguage
+ node = nodes[get_node_index(nodes, 'BSDF_DIFFUSE')]
+ mat.node_tree.nodes.remove(node) # remove not used
+
+ node = nodes.new('ShaderNodeBsdfGlossy')
+ node.name = 'Glossy_0'
+ node.inputs[0].default_value = [r, g, b, 1]
+ node.inputs[1].default_value = rvalue
+ node.location = 200, 160
+
+ node = nodes[get_node_index(nodes, 'OUTPUT_MATERIAL')]
+ node.location = 700, 160
+
+ # Connect nodes
+ outn = nodes['Glossy_0'].outputs[0]
+ inn = nodes[get_node_index(nodes, 'OUTPUT_MATERIAL')].inputs[0]
+ mat.node_tree.links.new(outn, inn)
+
+ return mat
+
+
+# --------------------------------------------------------------------
+# Create cycles emission material
+# --------------------------------------------------------------------
+def create_emission_material(matname, replace, r, g, b, energy):
+ # Avoid duplicate materials
+ if replace is False:
+ matlist = bpy.data.materials
+ for m in matlist:
+ if m.name == matname:
+ return m
+ # Create material
+ scn = bpy.context.scene
+ # Set cycles render engine if not selected
+ if not scn.render.engine == 'CYCLES':
+ scn.render.engine = 'CYCLES'
+
+ mat = bpy.data.materials.new(matname)
+ mat.use_nodes = True
+ nodes = mat.node_tree.nodes
+
+ # support for multilanguage
+ node = nodes[get_node_index(nodes, 'BSDF_DIFFUSE')]
+ mat.node_tree.nodes.remove(node) # remove not used
+
+ node = nodes.new('ShaderNodeEmission')
+ node.name = 'Emission_0'
+ node.inputs[0].default_value = [r, g, b, 1]
+ node.inputs[1].default_value = energy
+ node.location = 200, 160
+
+ node = nodes[get_node_index(nodes, 'OUTPUT_MATERIAL')]
+ node.location = 700, 160
+
+ # Connect nodes
+ outn = nodes['Emission_0'].outputs[0]
+ inn = nodes[get_node_index(nodes, 'OUTPUT_MATERIAL')].inputs[0]
+ mat.node_tree.links.new(outn, inn)
+
+ return mat
+
+
+# --------------------------------------------------------------------
+# Create cycles glass material
+# --------------------------------------------------------------------
+def create_old_glass_material(matname, replace, rv=0.352716, gv=0.760852, bv=0.9):
+ # Avoid duplicate materials
+ if replace is False:
+ matlist = bpy.data.materials
+ for m in matlist:
+ if m.name == matname:
+ return m
+ # Create material
+ scn = bpy.context.scene
+ # Set cycles render engine if not selected
+ if not scn.render.engine == 'CYCLES':
+ scn.render.engine = 'CYCLES'
+
+ mat = bpy.data.materials.new(matname)
+ mat.use_nodes = True
+ mat.diffuse_color = (rv, gv, bv)
+ nodes = mat.node_tree.nodes
+
+ # support for multilanguage
+ node = nodes[get_node_index(nodes, 'BSDF_DIFFUSE')]
+ mat.node_tree.nodes.remove(node) # remove not used
+
+ node = nodes.new('ShaderNodeLightPath')
+ node.name = 'Light_0'
+ node.location = 10, 160
+
+ node = nodes.new('ShaderNodeBsdfGlass')
+ node.name = 'Glass_0'
+ node.location = 250, 300
+
+ node = nodes.new('ShaderNodeBsdfTransparent')
+ node.name = 'Transparent_0'
+ node.location = 250, 0
+
+ node = nodes.new('ShaderNodeMixShader')
+ node.name = 'Mix_0'
+ node.inputs[0].default_value = 0.1
+ node.location = 500, 160
+
+ node = nodes.new('ShaderNodeMixShader')
+ node.name = 'Mix_1'
+ node.inputs[0].default_value = 0.1
+ node.location = 690, 290
+
+ node = nodes[get_node_index(nodes, 'OUTPUT_MATERIAL')]
+ node.location = 920, 290
+
+ # Connect nodes
+ outn = nodes['Light_0'].outputs[1]
+ inn = nodes['Mix_0'].inputs[0]
+ mat.node_tree.links.new(outn, inn)
+
+ outn = nodes['Light_0'].outputs[2]
+ inn = nodes['Mix_1'].inputs[0]
+ mat.node_tree.links.new(outn, inn)
+
+ outn = nodes['Glass_0'].outputs[0]
+ inn = nodes['Mix_0'].inputs[1]
+ mat.node_tree.links.new(outn, inn)
+
+ outn = nodes['Transparent_0'].outputs[0]
+ inn = nodes['Mix_0'].inputs[2]
+ mat.node_tree.links.new(outn, inn)
+
+ outn = nodes['Mix_0'].outputs[0]
+ inn = nodes['Mix_1'].inputs[1]
+ mat.node_tree.links.new(outn, inn)
+
+ outn = nodes['Mix_1'].outputs[0]
+ inn = nodes[get_node_index(nodes, 'OUTPUT_MATERIAL')].inputs[0]
+ mat.node_tree.links.new(outn, inn)
+
+ return mat
+
+
+# --------------------------------------------------------------------
+# Create cycles brick texture material
+# --------------------------------------------------------------------
+def create_brick_material(matname, replace, r, g, b, rv=0.8, gv=0.636, bv=0.315):
+ # Avoid duplicate materials
+ if replace is False:
+ matlist = bpy.data.materials
+ for m in matlist:
+ if m.name == matname:
+ return m
+ # Create material
+ scn = bpy.context.scene
+ # Set cycles render engine if not selected
+ if not scn.render.engine == 'CYCLES':
+ scn.render.engine = 'CYCLES'
+
+ mat = bpy.data.materials.new(matname)
+ mat.use_nodes = True
+ mat.diffuse_color = (rv, gv, bv)
+ nodes = mat.node_tree.nodes
+
+ # support for multilanguage
+ node = nodes[get_node_index(nodes, 'BSDF_DIFFUSE')]
+ node.name = 'Diffuse BSDF'
+ node.label = 'Diffuse BSDF'
+
+ node.inputs[0].default_value = [r, g, b, 1]
+ node.location = 500, 160
+
+ node = nodes[get_node_index(nodes, 'OUTPUT_MATERIAL')]
+ node.location = 700, 160
+
+ node = nodes.new('ShaderNodeTexBrick')
+ node.name = 'Brick_0'
+ node.inputs[3].default_value = [0.407, 0.411, 0.394, 1] # mortar color
+ node.inputs[4].default_value = 3 # scale
+ node.inputs[5].default_value = 0.001 # mortar
+ node.inputs[7].default_value = 0.60 # size_w
+ node.inputs[8].default_value = 0.30 # size_h
+ node.location = 300, 160
+
+ node = nodes.new('ShaderNodeRGB')
+ node.name = 'RGB_0'
+ node.outputs[0].default_value = [r, g, b, 1]
+ node.location = 70, 160
+
+ # Connect nodes
+ outn = nodes['RGB_0'].outputs['Color']
+ inn = nodes['Brick_0'].inputs['Color1']
+ mat.node_tree.links.new(outn, inn)
+
+ inn = nodes['Brick_0'].inputs['Color2']
+ mat.node_tree.links.new(outn, inn)
+
+ outn = nodes['Brick_0'].outputs['Color']
+ inn = nodes['Diffuse BSDF'].inputs['Color']
+ mat.node_tree.links.new(outn, inn)
+
+ return mat
+
+
+# --------------------------------------------------------------------
+# Create cycles fabric texture material
+# --------------------------------------------------------------------
+def create_fabric_material(matname, replace, r, g, b, rv=0.8, gv=0.636, bv=0.315):
+ # Avoid duplicate materials
+ if replace is False:
+ matlist = bpy.data.materials
+ for m in matlist:
+ if m.name == matname:
+ return m
+ # Create material
+ scn = bpy.context.scene
+ # Set cycles render engine if not selected
+ if not scn.render.engine == 'CYCLES':
+ scn.render.engine = 'CYCLES'
+
+ mat = bpy.data.materials.new(matname)
+ mat.use_nodes = True
+ mat.diffuse_color = (rv, gv, bv)
+ nodes = mat.node_tree.nodes
+
+ # support for multilanguage
+ node = nodes[get_node_index(nodes, 'BSDF_DIFFUSE')]
+ node.name = 'Diffuse BSDF'
+ node.label = 'Diffuse BSDF'
+
+ node.inputs[0].default_value = [r, g, b, 1]
+ node.location = 810, 270
+
+ node = nodes[get_node_index(nodes, 'OUTPUT_MATERIAL')]
+ node.location = 1210, 320
+
+ node = nodes.new('ShaderNodeTexCoord')
+ node.name = 'UVCoordinates'
+ node.location = 26, 395
+
+ node = nodes.new('ShaderNodeMapping')
+ node.name = 'UVMapping'
+ node.location = 266, 380
+ node.scale[0] = 1000
+ node.scale[1] = 1000
+ node.scale[2] = 1000
+
+ # ===========================================================================
+ # Image texture
+ # ===========================================================================
+ # Load image file.
+
+ realpath = os.path.join(os.path.dirname(__file__), "images", "fabric_diffuse.png")
+ print("Loading: " + realpath)
+ try:
+ img = bpy.data.images.load(realpath)
+ except:
+ raise NameError("Cannot load image %s" % realpath)
+
+ # Create image texture from image
+ ctex = bpy.data.textures.new('ColorTex', type='IMAGE')
+ ctex.image = img
+
+ node = nodes.new('ShaderNodeTexImage')
+ node.name = 'Image1'
+ node.image = ctex.image
+ node.location = 615, 350
+
+ node = nodes.new('ShaderNodeBsdfTransparent')
+ node.name = 'Transparent1'
+ node.location = 810, 395
+ node.inputs[0].default_value = [r, g, b, 1]
+
+ node = nodes.new('ShaderNodeAddShader')
+ node.name = 'Add1'
+ node.location = 1040, 356
+
+ # Connect nodes
+ outn = nodes['UVCoordinates'].outputs['UV']
+ inn = nodes['UVMapping'].inputs['Vector']
+ mat.node_tree.links.new(outn, inn)
+
+ outn = nodes['UVMapping'].outputs['Vector']
+ inn = nodes['Image1'].inputs['Vector']
+ mat.node_tree.links.new(outn, inn)
+
+ outn = nodes['Image1'].outputs['Color']
+ inn = nodes['Diffuse BSDF'].inputs['Color']
+ mat.node_tree.links.new(outn, inn)
+
+ outn = nodes['Transparent1'].outputs['BSDF']
+ inn = nodes['Add1'].inputs[0]
+ mat.node_tree.links.new(outn, inn)
+
+ outn = nodes['Diffuse BSDF'].outputs['BSDF']
+ inn = nodes['Add1'].inputs[1]
+ mat.node_tree.links.new(outn, inn)
+
+ outn = nodes['Add1'].outputs['Shader']
+ inn = nodes[get_node_index(nodes, 'OUTPUT_MATERIAL')].inputs[0]
+ mat.node_tree.links.new(outn, inn)
+
+ return mat
+
+
+# --------------------------------------------------------------------
+# Copy bin file
+# --------------------------------------------------------------------
+def copy_binfile(fromfile, tofile):
+ with open(fromfile, 'rb') as f1:
+ with open(tofile, 'wb') as f2:
+ while True:
+ mybytes = f1.read(1024)
+ if mybytes:
+ f2.write(mybytes)
+ else:
+ break
+
+
+# --------------------------------------------------------------------
+# Parent object (keep positions)
+# --------------------------------------------------------------------
+def parentobject(parentobj, childobj):
+ # noinspection PyBroadException
+ try:
+ bpy.ops.object.select_all(action='DESELECT')
+ bpy.context.scene.objects.active = parentobj
+ parentobj.select = True
+ childobj.select = True
+ bpy.ops.object.parent_set(type='OBJECT', keep_transform=False)
+ return True
+ except:
+ return False
+
+
+# ------------------------------------------------------------------------------
+# Create control box
+#
+# objName: Object name
+# x: size x axis
+# y: size y axis
+# z: size z axis
+# tube: True create a tube, False only sides
+# ------------------------------------------------------------------------------
+def create_control_box(objname, x, y, z, tube=True):
+ myvertex = [(-x / 2, 0, 0.0),
+ (-x / 2, y, 0.0),
+ (x / 2, y, 0.0),
+ (x / 2, 0, 0.0),
+ (-x / 2, 0, z),
+ (-x / 2, y, z),
+ (x / 2, y, z),
+ (x / 2, 0, z)]
+
+ if tube is True:
+ myfaces = [(0, 1, 2, 3), (0, 4, 5, 1), (1, 5, 6, 2), (3, 7, 4, 0), (2, 6, 7, 3), (5, 4, 7, 6)]
+ else:
+ myfaces = [(0, 4, 5, 1), (2, 6, 7, 3)]
+
+ mesh = bpy.data.meshes.new(objname)
+ myobject = bpy.data.objects.new(objname, mesh)
+
+ myobject.location = bpy.context.scene.cursor_location
+ bpy.context.scene.objects.link(myobject)
+
+ mesh.from_pydata(myvertex, [], myfaces)
+ mesh.update(calc_edges=True)
+
+ return myobject
+
+
+# ------------------------------------------------------------------------------
+# Remove all children objects
+# ------------------------------------------------------------------------------
+def remove_children(myobject):
+ # Remove children
+ for child in myobject.children:
+ # noinspection PyBroadException
+ try:
+ # noinspection PyBroadException
+ try:
+ # remove child relationship
+ for grandchild in child.children:
+ grandchild.parent = None
+ # remove modifiers
+ for mod in child.modifiers:
+ bpy.ops.object.modifier_remove(name=mod.name)
+ except:
+ pass
+ # clear child data
+ if child.type == 'MESH':
+ old = child.data
+ child.select = True
+ bpy.ops.object.delete()
+ bpy.data.meshes.remove(old)
+ if child.type == 'CURVE':
+ child.select = True
+ bpy.ops.object.delete()
+ except:
+ pass
+
+
+# --------------------------------------------------------------------
+# Get all parents
+# --------------------------------------------------------------------
+def get_allparents(myobj):
+ obj = myobj
+ mylist = []
+ while obj.parent is not None:
+ mylist.append(obj)
+ objp = obj.parent
+ obj = objp
+
+ mylist.append(obj)
+
+ return mylist
+
+
+# --------------------------------------------------------------------
+# Verify all faces are in vertice group to avoid Blander crash
+#
+# Review the faces array and remove any vertex out of the range
+# this avoid any bug that can appear avoiding Blender crash
+# --------------------------------------------------------------------
+def check_mesh_errors(myvertices, myfaces):
+ vmax = len(myvertices)
+
+ f = 0
+ for face in myfaces:
+ for v in face:
+ if v < 0 or v > vmax:
+ print("Face=" + str(f) + "->removed vertex=" + str(v))
+ myfaces[f].remove(v)
+ f += 1
+
+ return myfaces
diff --git a/archimesh/achm_venetian_maker.py b/archimesh/achm_venetian_maker.py
new file mode 100644
index 00000000..905e49eb
--- /dev/null
+++ b/archimesh/achm_venetian_maker.py
@@ -0,0 +1,1409 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+# ----------------------------------------------------------
+# Author: Antonio Vazquez (antonioya)
+#
+# ----------------------------------------------------------
+# noinspection PyUnresolvedReferences
+import bpy
+import math
+# noinspection PyUnresolvedReferences
+from bpy.props import *
+from achm_tools import *
+
+
+# ------------------------------------------------------------------
+# Define operator class to create object
+# ------------------------------------------------------------------
+class AchmVenetian(bpy.types.Operator):
+ bl_idname = "mesh.archimesh_venetian"
+ bl_label = "Venetian blind"
+ bl_description = "Venetian"
+ bl_category = 'Archimesh'
+ bl_options = {'REGISTER', 'UNDO'}
+
+ # -----------------------------------------------------
+ # Draw (create UI interface)
+ # -----------------------------------------------------
+ # noinspection PyUnusedLocal
+ def draw(self, context):
+ layout = self.layout
+ row = layout.row()
+ row.label("Use Properties panel (N) to define parms", icon='INFO')
+
+ # -----------------------------------------------------
+ # Execute
+ # -----------------------------------------------------
+ def execute(self, context):
+ if bpy.context.mode == "OBJECT":
+ create_object(self, context)
+ return {'FINISHED'}
+ else:
+ self.report({'WARNING'}, "Archimesh: Option only valid in Object mode")
+ return {'CANCELLED'}
+
+
+# ------------------------------------------------------------------------------
+#
+# Create main object. The other objects will be children of this.
+#
+# ------------------------------------------------------------------------------
+# noinspection PyUnusedLocal
+def create_object(self, context):
+ # deselect all objects
+ for o in bpy.data.objects:
+ o.select = False
+
+ # we create main object and mesh
+ mainmesh = bpy.data.meshes.new("VenetianFrane")
+ mainobject = bpy.data.objects.new("VenetianFrame", mainmesh)
+ mainobject.location = bpy.context.scene.cursor_location
+ bpy.context.scene.objects.link(mainobject)
+ mainobject.VenetianObjectGenerator.add()
+
+ # we shape the main object and create other objects as children
+ shape_mesh_and_create_children(mainobject, mainmesh)
+
+ # we select, and activate, main object
+ mainobject.select = True
+ bpy.context.scene.objects.active = mainobject
+
+
+# ------------------------------------------------------------------------------
+#
+# Update main mesh and children objects
+#
+# ------------------------------------------------------------------------------
+# noinspection PyUnusedLocal
+def update_object(self, context):
+ # When we update, the active object is the main object
+ o = bpy.context.active_object
+ oldmesh = o.data
+ oldname = o.data.name
+ # Now we deselect that object to not delete it.
+ o.select = False
+ # and we create a new mesh
+ tmp_mesh = bpy.data.meshes.new("temp")
+ # deselect all objects
+ for obj in bpy.data.objects:
+ obj.select = False
+
+ # -----------------------
+ # remove all children
+ # -----------------------
+ # first granchild
+ for child in o.children:
+ remove_children(child)
+ # now children of main object
+ remove_children(o)
+
+ # Finally we create all that again (except main object),
+ shape_mesh_and_create_children(o, tmp_mesh, True)
+ o.data = tmp_mesh
+ # Remove data (mesh of active object),
+ bpy.data.meshes.remove(oldmesh)
+ tmp_mesh.name = oldname
+ # and select, and activate, the main object
+ o.select = True
+ bpy.context.scene.objects.active = o
+
+
+# ------------------------------------------------------------------------------
+# Generate all objects
+# For main, it only shapes mesh and creates modifiers (the modifier, only the first time).
+# And, for the others, it creates object and mesh.
+# ------------------------------------------------------------------------------
+# noinspection PyUnusedLocal
+def shape_mesh_and_create_children(mainobject, tmp_mesh, update=False):
+ mp = mainobject.VenetianObjectGenerator[0]
+ mat = None
+ plastic = None
+
+ if mp.crt_mat:
+ rgb = mp.objcol
+ plastic = create_diffuse_material("Plastic_venetian_material", True, rgb[0], rgb[1], rgb[2], rgb[0], rgb[1],
+ rgb[2], 0.2)
+
+ # ------------------
+ # Top
+ # ------------------
+ create_venetian_top(tmp_mesh, mp.width + 0.002, mp.depth + 0.002, -0.06)
+
+ # materials
+ if mp.crt_mat:
+ set_material(mainobject, plastic)
+ # --------------------------------------------------------------------------------
+ # segments
+ # --------------------------------------------------------------------------------
+ margin = mp.depth
+ mydata = create_slat_mesh("Venetian_slats", mp.width, mp.depth, mp.height - 0.06, mp.angle, mp.ratio)
+ myslats = mydata[0]
+ myslats.parent = mainobject
+ myslats.location.x = 0
+ myslats.location.y = 0
+ myslats.location.z = -margin - 0.04
+
+ mypoints = mydata[1]
+ angleused = mydata[2]
+ # refine
+ remove_doubles(myslats)
+ set_normals(myslats)
+ set_smooth(myslats)
+
+ if mp.crt_mat:
+ set_material(myslats, plastic)
+ # ------------------------
+ # Strings (Middle)
+ # ------------------------
+ myp = [((0, 0, mypoints[0] + margin), (0, 0, 0), (0, 0, 0)),
+ ((0, 0, mypoints[len(mypoints) - 1]), (0, 0, 0), (0, 0, 0))]
+
+ mycurvel = create_bezier("String.L", myp, (0, 0, 0))
+ mycurvel.parent = myslats
+ mycurvec = create_bezier("String.C", myp, (0, 0, 0))
+ mycurvec.parent = myslats
+ mycurver = create_bezier("String.R", myp, (0, 0, 0))
+ mycurver.parent = myslats
+
+ if mp.width < 0.60:
+ sep = 0.058
+ else:
+ sep = 0.148
+
+ mycurvel.location.x = (mp.width / 2) - sep
+ mycurvel.location.y = 0
+ mycurvel.location.z = 0
+
+ mycurvec.location.x = 0
+ mycurvec.location.y = 0
+ mycurvec.location.z = 0
+
+ mycurver.location.x = -(mp.width / 2) + sep
+ mycurver.location.y = 0
+ mycurver.location.z = 0
+
+ if mp.crt_mat:
+ mat = create_diffuse_material("String_material", False, 0.674, 0.617, 0.496, 0.1, 0.1, 0.1, 0.01)
+ set_material(mycurvel, mat)
+ set_material(mycurvec, mat)
+ set_material(mycurver, mat)
+ # ------------------------
+ # Strings (Front)
+ # ------------------------
+ myp = [((0, 0, margin), (0, 0, 0), (0, 0, 0)),
+ ((0, 0, mypoints[len(mypoints) - 1] - 0.003 - math.sin(math.radians(angleused)) * mp.depth / 2), (0, 0, 0),
+ (0, 0, 0))]
+
+ mycurvelf = create_bezier("String.f.L", myp, (0, 0, 0), 0.001, 'FRONT')
+ mycurvelf.parent = myslats
+ mycurvecf = create_bezier("String.f.C", myp, (0, 0, 0), 0.001, 'FRONT')
+ mycurvecf.parent = myslats
+ mycurverf = create_bezier("String.f.R", myp, (0, 0, 0), 0.001, 'FRONT')
+ mycurverf.parent = myslats
+
+ if mp.width < 0.60:
+ sep = 0.058
+ else:
+ sep = 0.148
+
+ mycurvelf.location.x = (mp.width / 2) - sep
+ mycurvelf.location.y = ((-mp.depth / 2) * math.cos(math.radians(mp.angle))) - 0.001
+ mycurvelf.location.z = 0
+
+ mycurvecf.location.x = 0
+ mycurvecf.location.y = ((-mp.depth / 2) * math.cos(math.radians(mp.angle))) - 0.001
+ mycurvecf.location.z = 0
+
+ mycurverf.location.x = -(mp.width / 2) + sep
+ mycurverf.location.y = ((-mp.depth / 2) * math.cos(math.radians(mp.angle))) - 0.001
+ mycurverf.location.z = 0
+
+ if mp.crt_mat:
+ set_material(mycurvelf, mat)
+ set_material(mycurvecf, mat)
+ set_material(mycurverf, mat)
+
+ # ------------------------
+ # Strings (Back)
+ # ------------------------
+ myp = [((0, 0, margin), (0, 0, 0), (0, 0, 0)),
+ ((0, 0, mypoints[len(mypoints) - 1] - 0.003 + math.sin(math.radians(angleused)) * mp.depth / 2),
+ (0, 0, 0),
+ (0, 0, 0))]
+
+ mycurvelb = create_bezier("String.b.L", myp, (0, 0, 0), 0.001, 'BACK')
+ mycurvelb.parent = myslats
+ mycurvecb = create_bezier("String.b.C", myp, (0, 0, 0), 0.001, 'BACK')
+ mycurvecb.parent = myslats
+ mycurverb = create_bezier("String.b.R", myp, (0, 0, 0), 0.001, 'BACK')
+ mycurverb.parent = myslats
+
+ if mp.width < 0.60:
+ sep = 0.058
+ else:
+ sep = 0.148
+
+ mycurvelb.location.x = (mp.width / 2) - sep
+ mycurvelb.location.y = ((mp.depth / 2) * math.cos(math.radians(mp.angle))) + 0.001
+ mycurvelb.location.z = 0
+
+ mycurvecb.location.x = 0
+ mycurvecb.location.y = ((mp.depth / 2) * math.cos(math.radians(mp.angle))) + 0.001
+ mycurvecb.location.z = 0
+
+ mycurverb.location.x = -(mp.width / 2) + sep
+ mycurverb.location.y = ((mp.depth / 2) * math.cos(math.radians(mp.angle))) + 0.001
+ mycurverb.location.z = 0
+
+ if mp.crt_mat:
+ set_material(mycurvelb, mat)
+ set_material(mycurvecb, mat)
+ set_material(mycurverb, mat)
+
+ # ------------------
+ # Bottom
+ # ------------------
+ mybase = create_venetian_base("Venetian_base", mp.width + 0.002, mp.depth + 0.002, -0.006)
+ mybase.parent = myslats
+ mybase.location.x = 0
+ mybase.location.y = 0
+ mybase.location.z = mypoints[len(mypoints) - 1]
+ mybase.rotation_euler = (math.radians(angleused), 0, 0)
+
+ # materials
+ if mp.crt_mat:
+ set_material(mybase, plastic)
+ # ------------------
+ # Stick
+ # ------------------
+ mystick = get_venetian_stick("Venetian_stick", mp.height * 0.6)
+ mystick.parent = mainobject
+ mystick.location.x = -mp.width / 2 + 0.03
+ mystick.location.y = -mp.depth / 2 - 0.003
+ mystick.location.z = -0.03
+ # materials
+ if mp.crt_mat:
+ matstick = create_diffuse_material("Stick_material", False, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.04)
+ set_material(mybase, matstick)
+
+ # ------------------
+ # Strings up/down
+ # ------------------
+ mystring = get_venetian_strings("Venetian_updown", mp.height * 0.75)
+ mystring.parent = mainobject
+ mystring.location.x = mp.width / 2 - 0.03
+ mystring.location.y = -mp.depth / 2 - 0.003
+ mystring.location.z = -0.03
+
+ if mp.crt_mat:
+ set_material(mystring, mat)
+ # deactivate others
+ for o in bpy.data.objects:
+ if o.select is True and o.name != mainobject.name:
+ o.select = False
+
+ return
+
+
+# ------------------------------------------------------------------
+# Define property group class to create or modify
+# ------------------------------------------------------------------
+class ObjectProperties(bpy.types.PropertyGroup):
+ width = bpy.props.FloatProperty(
+ name='Width',
+ min=0.30, max=4, default=1, precision=3,
+ description='Total width', update=update_object,
+ )
+ height = bpy.props.FloatProperty(
+ name='Height',
+ min=0.20, max=10, default=1.7, precision=3,
+ description='Total height',
+ update=update_object,
+ )
+ depth = bpy.props.FloatProperty(
+ name='Slat depth', min=0.02, max=0.30, default=0.04,
+ precision=3,
+ description='Slat depth', update=update_object,
+ )
+ angle = bpy.props.FloatProperty(
+ name='Angle', min=0, max=85, default=0, precision=1,
+ description='Angle of the slats', update=update_object,
+ )
+ ratio = bpy.props.IntProperty(
+ name='Extend', min=0, max=100, default=100,
+ description='% of extension (100 full extend)', update=update_object,
+ )
+
+ # Materials
+ crt_mat = bpy.props.BoolProperty(
+ name="Create default Cycles materials",
+ description="Create default materials for Cycles render",
+ default=True, update=update_object,
+ )
+ objcol = bpy.props.FloatVectorProperty(
+ name="Color",
+ description="Color for material",
+ default=(0.616, 0.435, 1.0, 1.0),
+ min=0.1, max=1,
+ subtype='COLOR',
+ size=4, update=update_object,
+ )
+
+# Register
+bpy.utils.register_class(ObjectProperties)
+bpy.types.Object.VenetianObjectGenerator = bpy.props.CollectionProperty(type=ObjectProperties)
+
+
+# ------------------------------------------------------------------
+# Define panel class to modify object
+# ------------------------------------------------------------------
+class AchmVenetianObjectgeneratorpanel(bpy.types.Panel):
+ bl_idname = "OBJECT_PT_venetian_generator"
+ bl_label = "Venetian"
+ bl_space_type = 'VIEW_3D'
+ bl_region_type = 'UI'
+ bl_category = 'Archimesh'
+
+ # -----------------------------------------------------
+ # Verify if visible
+ # -----------------------------------------------------
+ @classmethod
+ def poll(cls, context):
+ o = context.object
+ if o is None:
+ return False
+ if 'VenetianObjectGenerator' not in o:
+ return False
+ else:
+ return True
+
+# -----------------------------------------------------
+ # Draw (create UI interface)
+ # -----------------------------------------------------
+ def draw(self, context):
+ o = context.object
+ # noinspection PyBroadException
+ try:
+ if 'VenetianObjectGenerator' not in o:
+ return
+ except:
+ return
+
+ layout = self.layout
+ if bpy.context.mode == 'EDIT_MESH':
+ layout.label('Warning: Operator does not work in edit mode.', icon='ERROR')
+ else:
+ myobjdat = o.VenetianObjectGenerator[0]
+ space = bpy.context.space_data
+ if not space.local_view:
+ # Imperial units warning
+ if bpy.context.scene.unit_settings.system == "IMPERIAL":
+ row = layout.row()
+ row.label("Warning: Imperial units not supported", icon='COLOR_RED')
+
+ box = layout.box()
+ row = box.row()
+ row.prop(myobjdat, 'width')
+ row.prop(myobjdat, 'height')
+ row.prop(myobjdat, 'depth')
+ row = box.row()
+ row.prop(myobjdat, 'angle', slider=True)
+ row.prop(myobjdat, 'ratio', slider=True)
+
+ box = layout.box()
+ box.prop(myobjdat, 'crt_mat')
+ if myobjdat.crt_mat:
+ row = box.row()
+ row.prop(myobjdat, 'objcol')
+ else:
+ row = layout.row()
+ row.label("Warning: Operator does not work in local view mode", icon='ERROR')
+
+
+# ------------------------------------------------------------------------------
+# Create rectangular base
+#
+# x: size x axis
+# y: size y axis
+# z: size z axis
+# ------------------------------------------------------------------------------
+def create_venetian_top(mymesh, x, y, z):
+ myvertex = [(-x / 2, -y / 2, 0.0),
+ (-x / 2, y / 2, 0.0),
+ (x / 2, y / 2, 0.0),
+ (x / 2, -y / 2, 0.0),
+ (-x / 2, -y / 2, z),
+ (-x / 2, y / 2, z),
+ (x / 2, y / 2, z),
+ (x / 2, -y / 2, z)]
+
+ myfaces = [(0, 1, 2, 3), (0, 1, 5, 4), (1, 2, 6, 5), (2, 6, 7, 3), (5, 6, 7, 4), (0, 4, 7, 3)]
+
+ mymesh.from_pydata(myvertex, [], myfaces)
+ mymesh.update(calc_edges=True)
+
+ return
+
+
+# ------------------------------------------------------------
+# Create venetian slats
+#
+# width: total width of the slat
+# depth: depth of the slat
+# height: Total height (extended)
+# ratio: factor of extension 0-collapsed 100-extended
+# angle: angle
+# ------------------------------------------------------------
+def create_slat_mesh(objname, width, depth, height, angle, ratio):
+ # Vertex
+ v = 0
+ gap = 0.001
+ angleused = 0
+ myvertex = []
+ myfaces = []
+ mypoints = []
+ # Calculate total slats
+ separation = (depth * 0.75) # posZ is % of depth
+ numslats = int(height / separation)
+ collapsedslats = numslats - int((height * ((100 - ratio) / 100)) / separation)
+ # --------------------------------
+ # Generate slats
+ # --------------------------------
+ posz = 0
+ for x in range(numslats):
+ if x < collapsedslats:
+ angleused = angle
+ elif x == collapsedslats:
+ angleused = angle / 2
+ else:
+ angleused = 0
+ # if the slat is collapsed, the angle is 0
+
+ mydata = get_slat_data(v, angleused, width, depth, posz)
+ mypoints.extend([posz]) # saves all Z points
+ myvertex.extend(mydata[0])
+ myfaces.extend(mydata[1])
+ v = mydata[2]
+ if x < collapsedslats:
+ posz -= separation
+ else:
+ posz -= gap
+ # Transition to horizontal
+ if angleused == angle / 2:
+ sinheight = math.sin(math.radians(angle / 2)) * depth / 2
+ posz -= sinheight
+
+ mesh = bpy.data.meshes.new(objname)
+ myobject = bpy.data.objects.new(objname, mesh)
+
+ myobject.location = bpy.context.scene.cursor_location
+ bpy.context.scene.objects.link(myobject)
+
+ mesh.from_pydata(myvertex, [], myfaces)
+ mesh.update(calc_edges=True)
+
+ return myobject, mypoints, angleused
+
+
+# ------------------------------------------------------------
+# Generate slat data for venetian slat mesh
+#
+# v: last vertex index
+# angle: angle
+# width: total width of the slat
+# depth: depth of the slat
+# posZ: position in Z axis
+# ------------------------------------------------------------
+def get_slat_data(v, angle, width, depth, posz):
+ # ------------------------------------
+ # Mesh data
+ # ------------------------------------
+ maxx = width / 2
+ miny = -depth / 2
+ maxy = depth / 2
+ maxz = 0.0028
+ gap = 0.0025
+ radio = 0.00195
+ sinv = math.sin(math.atan(maxz / (maxy - gap)))
+ cos = math.cos(math.radians(angle))
+ sin = math.sin(math.radians(angle))
+
+ if width < 0.60:
+ sep = 0.06
+ else:
+ sep = 0.15
+
+ sep2 = sep - 0.005
+
+ # Vertex
+ myvertex = []
+
+ myvertex.extend(
+ [(maxx - 0.0017, (miny + 0.00195) * cos, posz + (-maxz + (radio * sinv)) + ((miny + 0.00195) * sin)),
+ (maxx - 0.0017, (maxy - 0.00195) * cos, posz + (-maxz + (radio * sinv)) + ((maxy - 0.00195) * sin)),
+ (maxx - 0.0045, miny * cos, posz + -maxz + (miny * sin)),
+ (maxx - 0.0045, maxy * cos, posz + -maxz + (maxy * sin)),
+ (maxx, -gap * cos, posz + (-gap * sin)),
+ (maxx, gap * cos, posz + (gap * sin)),
+ (maxx - 0.0045, -gap * cos, posz + (-gap * sin)),
+ (maxx - 0.0045, gap * cos, posz + (gap * sin)),
+ (0.001172, miny * cos, posz + -maxz + (miny * sin)),
+ (0.001172, maxy * cos, posz + -maxz + (maxy * sin)),
+ (0.001172, -gap * cos, posz + (-gap * sin)),
+ (0.001172, gap * cos, posz + (gap * sin)),
+ (maxx - sep, miny * cos, posz + -maxz + (miny * sin)),
+ (maxx - sep, maxy * cos, posz + -maxz + (maxy * sin)),
+ (maxx - sep, -gap * cos, posz + (-gap * sin)),
+ (maxx - sep, gap * cos, posz + (gap * sin)),
+ (maxx - sep2, miny * cos, posz + -maxz + (miny * sin)),
+ (maxx - sep2, maxy * cos, posz + -maxz + (maxy * sin)),
+ (maxx - sep2, -gap * cos, posz + (-gap * sin)),
+ (maxx - sep2, gap * cos, posz + (gap * sin))])
+
+ myvertex.extend(
+ [(-maxx + 0.0017, (miny + 0.00195) * cos, posz + (-maxz + (radio * sinv)) + ((miny + 0.00195) * sin)),
+ (-maxx + 0.0017, (maxy - 0.00195) * cos, posz + (-maxz + (radio * sinv)) + ((maxy - 0.00195) * sin)),
+ (-maxx + 0.0045, miny * cos, posz + -maxz + (miny * sin)),
+ (-maxx + 0.0045, maxy * cos, posz + -maxz + (maxy * sin)),
+ (-maxx, -gap * cos, posz + (-gap * sin)),
+ (-maxx, gap * cos, posz + (gap * sin)),
+ (-maxx + 0.0045, -gap * cos, posz + (-gap * sin)),
+ (-maxx + 0.0045, gap * cos, posz + (gap * sin)),
+ (-0.001172, miny * cos, posz + -maxz + (miny * sin)),
+ (-0.001172, maxy * cos, posz + -maxz + (maxy * sin)),
+ (-0.001172, -gap * cos, posz + (-gap * sin)),
+ (-0.001172, gap * cos, posz + (gap * sin)),
+ (-maxx + sep, miny * cos, posz + -maxz + (miny * sin)),
+ (-maxx + sep, maxy * cos, posz + -maxz + (maxy * sin)),
+ (-maxx + sep, -gap * cos, posz + (-gap * sin)),
+ (-maxx + sep, gap * cos, posz + (gap * sin)),
+ (-maxx + sep2, miny * cos, posz + -maxz + (miny * sin)),
+ (-maxx + sep2, maxy * cos, posz + -maxz + (maxy * sin)),
+ (-maxx + sep2, -gap * cos, posz + (-gap * sin)),
+ (-maxx + sep2, gap * cos, posz + (gap * sin))])
+
+ # Faces
+ myfaces = [(v + 7, v + 5, v + 1, v + 3), (v + 19, v + 7, v + 3, v + 17), (v + 2, v + 0, v + 4, v + 6),
+ (v + 6, v + 4, v + 5, v + 7), (v + 16, v + 2, v + 6, v + 18),
+ (v + 18, v + 6, v + 7, v + 19), (v + 11, v + 15, v + 13, v + 9), (v + 8, v + 12, v + 14, v + 10),
+ (v + 10, v + 14, v + 15, v + 11), (v + 15, v + 19, v + 17, v + 13),
+ (v + 12, v + 16, v + 18, v + 14), (v + 39, v + 35, v + 33, v + 37), (v + 34, v + 38, v + 36, v + 32),
+ (v + 27, v + 25, v + 21, v + 23), (v + 27, v + 26, v + 24, v + 25),
+ (v + 24, v + 26, v + 22, v + 20), (v + 39, v + 37, v + 23, v + 27), (v + 39, v + 27, v + 26, v + 38),
+ (v + 38, v + 26, v + 22, v + 36), (v + 30, v + 34, v + 32, v + 28),
+ (v + 34, v + 30, v + 31, v + 35), (v + 35, v + 31, v + 29, v + 33), (v + 11, v + 9, v + 29, v + 31),
+ (v + 8, v + 10, v + 30, v + 28)]
+
+ v += len(myvertex)
+
+ return myvertex, myfaces, v
+
+
+# ------------------------------------------------------------------------------
+# Create rectangular base
+#
+# objName: Object name
+# x: size x axis
+# y: size y axis
+# z: size z axis
+# ------------------------------------------------------------------------------
+def create_venetian_base(objname, x, y, z):
+ myvertex = [(-x / 2, -y / 2, 0.0),
+ (-x / 2, y / 2, 0.0),
+ (x / 2, y / 2, 0.0),
+ (x / 2, -y / 2, 0.0),
+ (-x / 2, -y / 2, z),
+ (-x / 2, y / 2, z),
+ (x / 2, y / 2, z),
+ (x / 2, -y / 2, z)]
+
+ myfaces = [(0, 1, 2, 3), (0, 1, 5, 4), (1, 2, 6, 5), (2, 6, 7, 3), (5, 6, 7, 4), (0, 4, 7, 3)]
+
+ mesh = bpy.data.meshes.new(objname)
+ myobject = bpy.data.objects.new(objname, mesh)
+
+ myobject.location = bpy.context.scene.cursor_location
+ bpy.context.scene.objects.link(myobject)
+
+ mesh.from_pydata(myvertex, [], myfaces)
+ mesh.update(calc_edges=True)
+
+ return myobject
+
+
+# ------------------------------------------------------------
+# Generate stick for venetian
+#
+# objName: Object name
+# height: height
+# ------------------------------------------------------------
+def get_venetian_stick(objname, height):
+ # ------------------------------------
+ # Mesh data
+ # ------------------------------------
+ minx = -0.005686083808541298
+ maxx = 0.005686083808541298
+ # minZ = -0.2236524224281311
+ minz = -height
+ maxz = 0
+
+ # Vertex
+ myvertex = [(minx + 0.0031912513077259064, -0.012805024161934853, maxz - 0.02722930908203125),
+ (minx + 0.0030460257548838854, -0.007894348353147507, maxz - 0.008386015892028809),
+ (minx + 0.003936204360798001, -0.014603500254452229, maxz - 0.02722930908203125),
+ (minx + 0.003812092007137835, -0.006685533560812473, maxz - 0.009785711765289307),
+ (maxx - 0.005637487949570641, -0.01534845307469368, maxz - 0.02722930908203125),
+ (minx + 0.005661540681103361, -0.006184821017086506, maxz - 0.010365545749664307),
+ (maxx - 0.0038390127010643482, -0.014603500254452229, maxz - 0.02722930908203125),
+ (maxx - 0.0038611787604168057, -0.006685533560812473, maxz - 0.009785711765289307),
+ (maxx - 0.0030940594151616096, -0.012805024161934853, maxz - 0.02722930908203125),
+ (maxx - 0.0030951115768402815, -0.007894348353147507, maxz - 0.008386015892028809),
+ (maxx - 0.0038390120025724173, -0.011006549000740051, maxz - 0.02722930908203125),
+ (maxx - 0.0038611781783401966, -0.009103144519031048, maxz - 0.0069863200187683105),
+ (maxx - 0.005637487425701693, -0.010261595249176025, maxz - 0.02722930908203125),
+ (minx + 0.005661541004883475, -0.00960385799407959, maxz - 0.0064064860343933105),
+ (minx + 0.003936204593628645, -0.011006549000740051, maxz - 0.02722930908203125),
+ (minx + 0.003812092822045088, -0.009103145450353622, maxz - 0.0069863200187683105),
+ (minx + 0.004708557506091893, -0.0009992714039981365, maxz - 0.002431390807032585),
+ (minx + 0.004987679829355329, -0.0009992715204134583, maxz - 0.0031052385456860065),
+ (minx + 0.005661541195877362, -0.0009992715204134583, maxz - 0.0033843691926449537),
+ (maxx - 0.00503676530206576, -0.0009992715204134583, maxz - 0.0031052385456860065),
+ (maxx - 0.004757642629556358, -0.0009992716368287802, maxz - 0.002431390807032585),
+ (maxx - 0.005036764952819794, -0.0009992715204134583, maxz - 0.0017575474921613932),
+ (minx + 0.005661541457811836, -0.0009992715204134583, maxz - 0.0014784171944484115),
+ (minx + 0.004987680295016617, -0.0009992715204134583, maxz - 0.0017575474921613932),
+ (minx + 0.0038341645849868655, -0.010904508642852306, maxz - 0.015928268432617188),
+ (maxx - 0.005637487367494032, -0.01011728961020708, maxz - 0.015928268432617188),
+ (maxx - 0.003736971877515316, -0.010904508642852306, maxz - 0.015928268432617188),
+ (maxx - 0.002949752612039447, -0.012805024161934853, maxz - 0.015928268432617188),
+ (maxx - 0.0037369721103459597, -0.014705540612339973, maxz - 0.015928268432617188),
+ (maxx - 0.00563748789136298, -0.015492759644985199, maxz - 0.015928268432617188),
+ (minx + 0.0038341644685715437, -0.014705540612339973, maxz - 0.015928268432617188),
+ (minx + 0.003046944970265031, -0.012805024161934853, maxz - 0.015928268432617188),
+ (minx + 0.0043586865067481995, -0.012638782151043415, maxz - 0.013130486011505127),
+ (minx + 0.004740283475257456, -0.0120366420596838, maxz - 0.013827741146087646),
+ (minx + 0.0056615397916175425, -0.011787224560976028, maxz - 0.014116525650024414),
+ (maxx - 0.004789371509104967, -0.0120366420596838, maxz - 0.013827741146087646),
+ (maxx - 0.0044077744241803885, -0.012638782151043415, maxz - 0.013130486011505127),
+ (maxx - 0.0047893712762743235, -0.013240913860499859, maxz - 0.012433230876922607),
+ (minx + 0.005661539897118928, -0.01349033135920763, maxz - 0.01214444637298584),
+ (minx + 0.004740283824503422, -0.013240914791822433, maxz - 0.012433230876922607),
+ (minx + 0.005661537383275572, -0.012638770043849945, maxz - 0.017504926770925522),
+ (maxx - 0.0039202586049214005, -0.010174507275223732, maxz - 0.015622403472661972),
+ (maxx - 0.0028137227054685354, -0.013580016791820526, maxz - 0.015622403472661972),
+ (minx + 0.005661537154082907, -0.015684761106967926, maxz - 0.015622403472661972),
+ (minx + 0.0027646280359476805, -0.013580016791820526, maxz - 0.015622403472661972),
+ (minx + 0.003871166962198913, -0.010174507275223732, maxz - 0.015622403472661972),
+ (maxx - 0.0028137224726378918, -0.011697524227201939, maxz - 0.01257637981325388),
+ (maxx - 0.003920258954167366, -0.015103034675121307, maxz - 0.01257637981325388),
+ (minx + 0.0038711666129529476, -0.015103034675121307, maxz - 0.01257637981325388),
+ (minx + 0.002764628268778324, -0.011697524227201939, maxz - 0.01257637981325388),
+ (minx + 0.0056615376142872265, -0.00959277804940939, maxz - 0.01257637981325388),
+ (minx + 0.005661537383275572, -0.012638770043849945, maxz - 0.010693902149796486),
+ (maxx - 0.004007883137091994, -0.013192017562687397, maxz - 0.016996320337057114),
+ (maxx - 0.004658283665776253, -0.011190323159098625, maxz - 0.016996320337057114),
+ (maxx - 0.002955520059913397, -0.011743564158678055, maxz - 0.015889829024672508),
+ (minx + 0.00566153760337329, -0.009741866029798985, maxz - 0.015889829024672508),
+ (minx + 0.0046091912081465125, -0.011190323159098625, maxz - 0.016996320337057114),
+ (minx + 0.005661537248670356, -0.014429156668484211, maxz - 0.016996320337057114),
+ (maxx - 0.004007878364063799, -0.014982416294515133, maxz - 0.015889829024672508),
+ (minx + 0.003958789980970323, -0.013192017562687397, maxz - 0.016996320337057114),
+ (minx + 0.00395878404378891, -0.014982416294515133, maxz - 0.015889829024672508),
+ (minx + 0.002906427951529622, -0.011743564158678055, maxz - 0.015889829024672508),
+ (maxx - 0.004658278776332736, -0.009399918839335442, maxz - 0.014099414460361004),
+ (minx + 0.004609186435118318, -0.009399918839335442, maxz - 0.014099414460361004),
+ (maxx - 0.0023051041644066572, -0.012638770043849945, maxz - 0.014099414460361004),
+ (maxx - 0.0029555035289376974, -0.010637051425874233, maxz - 0.014099414460361004),
+ (maxx - 0.004658279241994023, -0.015877623111009598, maxz - 0.014099414460361004),
+ (maxx - 0.0029555039945989847, -0.014640489593148232, maxz - 0.014099414460361004),
+ (minx + 0.0029064100235700607, -0.014640489593148232, maxz - 0.014099414460361004),
+ (minx + 0.00460918596945703, -0.015877623111009598, maxz - 0.014099414460361004),
+ (minx + 0.002906410489231348, -0.010637051425874233, maxz - 0.014099414460361004),
+ (minx + 0.0022560113575309515, -0.012638770043849945, maxz - 0.014099414460361004),
+ (maxx - 0.004007878014817834, -0.010295123793184757, maxz - 0.012308954261243343),
+ (maxx - 0.002955520059913397, -0.013533977791666985, maxz - 0.012308954261243343),
+ (minx + 0.005661537164996844, -0.015535674057900906, maxz - 0.012308954261243343),
+ (minx + 0.0029064277186989784, -0.013533977791666985, maxz - 0.012308954261243343),
+ (minx + 0.003958784393034875, -0.010295123793184757, maxz - 0.012308954261243343),
+ (maxx - 0.004007883137091994, -0.012085524387657642, maxz - 0.011202462017536163),
+ (minx + 0.0056615375196997775, -0.01084838341921568, maxz - 0.011202462017536163),
+ (maxx - 0.004658283898606896, -0.01408721785992384, maxz - 0.011202462017536163),
+ (minx + 0.004609190975315869, -0.01408721785992384, maxz - 0.011202462017536163),
+ (minx + 0.003958789980970323, -0.012085524387657642, maxz - 0.011202462017536163),
+ (minx + 0.003936204593628645, -0.011006549000740051, minz),
+ (maxx - 0.005637487425701693, -0.010261595249176025, minz),
+ (maxx - 0.0038390120025724173, -0.011006549000740051, minz),
+ (maxx - 0.0030940594151616096, -0.012805024161934853, minz),
+ (maxx - 0.0038390127010643482, -0.014603500254452229, minz),
+ (maxx - 0.005637487949570641, -0.01534845307469368, minz),
+ (minx + 0.003936204360798001, -0.014603500254452229, minz),
+ (minx + 0.0031912513077259064, -0.012805024161934853, minz),
+ (minx, -0.001379312016069889, maxz - 0.005334946792572737),
+ (minx, -4.6566128730773926e-09, maxz - 0.005334946792572737),
+ (maxx, -4.6566128730773926e-09, maxz - 0.005334946792572737),
+ (maxx, -0.001379312016069889, maxz - 0.005334946792572737),
+ (minx, -0.001379312016069889, maxz - 1.5133991837501526e-08),
+ (minx, -4.6566128730773926e-09, maxz - 1.5133991837501526e-08),
+ (maxx, -4.6566128730773926e-09, maxz - 1.5133991837501526e-08),
+ (maxx, -0.001379312016069889, maxz - 1.5133991837501526e-08),
+ (minx + 0.0009754756465554237, -0.001379312016069889, maxz - 0.00447732862085104),
+ (minx + 0.0009754756465554237, -0.001379312016069889, maxz - 0.0008576327236369252),
+ (maxx - 0.0009754756465554237, -0.001379312016069889, maxz - 0.0008576327236369252),
+ (maxx - 0.0009754756465554237, -0.001379312016069889, maxz - 0.00447732862085104),
+ (minx + 0.0009754756465554237, -0.0007799165323376656, maxz - 0.00447732862085104),
+ (minx + 0.0009754756465554237, -0.0007799165323376656, maxz - 0.0008576327236369252),
+ (maxx - 0.0009754756465554237, -0.0007799165323376656, maxz - 0.0008576327236369252),
+ (maxx - 0.0009754756465554237, -0.0007799165323376656, maxz - 0.00447732862085104)]
+
+ # Faces
+ myfaces = [(1, 15, 23, 16), (17, 16, 23, 22, 21, 20, 19, 18),
+ (15, 13, 22, 23), (13, 11, 21, 22), (11, 9, 20, 21),
+ (9, 7, 19, 20), (7, 5, 18, 19), (5, 3, 17, 18), (3, 1, 16, 17), (0, 31, 24, 14),
+ (14, 24, 25, 12), (12, 25, 26, 10), (10, 26, 27, 8), (8, 27, 28, 6), (6, 28, 29, 4),
+ (2, 30, 31, 0), (4, 29, 30, 2), (15, 1, 32, 39), (13, 15, 39, 38), (11, 13, 38, 37),
+ (9, 11, 37, 36), (7, 9, 36, 35), (5, 7, 35, 34), (3, 5, 34, 33), (1, 3, 33, 32),
+ (40, 53, 52), (41, 53, 55), (40, 52, 57), (40, 57, 59), (40, 59, 56),
+ (41, 55, 62), (42, 54, 64), (43, 58, 66), (44, 60, 68), (45, 61, 70),
+ (41, 62, 65), (42, 64, 67), (43, 66, 69), (44, 68, 71), (45, 70, 63),
+ (46, 72, 77), (47, 73, 79), (48, 74, 80), (49, 75, 81), (50, 76, 78),
+ (52, 54, 42), (52, 53, 54), (53, 41, 54), (55, 56, 45), (55, 53, 56),
+ (53, 40, 56), (57, 58, 43), (57, 52, 58), (52, 42, 58), (59, 60, 44),
+ (59, 57, 60), (57, 43, 60), (56, 61, 45), (56, 59, 61), (59, 44, 61),
+ (62, 63, 50), (62, 55, 63), (55, 45, 63), (64, 65, 46), (64, 54, 65),
+ (54, 41, 65), (66, 67, 47), (66, 58, 67), (58, 42, 67), (68, 69, 48),
+ (68, 60, 69), (60, 43, 69), (70, 71, 49), (70, 61, 71), (61, 44, 71),
+ (65, 72, 46), (65, 62, 72), (62, 50, 72), (67, 73, 47), (67, 64, 73),
+ (64, 46, 73), (69, 74, 48), (69, 66, 74), (66, 47, 74), (71, 75, 49),
+ (71, 68, 75), (68, 48, 75), (63, 76, 50), (63, 70, 76), (70, 49, 76),
+ (77, 78, 51), (77, 72, 78), (72, 50, 78), (79, 77, 51), (79, 73, 77),
+ (73, 46, 77), (80, 79, 51), (80, 74, 79), (74, 47, 79), (81, 80, 51),
+ (81, 75, 80), (75, 48, 80), (78, 81, 51), (78, 76, 81), (76, 49, 81),
+ (87, 4, 2, 88), (88, 2, 0, 89), (86, 6, 4, 87), (85, 8, 6, 86), (84, 10, 8, 85),
+ (83, 12, 10, 84), (82, 14, 12, 83), (89, 0, 14, 82), (94, 95, 91, 90), (95, 96, 92, 91),
+ (96, 97, 93, 92), (98, 101, 105, 102), (90, 91, 92, 93), (97, 96, 95, 94), (98, 99, 94, 90),
+ (100, 101, 93, 97), (99, 100, 97, 94), (101, 98, 90, 93), (104, 103, 102, 105), (100, 99, 103, 104),
+ (101, 100, 104, 105), (99, 98, 102, 103)]
+
+ mesh = bpy.data.meshes.new(objname)
+ myobject = bpy.data.objects.new(objname, mesh)
+
+ myobject.location = bpy.context.scene.cursor_location
+ bpy.context.scene.objects.link(myobject)
+
+ mesh.from_pydata(myvertex, [], myfaces)
+ mesh.update(calc_edges=True)
+
+ return myobject
+
+
+# ------------------------------------------------------------
+# Generate strings for venetian
+#
+# objName: Object name
+# height: height
+# ------------------------------------------------------------
+def get_venetian_strings(objname, height):
+ # ------------------------------------
+ # Mesh data
+ # ------------------------------------
+ minx = -0.006897219456732273
+ maxx = 0.006897197104990482
+ maxy = 1.57160684466362e-08
+ minz = -height
+ maxz = 0
+
+ # Vertex
+ myvertex = [(maxx - 0.004941887455061078, -0.005041633266955614, minz + 3.1925737857818604e-05),
+ (maxx - 0.005070153623819351, -0.004731120076030493, minz + 4.9524009227752686e-05),
+ (maxx - 0.005380495102144778, -0.004602177534252405, minz + 5.389750003814697e-05),
+ (maxx - 0.005691118887625635, -0.00473033869639039, minz + 4.2498111724853516e-05),
+ (maxx - 0.005820065038278699, -0.005040528252720833, minz + 2.1979212760925293e-05),
+ (maxx - 0.005691798985935748, -0.005351040977984667, minz + 4.380941390991211e-06),
+ (maxx - 0.005381457391194999, -0.0054799835197627544, minz),
+ (maxx - 0.005070833722129464, -0.005351822357624769, minz + 1.1406838893890381e-05),
+ (maxx - 0.005004765349440277, -0.005394590552896261, minz + 0.029493853449821472),
+ (maxx - 0.005133012658916414, -0.005083992145955563, minz + 0.02950144186615944),
+ (maxx - 0.005443348782137036, -0.004955026786774397, minz + 0.029502809047698975),
+ (maxx - 0.005753983394242823, -0.005083239171653986, minz + 0.02949715033173561),
+ (maxx - 0.0058829509653151035, -0.005393524654209614, minz + 0.02948778122663498),
+ (maxx - 0.005754703655838966, -0.005704122595489025, minz + 0.029480192810297012),
+ (maxx - 0.005444367183372378, -0.005833088420331478, minz + 0.029478825628757477),
+ (maxx - 0.005133732687681913, -0.005704876501113176, minz + 0.02948448434472084),
+ (maxx - 0.005029367166571319, -0.005440863780677319, maxz - 0.029401594772934914),
+ (maxx - 0.005157589330337942, -0.005130413919687271, maxz - 0.029417745769023895),
+ (maxx - 0.005467916373163462, -0.005001509562134743, maxz - 0.029425399377942085),
+ (maxx - 0.005778562976047397, -0.0051296609453856945, maxz - 0.029420070350170135),
+ (maxx - 0.005907556158490479, -0.00543979974463582, maxz - 0.029404880478978157),
+ (maxx - 0.005779333529062569, -0.005750249605625868, maxz - 0.029388729482889175),
+ (maxx - 0.005469006602652371, -0.005879154894500971, maxz - 0.029381075873970985),
+ (maxx - 0.005158359999768436, -0.0057510025799274445, maxz - 0.029386404901742935),
+ (maxx - 0.00503770902287215, -0.005161902867257595, maxz - 0.015295670367777348),
+ (maxx - 0.00516585458535701, -0.004854197148233652, maxz - 0.015373632311820984),
+ (maxx - 0.005476148682646453, -0.00472648162394762, maxz - 0.01540757529437542),
+ (maxx - 0.0057868254370987415, -0.004853568039834499, maxz - 0.015377615578472614),
+ (maxx - 0.005915894289501011, -0.005161012522876263, maxz - 0.015301303938031197),
+ (maxx - 0.0057877483777701855, -0.005468717776238918, maxz - 0.015223342925310135),
+ (maxx - 0.005477453931234777, -0.005596434231847525, maxz - 0.01518939808011055),
+ (maxx - 0.005166777293197811, -0.005469346884638071, maxz - 0.01521935872733593),
+ (maxx - 0.0050518905045464635, -0.004537198692560196, maxz - 0.007016266230493784),
+ (maxx - 0.0051788275595754385, -0.004260011948645115, maxz - 0.007274628151208162),
+ (maxx - 0.005488568218424916, -0.004146246705204248, maxz - 0.007390326354652643),
+ (maxx - 0.005799670936539769, -0.004262544680386782, maxz - 0.007295588497072458),
+ (maxx - 0.005929895443841815, -0.004540780559182167, maxz - 0.007045908365398645),
+ (maxx - 0.0058029580395668745, -0.004817967768758535, maxz - 0.006787544582039118),
+ (maxx - 0.005493217264302075, -0.004931733012199402, maxz - 0.006671848241239786),
+ (maxx - 0.005182114546187222, -0.004815434105694294, maxz - 0.006766586098819971),
+ (maxx - 0.005094519350677729, -0.0035386907402426004, maxz - 0.003334574867039919),
+ (maxx - 0.005213141208514571, -0.0034136706963181496, maxz - 0.0038649537600576878),
+ (maxx - 0.005518985213711858, -0.003371135564520955, maxz - 0.004107045475393534),
+ (maxx - 0.0058328923769295216, -0.0034360019490122795, maxz - 0.003919033799320459),
+ (maxx - 0.005970980157144368, -0.003570271423086524, maxz - 0.003411055076867342),
+ (maxx - 0.005852358415722847, -0.003695291467010975, maxz - 0.002880676183849573),
+ (maxx - 0.005546514177694917, -0.0037378265988081694, maxz - 0.002638584468513727),
+ (maxx - 0.005232607247307897, -0.003672960214316845, maxz - 0.0028265961445868015),
+ (maxx - 0.005944175529293716, -0.0036394987255334854, maxz - 0.003126396331936121),
+ (maxx - 0.005875613423995674, -0.00560829509049654, maxz - 0.02939625270664692),
+ (maxx - 0.005034194211475551, -0.005343204364180565, maxz - 0.021542727947235107),
+ (maxx - 0.005612890352495015, -0.00580073706805706, minz + 0.029478538781404495),
+ (maxx - 0.0052128632087260485, -0.005448057781904936, minz + 3.8817524909973145e-06),
+ (maxx - 0.005320212687365711, -0.004174317233264446, maxz - 0.007358333561569452),
+ (maxx - 0.005857669049873948, -0.005254213232547045, minz + 0.01586836576461792),
+ (maxx - 0.005270682042464614, -0.002958775730803609, maxz - 0.0018540903693065047),
+ (maxx - 0.004973854636773467, -0.004873105324804783, minz + 4.190206527709961e-05),
+ (maxx - 0.005896858056075871, -0.0043898820877075195, maxz - 0.007182727102190256),
+ (maxx - 0.005644757067784667, -0.004758160561323166, maxz - 0.015400669537484646),
+ (maxx - 0.0050204748986288905, -0.0054572150111198425, maxz - 0.03902619704604149),
+ (maxx - 0.005107744364067912, -0.004944739863276482, minz + 0.01588994264602661),
+ (maxx - 0.005821454804390669, -0.004324669484049082, maxz - 0.004334418568760157),
+ (maxx - 0.0058509946102276444, -0.00556210009381175, minz + 0.029483404010534286),
+ (maxx - 0.004974223440513015, -0.005210080184042454, minz + 2.121180295944214e-05),
+ (maxx - 0.005512951058335602, -0.004414208233356476, maxz - 0.004156060982495546),
+ (maxx - 0.005657264497131109, -0.004175691865384579, maxz - 0.007369710598140955),
+ (maxx - 0.005083143012598157, -0.004386562388390303, maxz - 0.007155258674174547),
+ (maxx - 0.005898642586544156, -0.004691417329013348, maxz - 0.006906915921717882),
+ (maxx - 0.005482866894453764, -0.005316956900060177, maxz - 0.010308705270290375),
+ (maxx - 0.005200946354307234, -0.004315671045333147, maxz - 0.004297847393900156),
+ (maxx - 0.005883492063730955, -0.004994065500795841, maxz - 0.015342974103987217),
+ (maxx - 0.0055490892846137285, -0.004634103272110224, minz + 5.002319812774658e-05),
+ (maxx - 0.005586991785094142, -0.002982017118483782, maxz - 0.0016202632104977965),
+ (maxx - 0.005500998347997665, -0.0037720794789493084, maxz - 0.005249096546322107),
+ (maxx - 0.0056365174241364, -0.005033436696976423, maxz - 0.029424406588077545),
+ (maxx - 0.0051623902982100844, -0.0050335354171693325, maxz - 0.021582692861557007),
+ (maxx - 0.005850603571161628, -0.005225026980042458, minz + 0.029492609202861786),
+ (maxx - 0.005787728703580797, -0.0048720804043114185, minz + 3.269314765930176e-05),
+ (maxx - 0.005192494718357921, -0.003861617762595415, maxz - 0.005070738960057497),
+ (maxx - 0.005163213470950723, -0.005652572028338909, maxz - 0.021503763273358345),
+ (maxx - 0.005460095009766519, -0.005895696114748716, maxz - 0.039026711136102676),
+ (maxx - 0.005661572678945959, -0.004903662484139204, maxz - 0.006703841034322977),
+ (maxx - 0.005856060888618231, -0.002980045508593321, maxz - 0.003230756614357233),
+ (maxx - 0.005036721588112414, -0.005226014647632837, minz + 0.029498230665922165),
+ (maxx - 0.005933607462793589, -0.0034987321123480797, maxz - 0.0036901147104799747),
+ (maxx - 0.005068209487944841, -0.0040867808274924755, maxz - 0.004676718730479479),
+ (maxx - 0.005645966622978449, -0.005564413033425808, maxz - 0.015198467299342155),
+ (maxx - 0.005149454576894641, -0.005767486989498138, maxz - 0.03902563825249672),
+ (maxx - 0.0050617282977327704, -0.005609281826764345, maxz - 0.029393207281827927),
+ (maxx - 0.005539751029573381, -0.0029568036552518606, maxz - 0.0034645837731659412),
+ (maxx - 0.005688222707249224, -0.003390622790902853, maxz - 0.00406796345487237),
+ (maxx - 0.005419071996584535, -0.005693721119314432, minz + 0.0158514603972435),
+ (maxx - 0.005788097972981632, -0.005209055729210377, minz + 1.1995434761047363e-05),
+ (maxx - 0.005069609847851098, -0.004994889721274376, maxz - 0.015337754040956497),
+ (maxx - 0.005299395183101296, -0.0050338455475866795, maxz - 0.029423145577311516),
+ (maxx - 0.005729411728680134, -0.005564768332988024, minz + 0.015854761004447937),
+ (maxx - 0.005889465333893895, -0.002997873816639185, maxz - 0.0019266236340627074),
+ (maxx - 0.00523727759718895, -0.002940947189927101, maxz - 0.0031582233496010303),
+ (maxx - 0.005883992882445455, -0.0053280252031981945, maxz - 0.015259221196174622),
+ (maxx - 0.005637527909129858, -0.0058468179777264595, maxz - 0.029383329674601555),
+ (maxx - 0.0060009173466823995, -0.002997057046741247, maxz - 0.0025937133468687534),
+ (maxx - 0.00581300281919539, -0.0038706157356500626, maxz - 0.005107311997562647),
+ (maxx - 0.005784186767414212, -0.005651846993714571, maxz - 0.02150617726147175),
+ (maxx - 0.005061309668235481, -0.005272367969155312, maxz - 0.02941022254526615),
+ (maxx - 0.00535176380071789, -0.0033784990664571524, maxz - 0.004038602579385042),
+ (maxx - 0.005131891928613186, -0.0036102300509810448, maxz - 0.0030555170960724354),
+ (maxx - 0.0059457405004650354, -0.004099506419152021, maxz - 0.004728438798338175),
+ (maxx - 0.005791432806290686, -0.004595593549311161, maxz - 0.010660232976078987),
+ (maxx - 0.005473870667628944, -0.005780417006462812, maxz - 0.021488623693585396),
+ (maxx - 0.005108443321660161, -0.005565532948821783, minz + 0.01586039364337921),
+ (maxx - 0.005042683565989137, -0.00489416578784585, maxz - 0.01050524227321148),
+ (maxx - 0.0053004054352641106, -0.005847226828336716, maxz - 0.029382066801190376),
+ (maxx - 0.005324521102011204, -0.004902287386357784, maxz - 0.006692463997751474),
+ (maxx - 0.0053076359909027815, -0.00475850235670805, maxz - 0.015398506075143814),
+ (maxx - 0.005770427291281521, -0.005766738206148148, maxz - 0.03902877867221832),
+ (maxx - 0.005377276800572872, -0.0037183398380875587, maxz - 0.0026776683516800404),
+ (maxx - 0.005898662726394832, -0.005456155631691217, maxz - 0.03903063386678696),
+ (maxx - 0.005084927543066442, -0.004688097629696131, maxz - 0.006879445631057024),
+ (maxx - 0.005037112743593752, -0.0055630882270634174, minz + 0.029489029198884964),
+ (maxx - 0.0050701110158115625, -0.0053288498893380165, maxz - 0.015254000201821327),
+ (maxx - 0.005418083746917546, -0.004815786611288786, minz + 0.01589323580265045),
+ (maxx - 0.005308845662511885, -0.0055647543631494045, maxz - 0.015196305699646473),
+ (maxx - 0.0054806380067020655, -0.0044716945849359035, maxz - 0.010715048760175705),
+ (maxx - 0.005459042498841882, -0.005017674993723631, maxz - 0.03903011977672577),
+ (maxx - 0.00571373593993485, -0.0037304633297026157, maxz - 0.0027070273645222187),
+ (maxx - 0.005125825526192784, -0.0029417641926556826, maxz - 0.002491133753210306),
+ (maxx - 0.005783363711088896, -0.005032809916883707, maxz - 0.02158510498702526),
+ (maxx - 0.005121324211359024, -0.003469463437795639, maxz - 0.00361923361197114),
+ (maxx - 0.005170495598576963, -0.0045953672379255295, maxz - 0.010650848969817162),
+ (maxx - 0.005611946457065642, -0.004986968822777271, minz + 0.02950076386332512),
+ (maxx - 0.005769683048129082, -0.005145883187651634, maxz - 0.03903118893504143),
+ (maxx - 0.004979487042874098, -0.005255294498056173, minz + 0.01587633788585663),
+ (maxx - 0.005172071512788534, -0.005193057470023632, maxz - 0.010363521054387093),
+ (maxx - 0.005793009069748223, -0.005193284247070551, maxz - 0.010372905060648918),
+ (maxx - 0.005875195027329028, -0.005271381698548794, maxz - 0.029413267970085144),
+ (maxx - 0.005472706281580031, -0.004904965870082378, maxz - 0.02160024456679821),
+ (maxx - 0.0052757697412744164, -0.0058011459186673164, minz + 0.029480870813131332),
+ (maxx - 0.0057287130039185286, -0.004943975247442722, minz + 0.01588430255651474),
+ (maxx - 0.0051487102173268795, -0.0051466329023242, maxz - 0.03902805224061012),
+ (maxx - 0.005920821567997336, -0.004894486162811518, maxz - 0.0105185117572546),
+ (maxx - 0.005912382970564067, -0.005342178046703339, maxz - 0.021546142175793648),
+ (maxx - 0.005211971350945532, -0.004634527489542961, minz + 5.383789539337158e-05),
+ (maxx - 0.005274825729429722, -0.004987378139048815, minz + 0.029503092169761658),
+ (maxx - 0.005549981025978923, -0.0054476335644721985, minz + 6.705522537231445e-08),
+ (maxx - 0.005011449102312326, -0.005086742807179689, minz + 0.01588405668735504),
+ (maxx - 0.005249560461379588, -0.004848137032240629, minz + 0.01589324325323105),
+ (maxx - 0.005586679908446968, -0.004847722128033638, minz + 0.015890181064605713),
+ (maxx - 0.005825327709317207, -0.005085740704089403, minz + 0.01587667316198349),
+ (maxx - 0.005825707106851041, -0.005422765389084816, minz + 0.015860632061958313),
+ (maxx - 0.005587595398537815, -0.005661370232701302, minz + 0.0158514603972435),
+ (maxx - 0.005250476184301078, -0.005661786068230867, minz + 0.015854522585868835),
+ (maxx - 0.005011828150600195, -0.005423767026513815, minz + 0.01586802303791046),
+ (maxx - 0.0050524246180430055, -0.00528864748775959, maxz - 0.03902701288461685),
+ (maxx - 0.005290519911795855, -0.005050024017691612, maxz - 0.03902914375066757),
+ (maxx - 0.005627641920000315, -0.005049617029726505, maxz - 0.03903084620833397),
+ (maxx - 0.005866308696568012, -0.005287665408104658, maxz - 0.03903112933039665),
+ (maxx - 0.005866712890565395, -0.005624723620712757, maxz - 0.039029818028211594),
+ (maxx - 0.005628617363981903, -0.005863346625119448, maxz - 0.03902768716216087),
+ (maxx - 0.0052914953557774425, -0.005863754078745842, maxz - 0.03902598097920418),
+ (maxx - 0.005052828579209745, -0.005625705700367689, maxz - 0.03902570158243179),
+ (maxx - 0.005066122743301094, -0.005175130441784859, maxz - 0.02156427875161171),
+ (maxx - 0.005304188118316233, -0.004937214311212301, maxz - 0.021595504134893417),
+ (maxx - 0.0056413100101053715, -0.004936820361763239, maxz - 0.021596813574433327),
+ (maxx - 0.005880007753148675, -0.005174180027097464, maxz - 0.021567441523075104),
+ (maxx - 0.005880454205907881, -0.005510250572115183, maxz - 0.021524591371417046),
+ (maxx - 0.0056423889473080635, -0.005748167168349028, maxz - 0.021493365988135338),
+ (maxx - 0.005305267055518925, -0.005748561583459377, maxz - 0.02149205468595028),
+ (maxx - 0.005066569661721587, -0.005511201918125153, maxz - 0.02152142859995365),
+ (maxx - 0.005074405577033758, -0.004731936380267143, maxz - 0.010583722963929176),
+ (maxx - 0.005312168272212148, -0.004502579569816589, maxz - 0.01069762371480465),
+ (maxx - 0.005649270839057863, -0.004502702970057726, maxz - 0.010702718049287796),
+ (maxx - 0.0058882435550913215, -0.004732233472168446, maxz - 0.010596020147204399),
+ (maxx - 0.005889098974876106, -0.0050567155703902245, maxz - 0.010440031066536903),
+ (maxx - 0.005651336396113038, -0.005286071915179491, maxz - 0.010326128453016281),
+ (maxx - 0.005314233829267323, -0.005285948980599642, maxz - 0.010321034118533134),
+ (maxx - 0.0050752609968185425, -0.005056418012827635, maxz - 0.01042773388326168),
+ (maxx - 0.005098042776808143, -0.003963995724916458, maxz - 0.004888410214334726),
+ (maxx - 0.005333001143299043, -0.0037931459955871105, maxz - 0.005199151579290628),
+ (maxx - 0.005669870879501104, -0.003798031248152256, maxz - 0.0052190073765814304),
+ (maxx - 0.005911318236030638, -0.003975789062678814, maxz - 0.004936345387250185),
+ (maxx - 0.005915906862355769, -0.004222291521728039, maxz - 0.004516747314482927),
+ (maxx - 0.0056809482630342245, -0.004393140785396099, maxz - 0.004206005949527025),
+ (maxx - 0.0053440784104168415, -0.004388255998492241, maxz - 0.0041861520148813725),
+ (maxx - 0.005102631403133273, -0.004210498183965683, maxz - 0.004468812141567469),
+ (maxx - 0.005148796364665031, -0.0029389490373432636, maxz - 0.002848892007023096),
+ (maxx - 0.005373513558879495, -0.0029471139423549175, maxz - 0.0033773710019886494),
+ (maxx - 0.005709447083063424, -0.0029683399479836226, maxz - 0.003416749183088541),
+ (maxx - 0.005959811387583613, -0.002990193199366331, maxz - 0.002943959552794695),
+ (maxx - 0.0059779464500024915, -0.002999872202053666, maxz - 0.0022359550930559635),
+ (maxx - 0.005753229022957385, -0.0029917070642113686, maxz - 0.0017074759816750884),
+ (maxx - 0.005417295498773456, -0.0029704810585826635, maxz - 0.0016680978005751967),
+ (maxx - 0.0051669314270839095, -0.002948627807199955, maxz - 0.0021408875472843647),
+ (minx + 0.006793352426029742, -0.005108049139380455, minz + 0.00023909658193588257),
+ (minx + 0.0066346460953354836, -0.004723844584077597, minz + 0.00025669485330581665),
+ (minx + 0.006250653299503028, -0.004564301110804081, minz + 0.00026106834411621094),
+ (minx + 0.00586631172336638, -0.0047228774055838585, minz + 0.0002496689558029175),
+ (minx + 0.005706763477064669, -0.005106681492179632, minz + 0.00022915005683898926),
+ (minx + 0.005865469924174249, -0.005490886978805065, minz + 0.00021155178546905518),
+ (minx + 0.006249462720006704, -0.005650430452078581, minz + 0.00020717084407806396),
+ (minx + 0.006633804412558675, -0.005491853225976229, minz + 0.00021857768297195435),
+ (minx + 0.006715552299283445, -0.005544771905988455, minz + 0.029701028019189835),
+ (minx + 0.00655686913523823, -0.005160461645573378, minz + 0.0297086164355278),
+ (minx + 0.006172882916871458, -0.005000889301300049, minz + 0.029709983617067337),
+ (minx + 0.005788527661934495, -0.0051595289260149, minz + 0.029704324901103973),
+ (minx + 0.005628953338600695, -0.005543452687561512, minz + 0.02969495579600334),
+ (minx + 0.005787636619061232, -0.005927762482315302, minz + 0.029687367379665375),
+ (minx + 0.0061716228374280035, -0.006087335292249918, minz + 0.02968600019812584),
+ (minx + 0.006555978092364967, -0.005928694736212492, minz + 0.029691658914089203),
+ (minx + 0.006685112020932138, -0.005602027289569378, maxz - 0.0291944220662117),
+ (minx + 0.006526459823362529, -0.005217899568378925, maxz - 0.029210573062300682),
+ (minx + 0.0061424848972819746, -0.005058403126895428, maxz - 0.029218226671218872),
+ (minx + 0.005758114974014461, -0.00521696824580431, maxz - 0.029212897643446922),
+ (minx + 0.005598508752882481, -0.005600709468126297, maxz - 0.029197707772254944),
+ (minx + 0.005757161183282733, -0.005984836723655462, maxz - 0.029181556776165962),
+ (minx + 0.006141135876532644, -0.0061443340964615345, maxz - 0.029173903167247772),
+ (minx + 0.006525505916215479, -0.005985768511891365, maxz - 0.029179232195019722),
+ (minx + 0.00667479052208364, -0.005256861448287964, maxz - 0.015088497661054134),
+ (minx + 0.006516232970170677, -0.0048761311918497086, maxz - 0.01516645960509777),
+ (minx + 0.006132298905868083, -0.0047181048430502415, maxz - 0.015200402587652206),
+ (minx + 0.005747891729697585, -0.004875352140516043, maxz - 0.015170442871749401),
+ (minx + 0.005588191794231534, -0.005255760159343481, maxz - 0.015094131231307983),
+ (minx + 0.005746749578975141, -0.005636490881443024, maxz - 0.015016170218586922),
+ (minx + 0.006130683759693056, -0.005794517230242491, maxz - 0.014982225373387337),
+ (minx + 0.006515091052278876, -0.005637269467115402, maxz - 0.015012186020612717),
+ (minx + 0.006657243531662971, -0.004483901429921389, maxz - 0.0068090930581092834),
+ (minx + 0.0065001812763512135, -0.004140931181609631, maxz - 0.007067454978823662),
+ (minx + 0.006116931792348623, -0.004000166896730661, maxz - 0.007183153182268143),
+ (minx + 0.005731997545808554, -0.004144065547734499, maxz - 0.007088415324687958),
+ (minx + 0.005570868030190468, -0.004488333128392696, maxz - 0.006838735193014145),
+ (minx + 0.005727930460125208, -0.004831302911043167, maxz - 0.006580371409654617),
+ (minx + 0.006111179769504815, -0.004972067661583424, maxz - 0.006464675068855286),
+ (minx + 0.006496114016044885, -0.004828169010579586, maxz - 0.006559412926435471),
+ (minx + 0.006604497611988336, -0.0032484245020896196, maxz - 0.0031274016946554184),
+ (minx + 0.006457724317442626, -0.003093734150752425, maxz - 0.0036577805876731873),
+ (minx + 0.006079296523239464, -0.003041104646399617, maxz - 0.003899872303009033),
+ (minx + 0.005690891877748072, -0.003121365327388048, maxz - 0.003711860626935959),
+ (minx + 0.0055200329516083, -0.003287500236183405, maxz - 0.0032038819044828415),
+ (minx + 0.005666806362569332, -0.003442190121859312, maxz - 0.0026735030114650726),
+ (minx + 0.006045234156772494, -0.0034948198590427637, maxz - 0.0024314112961292267),
+ (minx + 0.006433638744056225, -0.0034145594108849764, maxz - 0.002619422972202301),
+ (minx + 0.005553199094720185, -0.003373156301677227, maxz - 0.0029192231595516205),
+ (minx + 0.005638031987473369, -0.005809193942695856, maxz - 0.029189079999923706),
+ (minx + 0.006679139332845807, -0.005481190048158169, maxz - 0.021335555240511894),
+ (minx + 0.005963105417322367, -0.0060473051853477955, minz + 0.029685713350772858),
+ (minx + 0.0064580682083033025, -0.005610927473753691, minz + 0.00021105259656906128),
+ (minx + 0.006325242109596729, -0.004034899175167084, maxz - 0.007151160389184952),
+ (minx + 0.005660235299728811, -0.0053710793145000935, minz + 0.016075536608695984),
+ (minx + 0.00638652773341164, -0.002530882600694895, maxz - 0.001646917313337326),
+ (minx + 0.006753799156285822, -0.004899526014924049, minz + 0.0002490729093551636),
+ (minx + 0.005611745989881456, -0.004301622975617647, maxz - 0.006975553929805756),
+ (minx + 0.005923676071688533, -0.004757302813231945, maxz - 0.015193496830761433),
+ (minx + 0.006696114782243967, -0.00562225840985775, maxz - 0.038819022476673126),
+ (minx + 0.006588134099729359, -0.004988160915672779, minz + 0.016097113490104675),
+ (minx + 0.0057050439063459635, -0.004220933653414249, maxz - 0.004127245396375656),
+ (minx + 0.005668493686243892, -0.005752034951001406, minz + 0.02969057857990265),
+ (minx + 0.006753342226147652, -0.005316472612321377, minz + 0.0002283826470375061),
+ (minx + 0.00608676258707419, -0.0043317219242453575, maxz - 0.003948887810111046),
+ (minx + 0.005908200400881469, -0.004036600701510906, maxz - 0.0071625374257564545),
+ (minx + 0.006618573679588735, -0.004297514911741018, maxz - 0.006948085501790047),
+ (minx + 0.005609537824057043, -0.004674719180911779, maxz - 0.006699742749333382),
+ (minx + 0.0061239866190589964, -0.005448713432997465, maxz - 0.010101532563567162),
+ (minx + 0.006472813023719937, -0.004209799692034721, maxz - 0.0040906742215156555),
+ (minx + 0.00562828395050019, -0.005049192346632481, maxz - 0.015135801397264004),
+ (minx + 0.006042047869414091, -0.004603803623467684, minz + 0.00025719404220581055),
+ (minx + 0.005995150306262076, -0.002559639746323228, maxz - 0.0014130901545286179),
+ (minx + 0.006101552047766745, -0.0035372015554457903, maxz - 0.005041923373937607),
+ (minx + 0.005933871027082205, -0.005097907967865467, maxz - 0.029217233881354332),
+ (minx + 0.006520519149489701, -0.005098029971122742, maxz - 0.021375520154833794),
+ (minx + 0.005668977275490761, -0.005334966816008091, minz + 0.02969978377223015),
+ (minx + 0.005746773676946759, -0.004898258484899998, minz + 0.00023986399173736572),
+ (minx + 0.006483270728494972, -0.0036479895934462547, maxz - 0.0048635657876729965),
+ (minx + 0.006519501097500324, -0.005863978061825037, maxz - 0.021296590566635132),
+ (minx + 0.00615216267760843, -0.006164800841361284, maxz - 0.038819536566734314),
+ (minx + 0.00590286951046437, -0.004937335848808289, maxz - 0.0064966678619384766),
+ (minx + 0.005662225186824799, -0.0025571994483470917, maxz - 0.0030235834419727325),
+ (minx + 0.00667601206805557, -0.0053361887112259865, minz + 0.029705405235290527),
+ (minx + 0.005566274747252464, -0.0031989826820790768, maxz - 0.0034829415380954742),
+ (minx + 0.006637051934376359, -0.0039265891537070274, maxz - 0.004469545558094978),
+ (minx + 0.005922179203480482, -0.005754896439611912, maxz - 0.014991294592618942),
+ (minx + 0.006536525208503008, -0.006006165407598019, maxz - 0.03881846368312836),
+ (minx + 0.006645070854574442, -0.005810413975268602, maxz - 0.029186034575104713),
+ (minx + 0.006053602788597345, -0.0025284423027187586, maxz - 0.0032574106007814407),
+ (minx + 0.005869895336218178, -0.0030652163550257683, maxz - 0.0038607902824878693),
+ (minx + 0.0062029213877394795, -0.005914892535656691, minz + 0.016058631241321564),
+ (minx + 0.005746316979639232, -0.005315205082297325, minz + 0.00021916627883911133),
+ (minx + 0.006635318568442017, -0.005050212610512972, maxz - 0.015130581334233284),
+ (minx + 0.006350999989081174, -0.005098414141684771, maxz - 0.029215972870588303),
+ (minx + 0.005818931153044105, -0.00575533602386713, minz + 0.016061931848526),
+ (minx + 0.005620893090963364, -0.002579259453341365, maxz - 0.0017194505780935287),
+ (minx + 0.0064278600621037185, -0.0025088228285312653, maxz - 0.00295105017721653),
+ (minx + 0.005627664038911462, -0.00546240946277976, maxz - 0.015052048489451408),
+ (minx + 0.005932620842941105, -0.006104323081672192, maxz - 0.02917615696787834),
+ (minx + 0.0054829909931868315, -0.0025782485026866198, maxz - 0.002386540174484253),
+ (minx + 0.005715501611120999, -0.003659122856333852, maxz - 0.004900138825178146),
+ (minx + 0.005751156946644187, -0.005863080266863108, maxz - 0.021299004554748535),
+ (minx + 0.006645588902756572, -0.005393543280661106, maxz - 0.029203049838542938),
+ (minx + 0.006286203453782946, -0.0030502157751470804, maxz - 0.0038314294070005417),
+ (minx + 0.00655825569992885, -0.0033369415905326605, maxz - 0.002848343923687935),
+ (minx + 0.005551262525841594, -0.003942334558814764, maxz - 0.004521265625953674),
+ (minx + 0.0057421906385570765, -0.004556154832243919, maxz - 0.010453060269355774),
+ (minx + 0.00613511772826314, -0.006022163201123476, maxz - 0.021281450986862183),
+ (minx + 0.0065872694831341505, -0.005756282713264227, minz + 0.016067564487457275),
+ (minx + 0.006668635527603328, -0.0049255844205617905, maxz - 0.010298069566488266),
+ (minx + 0.006349750037770718, -0.006104828789830208, maxz - 0.029174894094467163),
+ (minx + 0.006319911277387291, -0.0049356333911418915, maxz - 0.006485290825366974),
+ (minx + 0.0063408034620806575, -0.004757725168019533, maxz - 0.015191333368420601),
+ (minx + 0.00576818163972348, -0.006005238275974989, maxz - 0.03882160410284996),
+ (minx + 0.0062546354020014405, -0.0034707081504166126, maxz - 0.00247049517929554),
+ (minx + 0.00560951279476285, -0.005620947107672691, maxz - 0.038823459297418594),
+ (minx + 0.006616365630179644, -0.004670611582696438, maxz - 0.0066722724586725235),
+ (minx + 0.0066755281295627356, -0.005753257777541876, minz + 0.029696203768253326),
+ (minx + 0.006634698482230306, -0.005463429726660252, maxz - 0.015046827495098114),
+ (minx + 0.006204143981449306, -0.004828604869544506, minz + 0.016100406646728516),
+ (minx + 0.006339306535664946, -0.005755319260060787, maxz - 0.01498913299292326),
+ (minx + 0.006126744614448398, -0.004402851220220327, maxz - 0.010507876053452492),
+ (minx + 0.006153465015813708, -0.005078405141830444, maxz - 0.03882294520735741),
+ (minx + 0.005838327226229012, -0.003485708963125944, maxz - 0.002499854192137718),
+ (minx + 0.00656576210167259, -0.0025098335463553667, maxz - 0.0022839605808258057),
+ (minx + 0.005752174882218242, -0.005097132176160812, maxz - 0.021377932280302048),
+ (minx + 0.006571331556187943, -0.003162768203765154, maxz - 0.0034120604395866394),
+ (minx + 0.006510490493383259, -0.00455587450414896, maxz - 0.010443676263093948),
+ (minx + 0.005964273179415613, -0.005040412303060293, minz + 0.02970793843269348),
+ (minx + 0.005769102484919131, -0.005237040109932423, maxz - 0.038824014365673065),
+ (minx + 0.006746829953044653, -0.005372417625039816, minz + 0.016083508729934692),
+ (minx + 0.0065085404785349965, -0.0052954102866351604, maxz - 0.01015634834766388),
+ (minx + 0.005740240449085832, -0.005295691080391407, maxz - 0.010165732353925705),
+ (minx + 0.0056385500356554985, -0.005392322316765785, maxz - 0.02920609526336193),
+ (minx + 0.006136558135040104, -0.004938947968184948, maxz - 0.021393071860074997),
+ (minx + 0.006380232633091509, -0.006047811824828386, minz + 0.029688045382499695),
+ (minx + 0.005819795769639313, -0.0049872142262756824, minz + 0.016091473400592804),
+ (minx + 0.006537446053698659, -0.00523796770721674, maxz - 0.03882087767124176),
+ (minx + 0.005582095473073423, -0.004925980698317289, maxz - 0.010311339050531387),
+ (minx + 0.005592536414042115, -0.005479920189827681, maxz - 0.021338969469070435),
+ (minx + 0.0064591713598929346, -0.00460432842373848, minz + 0.00026100873947143555),
+ (minx + 0.006381400395184755, -0.005040918942540884, minz + 0.02971026673913002),
+ (minx + 0.006040944659616798, -0.005610402673482895, minz + 0.00020723789930343628),
+ (minx + 0.006707282620482147, -0.005163864698261023, minz + 0.016091227531433105),
+ (minx + 0.006412662158254534, -0.004868632182478905, minz + 0.016100414097309113),
+ (minx + 0.005995536455884576, -0.004868118558079004, minz + 0.016097351908683777),
+ (minx + 0.0057002517860382795, -0.005162625107914209, minz + 0.016083844006061554),
+ (minx + 0.005699782632291317, -0.005579632706940174, minz + 0.016067802906036377),
+ (minx + 0.0059944032109342515, -0.005874865222722292, minz + 0.016058631241321564),
+ (minx + 0.00641152891330421, -0.005875378847122192, minz + 0.0160616934299469),
+ (minx + 0.0067068132339045405, -0.005580872762948275, minz + 0.016075193881988525),
+ (minx + 0.006656582350842655, -0.00541368592530489, maxz - 0.03881983831524849),
+ (minx + 0.00636198150459677, -0.005118431523442268, maxz - 0.03882196918129921),
+ (minx + 0.005944853066466749, -0.005117928143590689, maxz - 0.03882367163896561),
+ (minx + 0.005649544997140765, -0.005412471015006304, maxz - 0.03882395476102829),
+ (minx + 0.005649045226164162, -0.005829520057886839, maxz - 0.03882264345884323),
+ (minx + 0.005943646072410047, -0.006124773994088173, maxz - 0.03882051259279251),
+ (minx + 0.00636077462695539, -0.00612527783960104, maxz - 0.038818806409835815),
+ (minx + 0.00665608246345073, -0.005830735433846712, maxz - 0.03881852701306343),
+ (minx + 0.006639633560553193, -0.005273229442536831, maxz - 0.021357106044888496),
+ (minx + 0.006345069617964327, -0.004978850018233061, maxz - 0.021388331428170204),
+ (minx + 0.00592794077238068, -0.00497836247086525, maxz - 0.021389640867710114),
+ (minx + 0.005632595275528729, -0.005272052250802517, maxz - 0.02136026881635189),
+ (minx + 0.005632042535580695, -0.0056878807954490185, maxz - 0.021317418664693832),
+ (minx + 0.005926606128923595, -0.005982260685414076, maxz - 0.021286193281412125),
+ (minx + 0.0063437349162995815, -0.005982748232781887, maxz - 0.021284881979227066),
+ (minx + 0.006639080471359193, -0.0056890579871833324, maxz - 0.021314255893230438),
+ (minx + 0.006629384937696159, -0.004724854603409767, maxz - 0.010376550257205963),
+ (minx + 0.006335195794235915, -0.004441066179424524, maxz - 0.010490451008081436),
+ (minx + 0.0059180911630392075, -0.004441218450665474, maxz - 0.010495545342564583),
+ (minx + 0.005622404860332608, -0.004725221544504166, maxz - 0.010388847440481186),
+ (minx + 0.005621346062980592, -0.005126711446791887, maxz - 0.01023285835981369),
+ (minx + 0.0059155350318178535, -0.005410499405115843, maxz - 0.010118955746293068),
+ (minx + 0.0063326399540528655, -0.005410346668213606, maxz - 0.010113861411809921),
+ (minx + 0.006628326023928821, -0.005126343574374914, maxz - 0.010220561176538467),
+ (minx + 0.006600138149224222, -0.0037746636662632227, maxz - 0.004681237041950226),
+ (minx + 0.006309418939054012, -0.0035632678773254156, maxz - 0.004991978406906128),
+ (minx + 0.005892602261155844, -0.0035693119280040264, maxz - 0.00501183420419693),
+ (minx + 0.005593853886239231, -0.0037892560940235853, maxz - 0.0047291722148656845),
+ (minx + 0.005588176427409053, -0.004094259347766638, maxz - 0.004309574142098427),
+ (minx + 0.005878895753994584, -0.004305655136704445, maxz - 0.003998832777142525),
+ (minx + 0.006295712431892753, -0.00429961085319519, maxz - 0.003978978842496872),
+ (minx + 0.006594460690394044, -0.004079666920006275, maxz - 0.004261638969182968),
+ (minx + 0.006537339504575357, -0.002506350167095661, maxz - 0.0026417188346385956),
+ (minx + 0.006259291782043874, -0.0025164526887238026, maxz - 0.003170197829604149),
+ (minx + 0.005843633785843849, -0.0025427164509892464, maxz - 0.0032095760107040405),
+ (minx + 0.005533852614462376, -0.0025697555392980576, maxz - 0.0027367863804101944),
+ (minx + 0.005511413444764912, -0.0025817318819463253, maxz - 0.002028781920671463),
+ (minx + 0.005789461429230869, -0.0025716288946568966, maxz - 0.0015003029257059097),
+ (minx + 0.006205119309015572, -0.0025453658308833838, maxz - 0.001460924744606018),
+ (minx + 0.0065149005386047065, -0.0025183262769132853, maxz - 0.0019337143748998642),
+ (minx, -0.0013792915269732475, maxz - 0.005334946792572737),
+ (minx + 4.656612873077393e-10, maxy, maxz - 0.005334946792572737),
+ (maxx, maxy - 4.423782229423523e-09, maxz - 0.005334946792572737),
+ (maxx, -0.0013792961835861206, maxz - 0.005334946792572737),
+ (minx, -0.0013792915269732475, maxz - 1.5133991837501526e-08),
+ (minx + 4.656612873077393e-10, maxy, maxz - 1.5133991837501526e-08),
+ (maxx, maxy - 4.423782229423523e-09, maxz - 1.5133991837501526e-08),
+ (maxx, -0.0013792961835861206, maxz - 1.5133991837501526e-08),
+ (minx + 0.0011832499876618385, -0.0013792921090498567, maxz - 0.00447732862085104),
+ (minx + 0.0011832499876618385, -0.0013792921090498567, maxz - 0.0008576327236369252),
+ (maxx - 0.0011832499876618385, -0.0013792957179248333, maxz - 0.0008576327236369252),
+ (maxx - 0.0011832499876618385, -0.0013792957179248333, maxz - 0.00447732862085104),
+ (minx + 0.0011832504533231258, -0.0007798965089023113, maxz - 0.00447732862085104),
+ (minx + 0.0011832504533231258, -0.0007798965089023113, maxz - 0.0008576327236369252),
+ (maxx - 0.0011832495220005512, -0.0007799001759849489, maxz - 0.0008576327236369252),
+ (maxx - 0.0011832495220005512, -0.0007799001759849489, maxz - 0.00447732862085104),
+ (minx + 0.004529597237706184, -0.0007973873289301991, maxz - 0.0044512152671813965),
+ (minx + 0.004529597237706184, -0.0007973873289301991, maxz - 0.0008894965285435319),
+ (minx + 0.004144799197092652, -0.001563245547004044, maxz - 0.0044512152671813965),
+ (minx + 0.004144799197092652, -0.001563245547004044, maxz - 0.0008894965285435319),
+ (minx + 0.0032158144749701023, -0.0018804739229381084, maxz - 0.0044512152671813965),
+ (minx + 0.0032158144749701023, -0.0018804739229381084, maxz - 0.0008894965285435319),
+ (minx + 0.0022868295200169086, -0.0015632447320967913, maxz - 0.0044512152671813965),
+ (minx + 0.0022868295200169086, -0.0015632447320967913, maxz - 0.0008894965285435319),
+ (minx + 0.0019020326435565948, -0.0007973865140229464, maxz - 0.0044512152671813965),
+ (minx + 0.0019020326435565948, -0.0007973865140229464, maxz - 0.0008894965285435319),
+ (maxx - 0.001917288638651371, -0.0007973890169523656, maxz - 0.0044512152671813965),
+ (maxx - 0.001917288638651371, -0.0007973890169523656, maxz - 0.0008894965285435319),
+ (maxx - 0.0023020864464342594, -0.0015632474096491933, maxz - 0.0044512152671813965),
+ (maxx - 0.0023020864464342594, -0.0015632474096491933, maxz - 0.0008894965285435319),
+ (maxx - 0.0032310718670487404, -0.0018804756691679358, maxz - 0.0044512152671813965),
+ (maxx - 0.0032310718670487404, -0.0018804756691679358, maxz - 0.0008894965285435319),
+ (maxx - 0.00416005658917129, -0.0015632465947419405, maxz - 0.0044512152671813965),
+ (maxx - 0.00416005658917129, -0.0015632465947419405, maxz - 0.0008894965285435319),
+ (maxx - 0.0045448546297848225, -0.0007973880274221301, maxz - 0.0044512152671813965),
+ (maxx - 0.0045448546297848225, -0.0007973880274221301, maxz - 0.0008894965285435319)]
+
+ # Faces
+ myfaces = [(0, 56, 144, 131), (0, 131, 151, 63), (1, 141, 145, 60), (1, 60, 144, 56), (2, 71, 146, 120),
+ (2, 120, 145, 141), (3, 77, 147, 137), (3, 137, 146, 71), (4, 92, 148, 54), (4, 54, 147, 77),
+ (5, 143, 149, 95), (5, 95, 148, 92), (6, 52, 150, 91), (6, 91, 149, 143), (7, 63, 151, 109),
+ (7, 109, 150, 52), (8, 131, 144, 83), (8, 83, 152, 59), (8, 59, 159, 118), (8, 118, 151, 131),
+ (9, 60, 145, 142), (9, 142, 153, 138), (9, 138, 152, 83), (9, 83, 144, 60), (10, 120, 146, 129),
+ (10, 129, 154, 123), (10, 123, 153, 142), (10, 142, 145, 120), (11, 137, 147, 76), (11, 76, 155, 130),
+ (11, 130, 154, 129), (11, 129, 146, 137), (12, 54, 148, 62), (12, 62, 156, 116), (12, 116, 155, 76),
+ (12, 76, 147, 54), (13, 95, 149, 51), (13, 51, 157, 114), (13, 114, 156, 62), (13, 62, 148, 95),
+ (14, 91, 150, 136), (14, 136, 158, 80), (14, 80, 157, 51), (14, 51, 149, 91), (15, 109, 151, 118),
+ (15, 118, 159, 87), (15, 87, 158, 136), (15, 136, 150, 109), (16, 59, 152, 103), (16, 103, 160, 50),
+ (16, 50, 167, 88), (16, 88, 159, 59), (17, 138, 153, 94), (17, 94, 161, 75), (17, 75, 160, 103),
+ (17, 103, 152, 138), (18, 123, 154, 74), (18, 74, 162, 135), (18, 135, 161, 94), (18, 94, 153, 123),
+ (19, 130, 155, 134), (19, 134, 163, 126), (19, 126, 162, 74), (19, 74, 154, 130), (20, 116, 156, 49),
+ (20, 49, 164, 140), (20, 140, 163, 134), (20, 134, 155, 116), (21, 114, 157, 99), (21, 99, 165, 102),
+ (21, 102, 164, 49), (21, 49, 156, 114), (22, 80, 158, 111), (22, 111, 166, 108), (22, 108, 165, 99),
+ (22, 99, 157, 80), (23, 87, 159, 88), (23, 88, 167, 79), (23, 79, 166, 111), (23, 111, 158, 87),
+ (24, 50, 160, 93), (24, 93, 168, 110), (24, 110, 175, 119), (24, 119, 167, 50), (25, 75, 161, 113),
+ (25, 113, 169, 128), (25, 128, 168, 93), (25, 93, 160, 75), (26, 135, 162, 58), (26, 58, 170, 122),
+ (26, 122, 169, 113), (26, 113, 161, 135), (27, 126, 163, 70), (27, 70, 171, 107), (27, 107, 170, 58),
+ (27, 58, 162, 126), (28, 140, 164, 98), (28, 98, 172, 139), (28, 139, 171, 70), (28, 70, 163, 140),
+ (29, 102, 165, 86), (29, 86, 173, 133), (29, 133, 172, 98), (29, 98, 164, 102), (30, 108, 166, 121),
+ (30, 121, 174, 68), (30, 68, 173, 86), (30, 86, 165, 108), (31, 79, 167, 119), (31, 119, 175, 132),
+ (31, 132, 174, 121), (31, 121, 166, 79), (32, 110, 168, 66), (32, 66, 176, 85), (32, 85, 183, 117),
+ (32, 117, 175, 110), (33, 128, 169, 53), (33, 53, 177, 78), (33, 78, 176, 66), (33, 66, 168, 128),
+ (34, 122, 170, 65), (34, 65, 178, 73), (34, 73, 177, 53), (34, 53, 169, 122), (35, 107, 171, 57),
+ (35, 57, 179, 101), (35, 101, 178, 65), (35, 65, 170, 107), (36, 139, 172, 67), (36, 67, 180, 106),
+ (36, 106, 179, 57), (36, 57, 171, 139), (37, 133, 173, 81), (37, 81, 181, 61), (37, 61, 180, 67),
+ (37, 67, 172, 133), (38, 68, 174, 112), (38, 112, 182, 64), (38, 64, 181, 81), (38, 81, 173, 68),
+ (39, 132, 175, 117), (39, 117, 183, 69), (39, 69, 182, 112), (39, 112, 174, 132), (40, 85, 176, 127),
+ (40, 127, 184, 125), (40, 125, 191, 105), (40, 105, 183, 85), (41, 78, 177, 104), (41, 104, 185, 97),
+ (41, 97, 184, 127), (41, 127, 176, 78), (42, 73, 178, 90), (42, 90, 186, 89), (42, 89, 185, 104),
+ (42, 104, 177, 73), (43, 101, 179, 84), (43, 84, 187, 82), (43, 82, 186, 90), (43, 90, 178, 101),
+ (44, 106, 180, 48), (44, 48, 188, 100), (44, 100, 187, 84), (44, 84, 179, 106), (45, 61, 181, 124),
+ (45, 124, 189, 96), (45, 96, 188, 48), (45, 48, 180, 61), (46, 64, 182, 115), (46, 115, 190, 72),
+ (46, 72, 189, 124), (46, 124, 181, 64), (47, 69, 183, 105), (47, 105, 191, 55), (47, 55, 190, 115),
+ (47, 115, 182, 69), (192, 248, 336, 323), (192, 323, 343, 255),
+ (193, 333, 337, 252), (193, 252, 336, 248),
+ (194, 263, 338, 312), (194, 312, 337, 333), (195, 269, 339, 329),
+ (195, 329, 338, 263), (196, 284, 340, 246),
+ (196, 246, 339, 269), (197, 335, 341, 287), (197, 287, 340, 284),
+ (198, 244, 342, 283), (198, 283, 341, 335),
+ (199, 255, 343, 301), (199, 301, 342, 244), (200, 323, 336, 275),
+ (200, 275, 344, 251), (200, 251, 351, 310),
+ (200, 310, 343, 323), (201, 252, 337, 334), (201, 334, 345, 330),
+ (201, 330, 344, 275), (201, 275, 336, 252),
+ (202, 312, 338, 321), (202, 321, 346, 315), (202, 315, 345, 334),
+ (202, 334, 337, 312), (203, 329, 339, 268),
+ (203, 268, 347, 322), (203, 322, 346, 321), (203, 321, 338, 329),
+ (204, 246, 340, 254), (204, 254, 348, 308),
+ (204, 308, 347, 268), (204, 268, 339, 246), (205, 287, 341, 243),
+ (205, 243, 349, 306), (205, 306, 348, 254),
+ (205, 254, 340, 287), (206, 283, 342, 328), (206, 328, 350, 272),
+ (206, 272, 349, 243), (206, 243, 341, 283),
+ (207, 301, 343, 310), (207, 310, 351, 279), (207, 279, 350, 328),
+ (207, 328, 342, 301), (208, 251, 344, 295),
+ (208, 295, 352, 242), (208, 242, 359, 280), (208, 280, 351, 251),
+ (209, 330, 345, 286), (209, 286, 353, 267),
+ (209, 267, 352, 295), (209, 295, 344, 330), (210, 315, 346, 266),
+ (210, 266, 354, 327), (210, 327, 353, 286),
+ (210, 286, 345, 315), (211, 322, 347, 326), (211, 326, 355, 318),
+ (211, 318, 354, 266), (211, 266, 346, 322),
+ (212, 308, 348, 241), (212, 241, 356, 332), (212, 332, 355, 326),
+ (212, 326, 347, 308), (213, 306, 349, 291),
+ (213, 291, 357, 294), (213, 294, 356, 241), (213, 241, 348, 306),
+ (214, 272, 350, 303), (214, 303, 358, 300),
+ (214, 300, 357, 291), (214, 291, 349, 272), (215, 279, 351, 280),
+ (215, 280, 359, 271), (215, 271, 358, 303),
+ (215, 303, 350, 279), (216, 242, 352, 285), (216, 285, 360, 302),
+ (216, 302, 367, 311), (216, 311, 359, 242),
+ (217, 267, 353, 305), (217, 305, 361, 320), (217, 320, 360, 285),
+ (217, 285, 352, 267), (218, 327, 354, 250),
+ (218, 250, 362, 314), (218, 314, 361, 305), (218, 305, 353, 327),
+ (219, 318, 355, 262), (219, 262, 363, 299),
+ (219, 299, 362, 250), (219, 250, 354, 318), (220, 332, 356, 290),
+ (220, 290, 364, 331), (220, 331, 363, 262),
+ (220, 262, 355, 332), (221, 294, 357, 278), (221, 278, 365, 325),
+ (221, 325, 364, 290), (221, 290, 356, 294),
+ (222, 300, 358, 313), (222, 313, 366, 260), (222, 260, 365, 278),
+ (222, 278, 357, 300), (223, 271, 359, 311),
+ (223, 311, 367, 324), (223, 324, 366, 313), (223, 313, 358, 271),
+ (224, 302, 360, 258), (224, 258, 368, 277),
+ (224, 277, 375, 309), (224, 309, 367, 302), (225, 320, 361, 245),
+ (225, 245, 369, 270), (225, 270, 368, 258),
+ (225, 258, 360, 320), (226, 314, 362, 257), (226, 257, 370, 265),
+ (226, 265, 369, 245), (226, 245, 361, 314),
+ (227, 299, 363, 249), (227, 249, 371, 293), (227, 293, 370, 257),
+ (227, 257, 362, 299), (228, 331, 364, 259),
+ (228, 259, 372, 298), (228, 298, 371, 249), (228, 249, 363, 331),
+ (229, 325, 365, 273), (229, 273, 373, 253),
+ (229, 253, 372, 259), (229, 259, 364, 325), (230, 260, 366, 304),
+ (230, 304, 374, 256), (230, 256, 373, 273),
+ (230, 273, 365, 260), (231, 324, 367, 309), (231, 309, 375, 261),
+ (231, 261, 374, 304), (231, 304, 366, 324),
+ (232, 277, 368, 319), (232, 319, 376, 317), (232, 317, 383, 297),
+ (232, 297, 375, 277), (233, 270, 369, 296),
+ (233, 296, 377, 289), (233, 289, 376, 319), (233, 319, 368, 270),
+ (234, 265, 370, 282), (234, 282, 378, 281),
+ (234, 281, 377, 296), (234, 296, 369, 265), (235, 293, 371, 276),
+ (235, 276, 379, 274), (235, 274, 378, 282),
+ (235, 282, 370, 293), (236, 298, 372, 240), (236, 240, 380, 292),
+ (236, 292, 379, 276), (236, 276, 371, 298),
+ (237, 253, 373, 316), (237, 316, 381, 288), (237, 288, 380, 240),
+ (237, 240, 372, 253), (238, 256, 374, 307),
+ (238, 307, 382, 264), (238, 264, 381, 316), (238, 316, 373, 256),
+ (239, 261, 375, 297), (239, 297, 383, 247),
+ (239, 247, 382, 307), (239, 307, 374, 261), (388, 389, 385, 384),
+ (389, 390, 386, 385), (390, 391, 387, 386),
+ (392, 395, 399, 396), (384, 385, 386, 387), (391, 390, 389, 388),
+ (392, 393, 388, 384), (394, 395, 387, 391),
+ (393, 394, 391, 388), (395, 392, 384, 387), (398, 397, 396, 399),
+ (394, 393, 397, 398), (395, 394, 398, 399),
+ (393, 392, 396, 397), (400, 401, 403, 402), (402, 403, 405, 404),
+ (404, 405, 407, 406), (406, 407, 409, 408),
+ (410, 411, 413, 412), (412, 413, 415, 414), (414, 415, 417, 416), (416, 417, 419, 418)]
+
+ mesh = bpy.data.meshes.new(objname)
+ myobject = bpy.data.objects.new(objname, mesh)
+
+ myobject.location = bpy.context.scene.cursor_location
+ bpy.context.scene.objects.link(myobject)
+
+ mesh.from_pydata(myvertex, [], myfaces)
+ mesh.update(calc_edges=True)
+
+ return myobject
+
+
+# ------------------------------------------------------------------------------
+# Create bezier curve
+# ------------------------------------------------------------------------------
+def create_bezier(objname, points, origin, depth=0.001, fill='FULL'):
+ curvedata = bpy.data.curves.new(name=objname, type='CURVE')
+ curvedata.dimensions = '3D'
+ curvedata.fill_mode = fill
+ curvedata.bevel_resolution = 5
+ curvedata.bevel_depth = depth
+
+ myobject = bpy.data.objects.new(objname, curvedata)
+ myobject.location = origin
+
+ bpy.context.scene.objects.link(myobject)
+
+ polyline = curvedata.splines.new('BEZIER')
+ polyline.bezier_points.add(len(points) - 1)
+
+ for idx, (knot, h1, h2) in enumerate(points):
+ point = polyline.bezier_points[idx]
+ point.co = knot
+ point.handle_left = h1
+ point.handle_right = h2
+ point.handle_left_type = 'FREE'
+ point.handle_right_type = 'FREE'
+
+ return myobject
diff --git a/archimesh/achm_window_maker.py b/archimesh/achm_window_maker.py
new file mode 100644
index 00000000..a12a1e74
--- /dev/null
+++ b/archimesh/achm_window_maker.py
@@ -0,0 +1,2308 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+# ----------------------------------------------------------
+# Author: Antonio Vazquez (antonioya)
+#
+# ----------------------------------------------------------
+# noinspection PyUnresolvedReferences
+import bpy
+import math
+# noinspection PyUnresolvedReferences
+from bpy.props import *
+from achm_tools import *
+
+
+# ------------------------------------------------------------------
+# Define operator class to create object
+# ------------------------------------------------------------------
+class AchmWindows(bpy.types.Operator):
+ bl_idname = "mesh.archimesh_window"
+ bl_label = "Rail Windows"
+ bl_description = "Rail Windows Generator"
+ bl_category = 'Archimesh'
+ bl_options = {'REGISTER', 'UNDO'}
+
+ # -----------------------------------------------------
+ # Draw (create UI interface)
+ # -----------------------------------------------------
+ # noinspection PyUnusedLocal
+ def draw(self, context):
+ layout = self.layout
+ row = layout.row()
+ row.label("Use Properties panel (N) to define parms", icon='INFO')
+
+ # -----------------------------------------------------
+ # Execute
+ # -----------------------------------------------------
+ def execute(self, context):
+ if bpy.context.mode == "OBJECT":
+ create_object(self, context)
+ return {'FINISHED'}
+ else:
+ self.report({'WARNING'}, "Archimesh: Option only valid in Object mode")
+ return {'CANCELLED'}
+
+
+# ------------------------------------------------------------------------------
+#
+# Create main object. The other objects will be children of this.
+#
+# ------------------------------------------------------------------------------
+# noinspection PyUnusedLocal
+def create_object(self, context):
+ # deselect all objects
+ for o in bpy.data.objects:
+ o.select = False
+
+ # we create main object and mesh
+ mainmesh = bpy.data.meshes.new("WindowFrane")
+ mainobject = bpy.data.objects.new("WindowFrame", mainmesh)
+ mainobject.location = bpy.context.scene.cursor_location
+ bpy.context.scene.objects.link(mainobject)
+ mainobject.WindowObjectGenerator.add()
+
+ # we shape the main object and create other objects as children
+ shape_mesh_and_create_children(mainobject, mainmesh)
+
+ # we select, and activate, main object
+ mainobject.select = True
+ bpy.context.scene.objects.active = mainobject
+
+
+# ------------------------------------------------------------------------------
+#
+# Update main mesh and children objects
+#
+# ------------------------------------------------------------------------------
+# noinspection PyUnusedLocal
+def update_object(self, context):
+ # When we update, the active object is the main object
+ o = bpy.context.active_object
+ oldmesh = o.data
+ oldname = o.data.name
+ # Now we deselect that object to not delete it.
+ o.select = False
+ # and we create a new mesh
+ tmp_mesh = bpy.data.meshes.new("temp")
+ # deselect all objects
+ for obj in bpy.data.objects:
+ obj.select = False
+
+ # ---------------------------------
+ # Clear Parent objects (autohole)
+ # ---------------------------------
+ myparent = o.parent
+ ploc = myparent.location
+ if myparent is not None:
+ o.parent = None
+ o.location = ploc
+ # remove_children(parent)
+ for child in myparent.children:
+ # noinspection PyBroadException
+ try:
+ # clear child data
+ child.hide = False # must be visible to avoid bug
+ child.hide_render = False # must be visible to avoid bug
+ old = child.data
+ child.select = True
+ bpy.ops.object.delete()
+ bpy.data.meshes.remove(old)
+ except:
+ dummy = -1
+
+ myparent.select = True
+ bpy.ops.object.delete()
+
+ # -----------------------
+ # remove all children
+ # -----------------------
+ # first granchild
+ for child in o.children:
+ remove_children(child)
+ # now children of main object
+ remove_children(o)
+
+ # Finally we create all that again (except main object),
+ shape_mesh_and_create_children(o, tmp_mesh, True)
+ o.data = tmp_mesh
+ # Remove data (mesh of active object),
+ bpy.data.meshes.remove(oldmesh)
+ tmp_mesh.name = oldname
+ # and select, and activate, the main object
+ o.select = True
+ bpy.context.scene.objects.active = o
+
+
+# ------------------------------------------------------------------------------
+# Generate all objects
+# For main, it only shapes mesh and creates modifiers (the modifier, only the first time).
+# And, for the others, it creates object and mesh.
+# ------------------------------------------------------------------------------
+# noinspection PyUnusedLocal
+def shape_mesh_and_create_children(mainobject, tmp_mesh, update=False):
+ mp = mainobject.WindowObjectGenerator[0]
+ # Create only mesh, because the object is created before
+ if mp.opentype == "1":
+ generate_rail_window(mainobject, mp, tmp_mesh)
+ else:
+ generate_leaf_window(mainobject, mp, tmp_mesh)
+
+ remove_doubles(mainobject)
+ set_normals(mainobject)
+
+ # saves OpenGL data
+ if mp.blind is True:
+ plus = mp.blind_height
+ else:
+ plus = 0
+
+ mp.glpoint_a = (-mp.width / 2, 0, 0)
+ mp.glpoint_b = (-mp.width / 2, 0, mp.height + plus)
+ mp.glpoint_c = (mp.width / 2, 0, mp.height + plus)
+
+ # Lock
+ mainobject.lock_location = (True, True, True)
+ mainobject.lock_rotation = (True, True, True)
+
+ # -------------------------
+ # Create empty and parent
+ # -------------------------
+ bpy.ops.object.empty_add(type='PLAIN_AXES')
+ myempty = bpy.data.objects[bpy.context.active_object.name]
+ myempty.location = mainobject.location
+
+ myempty.name = "Window_Group"
+ parentobject(myempty, mainobject)
+ mainobject["archimesh.hole_enable"] = True
+ # Rotate Empty
+ myempty.rotation_euler.z = math.radians(mp.r)
+ # Create control box to open wall holes
+ gap = 0.002
+ y = 0
+ z = 0
+ if mp.blind is True:
+ y = mp.blind_rail
+ if mp.blind is True and mp.blind_box is True:
+ z = mp.blind_height
+
+ myctrl = create_control_box("CTRL_Hole",
+ mp.width - gap,
+ mp.depth * 3, # + y,
+ mp.height + z - gap)
+ # Add custom property to detect Controller
+ myctrl["archimesh.ctrl_hole"] = True
+
+ set_normals(myctrl)
+ myctrl.parent = myempty
+ myctrl.location.x = 0
+ myctrl.location.y = -mp.depth * 3 / 2
+ myctrl.location.z = 0
+ myctrl.draw_type = 'BOUNDS'
+ myctrl.hide = False
+ myctrl.hide_render = True
+ myctrl.cycles_visibility.camera = False
+ myctrl.cycles_visibility.diffuse = False
+ myctrl.cycles_visibility.glossy = False
+ myctrl.cycles_visibility.transmission = False
+ myctrl.cycles_visibility.scatter = False
+ myctrl.cycles_visibility.shadow = False
+
+ mat = create_transparent_material("hidden_material", False)
+ set_material(myctrl, mat)
+
+ # deactivate others
+ for o in bpy.data.objects:
+ if o.select is True and o.name != mainobject.name:
+ o.select = False
+
+ return
+
+
+# ------------------------------------------------------------------
+# Define property group class to create or modify
+# ------------------------------------------------------------------
+class ObjectProperties(bpy.types.PropertyGroup):
+ width = bpy.props.FloatProperty(
+ name='Width',
+ min=0.20, max=50,
+ default=1.20, precision=3,
+ description='window width',
+ update=update_object,
+ )
+ depth = bpy.props.FloatProperty(
+ name='Depth',
+ min=0.07, max=1,
+ default=0.10, precision=3,
+ description='window depth',
+ update=update_object,
+ )
+ height = bpy.props.FloatProperty(
+ name='Height',
+ min=0.20, max=50,
+ default=1, precision=3,
+ description='window height',
+ update=update_object,
+ )
+ r = bpy.props.FloatProperty(
+ name='Rotation', min=0, max=360, default=0, precision=1,
+ description='Window rotation',
+ update=update_object,
+ )
+
+ external = bpy.props.BoolProperty(
+ name="External frame",
+ description="Create an external front frame",
+ default=True,
+ update=update_object,
+ )
+ frame = bpy.props.FloatProperty(
+ name='External Frame',
+ min=0.001, max=1,
+ default=0.01, precision=3,
+ description='External Frame size',
+ update=update_object,
+ )
+
+ frame_L = bpy.props.FloatProperty(
+ name='Frame',
+ min=0.02, max=1,
+ default=0.06, precision=3,
+ description='Frame size',
+ update=update_object,
+ )
+ wf = bpy.props.FloatProperty(
+ name='WinFrame',
+ min=0.001, max=1,
+ default=0.05, precision=3,
+ description='Window Frame size',
+ update=update_object,
+ )
+ leafratio = bpy.props.FloatProperty(
+ name='Leaf ratio',
+ min=0.001, max=0.999,
+ default=0.50,
+ precision=3,
+ description='Leaf thickness ratio',
+ update=update_object,
+ )
+ opentype = bpy.props.EnumProperty(
+ items=(
+ ('1', "Rail window", ""),
+ ('2', "Two leaf", ""),
+ ('3', "Right leaf", ""),
+ ('4', "Left leaf", "")),
+ name="Type",
+ description="Defines type of window",
+ update=update_object,
+ )
+ handle = bpy.props.BoolProperty(
+ name="Create handles",
+ description="Create default handle to the leaf",
+ default=True,
+ update=update_object,
+ )
+
+ sill = bpy.props.BoolProperty(
+ name="Sill",
+ description="Add sill to window",
+ default=True,
+ update=update_object,
+ )
+ sill_thickness = bpy.props.FloatProperty(
+ name='Thickness',
+ min=0, max=50,
+ default=0.01, precision=3,
+ description='Sill thickness',
+ update=update_object,
+ )
+ sill_back = bpy.props.FloatProperty(
+ name='Back',
+ min=0, max=10,
+ default=0.0, precision=3,
+ description='Extrusion in back side',
+ update=update_object,
+ )
+ sill_front = bpy.props.FloatProperty(
+ name='Front',
+ min=0, max=10,
+ default=0.12, precision=3,
+ description='Extrusion in front side',
+ update=update_object,
+ )
+
+ blind = bpy.props.BoolProperty(
+ name="Blind",
+ description="Create an external blind",
+ default=False,
+ update=update_object,
+ )
+ blind_box = bpy.props.BoolProperty(
+ name="Blind box", description="Create a box over frame for blind",
+ default=True,
+ update=update_object,
+ )
+ blind_height = bpy.props.FloatProperty(
+ name='Height',
+ min=0.001, max=10,
+ default=0.12, precision=3,
+ description='Blind box height',
+ update=update_object,
+ )
+ blind_back = bpy.props.FloatProperty(
+ name='Back',
+ min=0.001, max=10,
+ default=0.002, precision=3,
+ description='Extrusion in back side',
+ update=update_object,
+ )
+ blind_rail = bpy.props.FloatProperty(
+ name='Separation',
+ min=0.001, max=10,
+ default=0.10, precision=3,
+ description='Separation from frame',
+ update=update_object,
+ )
+ blind_ratio = bpy.props.IntProperty(
+ name='Extend',
+ min=0, max=100,
+ default=20,
+ description='% of extension (100 full extend)',
+ update=update_object,
+ )
+
+ # Materials
+ crt_mat = bpy.props.BoolProperty(
+ name="Create default Cycles materials",
+ description="Create default materials for Cycles render",
+ default=True,
+ update=update_object,
+ )
+ # opengl internal data
+ glpoint_a = bpy.props.FloatVectorProperty(
+ name="glpointa",
+ description="Hidden property for opengl",
+ default=(0, 0, 0),
+ )
+ glpoint_b = bpy.props.FloatVectorProperty(
+ name="glpointb",
+ description="Hidden property for opengl",
+ default=(0, 0, 0),
+ )
+ glpoint_c = bpy.props.FloatVectorProperty(
+ name="glpointc",
+ description="Hidden property for opengl",
+ default=(0, 0, 0),
+ )
+
+# Register
+bpy.utils.register_class(ObjectProperties)
+bpy.types.Object.WindowObjectGenerator = bpy.props.CollectionProperty(type=ObjectProperties)
+
+
+# ------------------------------------------------------------------
+# Define panel class to modify object
+# ------------------------------------------------------------------
+class AchmWindowObjectgeneratorpanel(bpy.types.Panel):
+ bl_idname = "OBJECT_PT_window_generator"
+ bl_label = "Window Rail"
+ bl_space_type = 'VIEW_3D'
+ bl_region_type = 'UI'
+ bl_category = 'Archimesh'
+
+ # -----------------------------------------------------
+ # Verify if visible
+ # -----------------------------------------------------
+ @classmethod
+ def poll(cls, context):
+ o = context.object
+ if o is None:
+ return False
+ if 'WindowObjectGenerator' not in o:
+ return False
+ else:
+ return True
+
+# -----------------------------------------------------
+ # Draw (create UI interface)
+ # -----------------------------------------------------
+ def draw(self, context):
+ o = context.object
+ # noinspection PyBroadException
+ try:
+ if 'WindowObjectGenerator' not in o:
+ return
+ except:
+ return
+
+ layout = self.layout
+ if bpy.context.mode == 'EDIT_MESH':
+ layout.label('Warning: Operator does not work in edit mode.', icon='ERROR')
+ else:
+ myobjdat = o.WindowObjectGenerator[0]
+ space = bpy.context.space_data
+ if not space.local_view:
+ # Imperial units warning
+ if bpy.context.scene.unit_settings.system == "IMPERIAL":
+ row = layout.row()
+ row.label("Warning: Imperial units not supported", icon='COLOR_RED')
+
+ box = layout.box()
+ row = box.row()
+ row.prop(myobjdat, 'opentype')
+ row = box.row()
+ row.label("Window size")
+ row = box.row()
+ row.prop(myobjdat, 'width')
+ row.prop(myobjdat, 'depth')
+ row.prop(myobjdat, 'height')
+ row = box.row()
+ row.prop(myobjdat, 'wf')
+ row = box.row()
+ row.prop(myobjdat, 'r')
+
+ row = box.row()
+ row.prop(myobjdat, 'external')
+ row.prop(myobjdat, 'handle')
+ if myobjdat.external:
+ row.prop(myobjdat, 'frame')
+
+ if myobjdat.opentype != "1":
+ row = box.row()
+ row.prop(myobjdat, 'frame_L')
+ row.prop(myobjdat, 'leafratio', slider=True)
+
+ box = layout.box()
+ row = box.row()
+ row.prop(myobjdat, 'sill')
+ if myobjdat.sill:
+ row = box.row()
+ row.prop(myobjdat, 'sill_thickness')
+ row.prop(myobjdat, 'sill_back')
+ row.prop(myobjdat, 'sill_front')
+
+ box = layout.box()
+ row = box.row()
+ row.prop(myobjdat, 'blind')
+ if myobjdat.blind:
+ row = box.row()
+ row.prop(myobjdat, 'blind_rail')
+ row.prop(myobjdat, 'blind_ratio', slider=True)
+ row = box.row()
+ row.prop(myobjdat, 'blind_box')
+ if myobjdat.blind_box:
+ row.prop(myobjdat, 'blind_height')
+ row.prop(myobjdat, 'blind_back')
+
+ box = layout.box()
+ box.prop(myobjdat, 'crt_mat')
+ else:
+ row = layout.row()
+ row.label("Warning: Operator does not work in local view mode", icon='ERROR')
+
+
+# ------------------------------------------------------------------------------
+# Generate rail windows
+# ------------------------------------------------------------------------------
+def generate_rail_window(myframe, mp, mymesh):
+ myloc = bpy.context.scene.cursor_location
+
+ alummat = None
+ if mp.crt_mat:
+ alummat = create_diffuse_material("Window_material", False, 0.8, 0.8, 0.8, 0.6, 0.6, 0.6, 0.15)
+
+ # Frame
+ win_size, p1, p2 = create_rail_window_frame(myframe, mymesh,
+ mp.width, mp.depth, mp.height,
+ mp.frame,
+ mp.crt_mat, alummat, mp.external,
+ mp.blind and mp.blind_box,
+ mp.blind_height,
+ mp.blind_back,
+ mp.blind_rail)
+
+ remove_doubles(myframe)
+ set_normals(myframe)
+
+ # Window L
+ width = (mp.width / 2) + 0.01
+ mywin_l = create_rail_window_leaf("Window.L", "L",
+ width, win_size, mp.height - 0.05,
+ mp.wf,
+ myloc.x, myloc.y, myloc.z,
+ mp.crt_mat, alummat, mp.handle)
+
+ remove_doubles(mywin_l)
+ set_normals(mywin_l)
+
+ mywin_l.parent = myframe
+ mywin_l.location.x = (-mp.width / 2) + 0.01
+ mywin_l.location.y = p1 - 0.001
+ mywin_l.location.z = 0.025
+ # Window R
+ mywin_r = create_rail_window_leaf("Window.R", "R",
+ width, win_size, mp.height - 0.05,
+ mp.wf,
+ myloc.x, myloc.y, myloc.z,
+ mp.crt_mat, alummat, mp.handle)
+
+ remove_doubles(mywin_r)
+ set_normals(mywin_r)
+
+ mywin_r.parent = myframe
+ mywin_r.location.x = (mp.width / 2) - 0.01
+ mywin_r.location.y = p2 - 0.001
+ mywin_r.location.z = 0.025
+ # Sill
+ if mp.sill:
+ mysill = create_sill("Windows_Sill", mp.width,
+ mp.depth + mp.sill_back + mp.sill_front,
+ mp.sill_thickness, mp.crt_mat)
+ mysill.parent = myframe
+ mysill.location.x = 0
+ mysill.location.y = -mp.depth - mp.sill_back
+ mysill.location.z = 0
+
+ # Blind
+ if mp.blind:
+ myblindrail = create_blind_rail("Blind_rails", mp.width, mp.height,
+ myloc.x, myloc.y, myloc.z,
+ mp.crt_mat, alummat, mp.blind_rail)
+ set_normals(myblindrail)
+
+ myblindrail.parent = myframe
+ myblindrail.location.x = 0
+ myblindrail.location.y = 0
+ myblindrail.location.z = 0
+ # Lock
+ myblindrail.lock_location = (True, True, True)
+ myblindrail.lock_rotation = (True, True, True)
+
+ myblind = create_blind("Blind", mp.width - 0.006, mp.height,
+ myloc.x, myloc.y, myloc.z,
+ mp.crt_mat, mp.blind_ratio)
+ set_normals(myblind)
+
+ myblind.parent = myframe
+ myblind.location.x = 0
+ myblind.location.y = mp.blind_rail - 0.014
+ myblind.location.z = mp.height - 0.098
+ # Lock
+ myblind.lock_location = (True, True, True)
+ myblind.lock_rotation = (True, True, True)
+
+
+# ------------------------------------------------------------------------------
+# Generate leaf windows
+# ------------------------------------------------------------------------------
+def generate_leaf_window(myframe, mp, mymesh):
+ myloc = bpy.context.scene.cursor_location
+
+ alummat = None
+ if mp.crt_mat:
+ alummat = create_diffuse_material("Window_material", False, 0.8, 0.8, 0.8, 0.6, 0.6, 0.6, 0.15)
+
+ # Frame
+ win_size = create_leaf_window_frame(myframe, mymesh,
+ mp.width, mp.depth, mp.height,
+ mp.frame, mp.frame_L, mp.leafratio,
+ mp.crt_mat, alummat, mp.external,
+ mp.blind and mp.blind_box, mp.blind_height, mp.blind_back,
+ mp.blind_rail)
+
+ remove_doubles(myframe)
+ set_normals(myframe)
+
+ stepsize = 0.01
+ # -----------------------------
+ # Window L
+ # -----------------------------
+ if mp.opentype == "2" or mp.opentype == "4":
+ handle = mp.handle
+ if mp.opentype == "2":
+ width = ((mp.width - (mp.frame_L * 2) + stepsize) / 2) + 0.004
+ handle = False # two windows only one handle
+ else:
+ width = mp.width - (mp.frame_L * 2) + stepsize + 0.008
+
+ mywin_l = create_leaf_window_leaf("Window.L", "L",
+ width, win_size, mp.height - (mp.frame_L * 2) + (stepsize * 2) - 0.004,
+ mp.wf,
+ myloc.x, myloc.y, myloc.z,
+ mp.crt_mat, alummat, handle)
+
+ remove_doubles(mywin_l)
+ set_normals(mywin_l)
+
+ mywin_l.parent = myframe
+ mywin_l.location.x = -mp.width / 2 + mp.frame_L - stepsize + 0.001
+ mywin_l.location.y = -mp.depth
+ mywin_l.location.z = mp.frame_L - (stepsize / 2) - 0.003
+ # -----------------------------
+ # Window R
+ # -----------------------------
+ if mp.opentype == "2" or mp.opentype == "3":
+ if mp.opentype == "2":
+ width = ((mp.width - (mp.frame_L * 2) + stepsize) / 2) + 0.003
+ else:
+ width = mp.width - (mp.frame_L * 2) + stepsize + 0.008
+
+ mywin_r = create_leaf_window_leaf("Window.R", "R",
+ width, win_size, mp.height - (mp.frame_L * 2) + (stepsize * 2) - 0.004,
+ mp.wf,
+ myloc.x, myloc.y, myloc.z,
+ mp.crt_mat, alummat, mp.handle)
+
+ remove_doubles(mywin_r)
+ set_normals(mywin_r)
+
+ mywin_r.parent = myframe
+ mywin_r.location.x = mp.width / 2 - mp.frame_L + stepsize - 0.001
+ mywin_r.location.y = -mp.depth
+ mywin_r.location.z = mp.frame_L - (stepsize / 2) - 0.003
+
+ # Sill
+ if mp.sill:
+ mysill = create_sill("Windows_Sill", mp.width,
+ mp.depth + mp.sill_back + mp.sill_front,
+ mp.sill_thickness, mp.crt_mat)
+ mysill.parent = myframe
+ mysill.location.x = 0
+ mysill.location.y = -mp.depth - mp.sill_back
+ mysill.location.z = 0
+
+ # Blind
+ if mp.blind:
+ myblindrail = create_blind_rail("Blind_rails", mp.width, mp.height,
+ myloc.x, myloc.y, myloc.z,
+ mp.crt_mat, alummat, mp.blind_rail)
+ myblindrail.parent = myframe
+ myblindrail.location.x = 0
+ myblindrail.location.y = 0
+ myblindrail.location.z = 0
+ # Lock
+ myblindrail.lock_location = (True, True, True)
+ myblindrail.lock_rotation = (True, True, True)
+
+ myblind = create_blind("Blind", mp.width - 0.006, mp.height,
+ myloc.x, myloc.y, myloc.z,
+ mp.crt_mat, mp.blind_ratio)
+ myblind.parent = myframe
+ myblind.location.x = 0
+ myblind.location.y = mp.blind_rail - 0.014
+ myblind.location.z = mp.height - 0.098
+
+ # Lock
+ myblind.lock_location = (True, True, True)
+ myblind.lock_rotation = (True, True, True)
+
+ # deactivate others
+ for o in bpy.data.objects:
+ if o.select is True:
+ o.select = False
+
+ myframe.select = True
+ bpy.context.scene.objects.active = myframe
+
+ return myframe
+
+
+# ------------------------------------------------------------------------------
+# Create windows frame
+#
+# sX: Size in X axis
+# sY: Size in Y axis
+# sZ: Size in Z axis
+# frame: size of external frame
+# mat: Flag for creating materials
+# matdata: Aluminum material
+# external: create external frame flag
+# blind: blind flag
+# blind_height: height of blind box
+# blind_back: front extension
+# blind_rail: distance of the rail
+# ------------------------------------------------------------------------------
+def create_rail_window_frame(mywindow, mymesh, sx, sy, sz, frame, mat, matdata, external,
+ blind, blind_height, blind_back, blind_rail):
+ myvertex = []
+ myfaces = []
+ v = 0
+ # ===========================================================================
+ # Horizontal pieces
+ # ===========================================================================
+ m = 0.02 # gap in front
+ gap = 0.001 # gap between leafs
+ rail = 0.007 # rail width
+ thick = 0.002 # aluminum thickness
+ w = (sy - m - gap - thick - thick - thick) / 2 # width of each leaf
+ p = (w - rail) / 2 # space of each side
+ side = 0.02 # vertical
+ for z in (0, sz):
+ for x in (-sx / 2, sx / 2):
+ myvertex.extend([(x, 0, z), (x, 0, z + side),
+ (x, -m - p, z + side),
+ (x, -m - p, z + (side * 2)), # rail 1
+ (x, -m - p - rail, z + (side * 2)),
+ (x, -m - p - rail, z + side),
+ (x, -m - p - rail - thick - p - gap - p, z + side),
+ (x, -m - p - rail - thick - p - gap - p, z + (side * 2)), # rail 2
+ (x, -m - p - rail - thick - p - gap - p - rail, z + (side * 2)),
+ (x, -m - p - rail - thick - p - gap - p - rail, z + side),
+ (x, -m - p - rail - thick - p - gap - p - rail - p - thick, z + side)])
+ # Faces
+ myfaces.extend([(v + 12, v + 1, v + 0, v + 11), (v + 13, v + 2, v + 1, v + 12), (v + 14, v + 3, v + 2, v + 13),
+ (v + 15, v + 4, v + 3, v + 14), (v + 16, v + 5, v + 4, v + 15), (v + 17, v + 6, v + 5, v + 16),
+ (v + 18, v + 7, v + 6, v + 17), (v + 19, v + 8, v + 7, v + 18), (v + 20, v + 9, v + 8, v + 19),
+ (v + 20, v + 21, v + 10, v + 9)])
+
+ side *= -1 # reveser direction
+ v = len(myvertex)
+ # ===========================================================================
+ # Vertical pieces
+ # ===========================================================================
+ y = 0
+ sideb = 0.03
+ sides = 0.02
+ thickb = 0.002 # aluminum thickness
+ win_size = p + rail + p
+ p1 = y - m - thick
+ p2 = y - m - thick - gap - p - rail - p - thick
+
+ # Left
+ for x in (-sx / 2, sx / 2):
+ for z in (0, sz):
+ myvertex.extend([(x, y, z),
+ (x + thickb, y, z),
+ (x + thickb, y - m, z),
+ (x + thickb + sides, y - m, z),
+ (x + thickb + sides, y - m - thick, z),
+ (x + thickb, y - m - thick, z),
+ (x + thickb, y - m - thick - gap - p - rail - p, z),
+ (x + thickb + sides, y - m - thick - gap - p - rail - p, z),
+ (x + thickb + sides, y - m - thick - gap - p - rail - p - thick, z),
+ (x + thickb, y - m - thick - gap - p - rail - p - thick, z),
+ (x + thickb, y - m - thick - gap - p - rail - p - thick - p - rail - p, z),
+ (x + thickb + sideb, y - m - thick - gap - p - rail - p - thick - p - rail - p, z),
+ (x + thickb + sideb, y - m - thick - gap - p - rail - p - thick - p - rail - p - thick, z),
+ (x, y - m - thick - gap - p - rail - p - thick - p - rail - p - thick, z)])
+ # Faces
+ myfaces.extend([(v + 13, v + 27, v + 14, v + 0), (v + 13, v + 12, v + 26, v + 27),
+ (v + 11, v + 10, v + 24, v + 25),
+ (v + 6, v + 5, v + 19, v + 20), (v + 10, v + 9, v + 23, v + 24),
+ (v + 25, v + 24, v + 27, v + 26), (v + 24, v + 23, v + 15, v + 16),
+ (v + 22, v + 21, v + 20, v + 23),
+ (v + 17, v + 16, v + 19, v + 18), (v + 9, v + 8, v + 22, v + 23),
+ (v + 7, v + 6, v + 20, v + 21), (v + 3, v + 2, v + 16, v + 17),
+ (v + 5, v + 4, v + 18, v + 19),
+ (v + 4, v + 3, v + 17, v + 18), (v + 7, v + 8, v + 9, v + 6),
+ (v + 3, v + 4, v + 5, v + 2), (v + 11, v + 12, v + 13, v + 10),
+ (v + 6, v + 5, v + 9, v + 10),
+ (v + 1, v + 0, v + 14, v + 15),
+ (v + 19, v + 16, v + 15, v + 14, v + 27, v + 24, v + 23, v + 20),
+ (v + 8, v + 7, v + 21, v + 22), (v + 12, v + 11, v + 25, v + 26),
+ (v + 2, v + 1, v + 15, v + 16),
+ (v + 5, v + 6, v + 9, v + 10, v + 13, v + 0, v + 1, v + 2)])
+
+ v = len(myvertex)
+ # reverse
+ thickb *= -1
+ sideb *= -1
+ sides *= -1
+ # ===========================================================================
+ # Front covers
+ # ===========================================================================
+ x = sx - 0.005 - (sideb * 2) # sideB + small gap
+ y = y - m - thick - gap - p - rail - p - thick - p - rail - p
+ z = sideb
+ # Bottom
+ myvertex.extend([(-x / 2, y - thick, 0.0),
+ (-x / 2, y, 0.0),
+ (x / 2, y, 0.0),
+ (x / 2, y - thick, 0.0),
+ (-x / 2, y - thick, z),
+ (-x / 2, y, z),
+ (x / 2, y, z),
+ (x / 2, y - thick, z)])
+
+ myfaces.extend([(v + 0, v + 1, v + 2, v + 3), (v + 0, v + 1, v + 5, v + 4), (v + 1, v + 2, v + 6, v + 5),
+ (v + 2, v + 6, v + 7, v + 3), (v + 5, v + 6, v + 7, v + 4), (v + 0, v + 4, v + 7, v + 3)])
+ v = len(myvertex)
+ # Top
+ myvertex.extend([(-x / 2, y - thick, sz - sideb),
+ (-x / 2, y, sz - sideb),
+ (x / 2, y, sz - sideb),
+ (x / 2, y - thick, sz - sideb),
+ (-x / 2, y - thick, sz - sideb + z),
+ (-x / 2, y, sz - sideb + z),
+ (x / 2, y, sz - sideb + z),
+ (x / 2, y - thick, sz - sideb + z)])
+
+ myfaces.extend([(v + 0, v + 1, v + 2, v + 3), (v + 0, v + 1, v + 5, v + 4), (v + 1, v + 2, v + 6, v + 5),
+ (v + 2, v + 6, v + 7, v + 3), (v + 5, v + 6, v + 7, v + 4), (v + 0, v + 4, v + 7, v + 3)])
+ v = len(myvertex)
+ # ===========================================================================
+ # External front covers
+ # ===========================================================================
+ if external:
+ x = sx
+ gap = -0.001
+ sidem = frame
+ box = 0
+ if blind:
+ box = blind_height
+
+ myvertex.extend([((-x / 2) - sidem, y - thick, sz + sidem + box),
+ ((x / 2) + sidem, y - thick, sz + sidem + box),
+ ((-x / 2) - sidem, y - thick, -sidem),
+ ((x / 2) + sidem, y - thick, -sidem),
+ ((-x / 2) - gap, y - thick, sz + gap + box),
+ ((x / 2) + gap, y - thick, sz + gap + box),
+ ((-x / 2) - gap, y - thick, -gap),
+ ((x / 2) + gap, y - thick, -gap)])
+ myvertex.extend([((-x / 2) - sidem, y - thick * 2, sz + sidem + box),
+ ((x / 2) + sidem, y - thick * 2, sz + sidem + box),
+ ((-x / 2) - sidem, y - thick * 2, -sidem),
+ ((x / 2) + sidem, y - thick * 2, -sidem),
+ ((-x / 2) - gap, y - thick * 2, sz + gap + box),
+ ((x / 2) + gap, y - thick * 2, sz + gap + box),
+ ((-x / 2) - gap, y - thick * 2, -gap),
+ ((x / 2) + gap, y - thick * 2, -gap)])
+
+ myfaces.extend([(v + 3, v + 1, v + 9, v + 11), (v + 9, v + 8, v + 0, v + 1),
+ (v + 1, v + 5, v + 4, v + 0),
+ (v + 3, v + 7, v + 5, v + 1),
+ (v + 7, v + 3, v + 2, v + 6),
+ (v + 0, v + 4, v + 6, v + 2),
+ (v + 9, v + 13, v + 12, v + 8), (v + 11, v + 15, v + 13, v + 9),
+ (v + 15, v + 11, v + 10, v + 14),
+ (v + 8, v + 12, v + 14, v + 10),
+ (v + 11, v + 3, v + 2, v + 10),
+ (v + 2, v + 10, v + 8, v + 0), (v + 14, v + 12, v + 4, v + 6),
+ (v + 7, v + 6, v + 14, v + 15),
+ (v + 5, v + 13, v + 12, v + 4),
+ (v + 15, v + 7, v + 5, v + 13)])
+
+ mymesh.from_pydata(myvertex, [], myfaces)
+ mymesh.update(calc_edges=True)
+
+ if mat:
+ set_material(mywindow, matdata)
+ # --------------
+ # Blind Box
+ # --------------
+ if blind:
+ mybox = create_blind_box("Blind_box", sx, sy + blind_back + blind_rail, blind_height)
+ set_normals(mybox)
+
+ mybox.parent = mywindow
+ mybox.location.x = 0
+ mybox.location.y = -blind_back - sy
+ mybox.location.z = sz
+ if mat:
+ set_material(mybox, matdata)
+ # Lock
+ mybox.lock_location = (True, True, True)
+ mybox.lock_rotation = (True, True, True)
+
+ return win_size, p1, p2
+
+
+# ------------------------------------------------------------------------------
+# Create leafs windows frame
+#
+# sX: Size in X axis
+# sY: Size in Y axis
+# sZ: Size in Z axis
+# frame: size of external frame
+# frame_L: size of main frame
+# leafratio: ratio of leaf depth
+# mat: Flag for creating materials
+# matdata: Aluminum material
+# external: create external frame flag
+# blind: blind flag
+# blind_height: height of blind box
+# blind_back: front extension
+# blind_rail: distance of the rail
+# ------------------------------------------------------------------------------
+def create_leaf_window_frame(mywindow, mymesh, sx, sy, sz, frame, frame_l, leafratio, mat, matdata, external,
+ blind, blind_height, blind_back, blind_rail):
+ myvertex = []
+ myfaces = []
+ # ===========================================================================
+ # Main frame_L
+ # ===========================================================================
+ x = sx / 2
+ z = sz
+ y = sy * leafratio
+ gap = 0.01
+ size = sy - y - 0.001 # thickness of the leaf
+
+ myvertex.extend([(-x, 0, 0),
+ (-x, 0, z),
+ (x, 0, z),
+ (x, 0, 0),
+ (-x + frame_l, 0, frame_l),
+ (-x + frame_l, 0, z - frame_l),
+ (x - frame_l, 0, z - frame_l),
+ (x - frame_l, 0, frame_l),
+ (-x + frame_l, -y, frame_l),
+ (-x + frame_l, -y, z - frame_l),
+ (x - frame_l, -y, z - frame_l),
+ (x - frame_l, -y, frame_l),
+ (-x + frame_l - gap, -y, frame_l - gap),
+ (-x + frame_l - gap, -y, z - frame_l + gap),
+ (x - frame_l + gap, -y, z - frame_l + gap),
+ (x - frame_l + gap, -y, frame_l - gap),
+ (-x + frame_l - gap, -sy, frame_l - gap),
+ (-x + frame_l - gap, -sy, z - frame_l + gap),
+ (x - frame_l + gap, -sy, z - frame_l + gap),
+ (x - frame_l + gap, -sy, frame_l - gap),
+ (-x, -sy, 0),
+ (-x, -sy, z),
+ (x, -sy, z),
+ (x, -sy, 0)])
+ # Faces
+ myfaces.extend([(1, 5, 4, 0), (21, 1, 0, 20), (17, 21, 20, 16), (16, 12, 13, 17), (12, 8, 9, 13),
+ (5, 9, 8, 4), (3, 7, 6, 2), (23, 3, 2, 22), (19, 23, 22, 18), (15, 19, 18, 14),
+ (11, 15, 14, 10), (6, 7, 11, 10), (0, 3, 23, 20), (21, 22, 2, 1), (17, 13, 14, 18),
+ (21, 17, 18, 22), (13, 9, 10, 14), (8, 11, 7, 4), (8, 12, 15, 11), (4, 7, 3, 0),
+ (12, 16, 19, 15), (16, 20, 23, 19), (9, 5, 6, 10), (1, 2, 6, 5)])
+
+ v = len(myvertex)
+ # ===========================================================================
+ # External front covers
+ # ===========================================================================
+ if external:
+ thick = 0.002 # aluminum thickness
+ x = sx
+ gap = -0.001
+ sidem = frame
+ box = 0
+ if blind:
+ box = blind_height
+
+ myvertex.extend([((-x / 2) - sidem, -sy, sz + sidem + box),
+ ((x / 2) + sidem, -sy, sz + sidem + box),
+ ((-x / 2) - sidem, -sy, -sidem),
+ ((x / 2) + sidem, -sy, -sidem),
+ ((-x / 2) - gap, -sy, sz + gap + box),
+ ((x / 2) + gap, -sy, sz + gap + box),
+ ((-x / 2) - gap, -sy, -gap),
+ ((x / 2) + gap, -sy, -gap)])
+ myvertex.extend([((-x / 2) - sidem, -sy - thick, sz + sidem + box),
+ ((x / 2) + sidem, -sy - thick, sz + sidem + box),
+ ((-x / 2) - sidem, -sy - thick, -sidem),
+ ((x / 2) + sidem, -sy - thick, -sidem),
+ ((-x / 2) - gap, -sy - thick, sz + gap + box),
+ ((x / 2) + gap, -sy - thick, sz + gap + box),
+ ((-x / 2) - gap, -sy - thick, -gap),
+ ((x / 2) + gap, -sy - thick, -gap)])
+
+ myfaces.extend([(v + 3, v + 1, v + 9, v + 11), (v + 9, v + 8, v + 0, v + 1), (v + 1, v + 5, v + 4, v + 0),
+ (v + 3, v + 7, v + 5, v + 1), (v + 7, v + 3, v + 2, v + 6),
+ (v + 0, v + 4, v + 6, v + 2), (v + 9, v + 13, v + 12, v + 8), (v + 11, v + 15, v + 13, v + 9),
+ (v + 15, v + 11, v + 10, v + 14), (v + 8, v + 12, v + 14, v + 10),
+ (v + 11, v + 3, v + 2, v + 10), (v + 2, v + 10, v + 8, v + 0), (v + 14, v + 12, v + 4, v + 6),
+ (v + 7, v + 6, v + 14, v + 15), (v + 5, v + 13, v + 12, v + 4),
+ (v + 15, v + 7, v + 5, v + 13)])
+
+ mymesh.from_pydata(myvertex, [], myfaces)
+ mymesh.update(calc_edges=True)
+
+ if mat is True:
+ set_material(mywindow, matdata)
+
+ # --------------
+ # Blind Box
+ # --------------
+ if blind:
+ mybox = create_blind_box("Blind_box", sx, sy + blind_back + blind_rail, blind_height)
+ set_normals(mybox)
+
+ mybox.parent = mywindow
+ mybox.location.x = 0
+ mybox.location.y = -blind_back - sy
+ mybox.location.z = sz
+ if mat:
+ set_material(mybox, matdata)
+ # Lock
+ mybox.lock_location = (True, True, True)
+ mybox.lock_rotation = (True, True, True)
+
+ return size
+
+
+# ------------------------------------------------------------------------------
+# Create rail windows leaf
+#
+# objName: Name for the new object
+# hand: Left or Right
+# sX: Size in X axis
+# sY: Size in Y axis
+# sZ: Size in Z axis
+# f: size of the frame_L
+# pX: position X axis
+# pY: position Y axis
+# pZ: position Z axis
+# mat: Flag for creating materials
+# matdata: default material
+# handle: create handle flag
+# ------------------------------------------------------------------------------
+def create_rail_window_leaf(objname, hand, sx, sy, sz, f, px, py, pz, mat, matdata, handle):
+ myvertex = []
+ myfaces = []
+ v = 0
+ # ===========================================================================
+ # Horizontal pieces
+ # ===========================================================================
+ rail = 0.010 # rail width
+ t = sy - 0.002
+ p = ((t - rail) / 2) - 0.002
+ side = 0.02 # vertical rail
+
+ x = sx
+ z = sz
+ fz = f
+ if hand == "R":
+ x *= -1
+ f *= -1
+ # ------------------------
+ # frame
+ # ------------------------
+ myvertex.extend([(0, 0, 0),
+ (0, 0, z),
+ (x, 0, z),
+ (x, 0, 0),
+ (f, 0, fz),
+ (f, 0, z - fz),
+ (x - f, 0, z - fz),
+ (x - f, 0, fz),
+ (f, -t / 2, fz),
+ (f, -t / 2, z - fz),
+ (x - f, -t / 2, z - fz),
+ (x - f, -t / 2, fz),
+ (f, -t, fz),
+ (f, -t, z - fz),
+ (x - f, -t, z - fz),
+ (x - f, -t, fz),
+ (0, -t, 0),
+ (0, -t, z),
+ (x, -t, z),
+ (x, -t, 0)])
+ # ------------------------
+ # Side rails
+ # ------------------------
+ for z in (0, sz):
+ myvertex.extend([(0, -p, z),
+ (x, -p, z),
+ (0, -p, z + side),
+ (x, -p, z + side),
+ (0, -p - rail, z + side),
+ (x, -p - rail, z + side),
+ (0, -p - rail, z),
+ (x, -p - rail, z)])
+ side *= -1 # reverse
+ # Faces
+ myfaces.extend([(v + 10, v + 6, v + 7, v + 11), (v + 9, v + 8, v + 4, v + 5),
+ (v + 13, v + 12, v + 8, v + 9), (v + 14, v + 10, v + 11, v + 15),
+ (v + 6, v + 10, v + 9, v + 5),
+ (v + 9, v + 10, v + 14, v + 13), (v + 11, v + 7, v + 4, v + 8), (v + 12, v + 15, v + 11, v + 8),
+ (v + 3, v + 7, v + 6, v + 2),
+ (v + 5, v + 4, v + 0, v + 1),
+ (v + 4, v + 7, v + 3, v + 0), (v + 5, v + 1, v + 2, v + 6), (v + 17, v + 16, v + 12, v + 13),
+ (v + 15, v + 19, v + 18, v + 14),
+ (v + 15, v + 12, v + 16, v + 19),
+ (v + 14, v + 18, v + 17, v + 13), (v + 29, v + 2, v + 1, v + 28),
+ (v + 35, v + 34, v + 17, v + 18), (v + 35, v + 33, v + 32, v + 34),
+ (v + 31, v + 29, v + 28, v + 30),
+ (v + 33, v + 31, v + 30, v + 32), (v + 25, v + 24, v + 22, v + 23),
+ (v + 19, v + 16, v + 26, v + 27),
+ (v + 3, v + 21, v + 20, v + 0), (v + 25, v + 27, v + 26, v + 24),
+ (v + 23, v + 22, v + 20, v + 21), (v + 3, v + 2, v + 29, v + 21),
+ (v + 19, v + 27, v + 35, v + 18),
+ (v + 31, v + 33, v + 25, v + 23), (v + 32, v + 30, v + 22, v + 24),
+ (v + 16, v + 17, v + 34, v + 26), (v + 0, v + 20, v + 28, v + 1)])
+ # Glass
+ if z == 0:
+ myfaces.extend([(v + 10, v + 9, v + 8, v + 11)])
+
+ v = len(myvertex)
+
+ # Faces (last glass)
+ # ------------------------
+ # Plastic parts
+ # ------------------------
+ ps = -0.004
+ gap = -0.0002
+ space = 0.005
+
+ if hand == "R":
+ ps *= -1
+ gap *= -1
+ for z in (0, sz):
+ for x in (0, sx):
+
+ if hand == "R":
+ x *= -1
+ myvertex.extend([(x + gap, -p, z),
+ (x + ps, -p, z),
+ (x + gap, -p, z + side),
+ (x + ps, -p, z + side),
+ (x + gap, -p - rail, z + side),
+ (x + ps, -p - rail, z + side),
+ (x + gap, -p - rail, z),
+ (x + ps, -p - rail, z),
+ (x + gap, -p + rail - space, z),
+ (x + gap, -p - rail - space, z),
+ (x + gap, -p + rail - space, z + (side * 1.5)),
+ (x + gap, -p - rail - space, z + (side * 1.5)),
+ (x + ps, -p + rail - space, z),
+ (x + ps, -p - rail - space, z),
+ (x + ps, -p + rail - space, z + (side * 1.5)),
+ (x + ps, -p - rail - space, z + (side * 1.5))])
+ myfaces.extend([(v + 12, v + 8, v + 10, v + 14), (v + 6, v + 7, v + 5, v + 4), (v + 1, v + 0, v + 2, v + 3),
+ (v + 5, v + 3, v + 2, v + 4), (v + 8, v + 12, v + 1, v + 0),
+ (v + 7, v + 6, v + 9, v + 13), (v + 13, v + 9, v + 11, v + 15),
+ (v + 14, v + 10, v + 11, v + 15),
+ (v + 10, v + 8, v + 0, v + 2, v + 4, v + 6, v + 9, v + 11),
+ (v + 12, v + 14, v + 15, v + 13, v + 7, v + 5, v + 3, v + 1)])
+
+ v = len(myvertex)
+ ps *= -1
+ gap *= -1
+
+ side *= -1 # reverse vertical
+
+ mymesh = bpy.data.meshes.new(objname)
+ mywindow = bpy.data.objects.new(objname, mymesh)
+
+ mywindow.location[0] = px
+ mywindow.location[1] = py
+ mywindow.location[2] = pz
+ bpy.context.scene.objects.link(mywindow)
+
+ mymesh.from_pydata(myvertex, [], myfaces)
+ mymesh.update(calc_edges=True)
+
+ set_normals(mywindow)
+
+ # Lock transformation
+ mywindow.lock_location = (False, True, True) # only X axis
+ mywindow.lock_rotation = (True, True, True)
+
+ # Handle
+ if handle:
+ myhandle = create_rail_handle("Handle", mat)
+ myhandle.parent = mywindow
+ if hand == "R":
+ myhandle.location.x = -0.035
+ else:
+ myhandle.location.x = +0.035
+
+ myhandle.location.y = -sy + 0.001
+ if sz / 2 <= 1:
+ myhandle.location.z = sz / 2
+ else:
+ myhandle.location.z = 1
+
+ if mat is True:
+ set_material(mywindow, matdata)
+ # Glass
+ glass = create_glass_material("Glass_material", False)
+ mywindow.data.materials.append(glass)
+ select_faces(mywindow, 32, True)
+ set_material_faces(mywindow, 1)
+ # Plastic
+ plastic = create_diffuse_material("Plastic_material", False, 0.01, 0.01, 0.01, 0.1, 0.1, 0.1, 0.01)
+ mywindow.data.materials.append(plastic)
+ select_faces(mywindow, 65, True)
+ for fa in range(66, 104):
+ select_faces(mywindow, fa, False)
+
+ set_material_faces(mywindow, 2)
+
+ return mywindow
+
+
+# ------------------------------------------------------------------------------
+# Create leaf windows leaf
+#
+# objName: Name for the new object
+# hand: Left or Right
+# sX: Size in X axis
+# sY: Size in Y axis
+# sZ: Size in Z axis
+# f: size of the frame_L
+# pX: position X axis
+# pY: position Y axis
+# pZ: position Z axis
+# mat: Flag for creating materials
+# matdata: default material
+# handle: include handle
+# ------------------------------------------------------------------------------
+def create_leaf_window_leaf(objname, hand, sx, sy, sz, f, px, py, pz, mat, matdata, handle):
+ myvertex = []
+ myfaces = []
+ x = sx
+ z = sz
+ fz = f
+ t = sy
+ if hand == "R":
+ x *= -1
+ f *= -1
+ # ------------------------
+ # frame
+ # ------------------------
+ myvertex.extend([(0, 0, 0),
+ (0, 0, z),
+ (x, 0, z),
+ (x, 0, 0),
+ (f, 0, fz),
+ (f, 0, z - fz),
+ (x - f, 0, z - fz),
+ (x - f, 0, fz),
+ (f, t / 2, fz),
+ (f, t / 2, z - fz),
+ (x - f, t / 2, z - fz),
+ (x - f, t / 2, fz),
+ (f, t, fz),
+ (f, t, z - fz),
+ (x - f, t, z - fz),
+ (x - f, t, fz),
+ (0, t, 0),
+ (0, t, z),
+ (x, t, z),
+ (x, t, 0)])
+ # Faces
+ myfaces.extend([(13, 14, 10, 9), (10, 6, 5, 9), (11, 7, 4, 8), (12, 15, 11, 8), (13, 9, 8, 12),
+ (9, 5, 4, 8), (10, 14, 15, 11), (6, 10, 11, 7), (19, 3, 2, 18), (17, 1, 0, 16),
+ (2, 1, 17, 18), (19, 16, 0, 3), (13, 17, 18, 14), (15, 14, 18, 19), (13, 12, 16, 17),
+ (12, 16, 19, 15), (6, 7, 3, 2), (4, 5, 1, 0), (5, 6, 2, 1), (4, 7, 3, 0),
+ (10, 9, 8, 11)])
+
+ mymesh = bpy.data.meshes.new(objname)
+ mywindow = bpy.data.objects.new(objname, mymesh)
+
+ mywindow.location[0] = px
+ mywindow.location[1] = py
+ mywindow.location[2] = pz
+ bpy.context.scene.objects.link(mywindow)
+
+ mymesh.from_pydata(myvertex, [], myfaces)
+ mymesh.update(calc_edges=True)
+
+ set_normals(mywindow)
+
+ # Lock transformation
+ mywindow.lock_location = (True, True, True)
+ mywindow.lock_rotation = (True, True, False)
+
+ if handle:
+ myhandle = create_leaf_handle("Handle", mat)
+ if hand == "L":
+ myhandle.rotation_euler = (0, math.pi, 0)
+
+ myhandle.parent = mywindow
+ if hand == "R":
+ myhandle.location.x = -sx + 0.025
+ else:
+ myhandle.location.x = sx - 0.025
+
+ myhandle.location.y = 0
+ if sz / 2 <= 1:
+ myhandle.location.z = sz / 2
+ else:
+ myhandle.location.z = 1
+
+ set_smooth(myhandle)
+ set_modifier_subsurf(myhandle)
+
+ if mat is True:
+ set_material(mywindow, matdata)
+ # Glass
+ glass = create_glass_material("Glass_material", False)
+ mywindow.data.materials.append(glass)
+ select_faces(mywindow, 20, True)
+ set_material_faces(mywindow, 1)
+ return mywindow
+
+
+# ------------------------------------------------------------
+# Generate Leaf handle
+#
+# objName: Object name
+# mat: create materials
+# ------------------------------------------------------------
+def create_leaf_handle(objname, mat):
+ # ------------------------------------
+ # Mesh data
+ # ------------------------------------
+ minx = -0.018522918224334717
+ maxx = 0.10613098740577698
+ miny = -0.04866280406713486
+ maxy = 0.0002815350890159607
+ minz = -0.06269633769989014
+ maxz = 0.06289216876029968
+
+ # Vertex
+ myvertex = [(minx + 0.00752672553062439, maxy - 0.0176689475774765, minz + 0.0503292977809906),
+ (minx + 0.002989441156387329, maxy - 0.017728276550769806, minz + 0.057490378618240356),
+ (minx + 0.002640664577484131, maxy - 0.01777590811252594, maxz - 0.05962774157524109),
+ (minx + 0.006573766469955444, maxy - 0.017799079418182373, maxz - 0.05211767554283142),
+ (minx + 0.013735026121139526, maxy - 0.01779157668352127, maxz - 0.04758024215698242),
+ (minx + 0.0222054123878479, maxy - 0.017755411565303802, maxz - 0.04723122715950012),
+ (minx + 0.02971544861793518, maxy - 0.01770026981830597, maxz - 0.0511641800403595),
+ (minx + 0.03425273299217224, maxy - 0.017640933394432068, maxz - 0.058325231075286865),
+ (minx + 0.03460153937339783, maxy - 0.01759330928325653, minz + 0.05879288911819458),
+ (minx + 0.03066837787628174, maxy - 0.017570137977600098, minz + 0.051282793283462524),
+ (minx + 0.02350717782974243, maxy - 0.017577648162841797, minz + 0.046745359897613525),
+ (minx + 0.01503676176071167, maxy - 0.017613813281059265, minz + 0.046396344900131226),
+ (minx + 0.007489442825317383, maxy - 0.009374044835567474, minz + 0.05037441849708557),
+ (minx + 0.00295218825340271, maxy - 0.009433373808860779, minz + 0.05753546953201294),
+ (minx + 0.0026033520698547363, maxy - 0.009481005370616913, maxz - 0.05958262085914612),
+ (minx + 0.006536513566970825, maxy - 0.009206198155879974, maxz - 0.05207255482673645),
+ (minx + 0.013697713613510132, maxy - 0.009206198155879974, maxz - 0.04753512144088745),
+ (minx + 0.029678165912628174, maxy - 0.009206198155879974, maxz - 0.051119059324264526),
+ (minx + 0.034215450286865234, maxy - 0.009206198155879974, maxz - 0.05828014016151428),
+ (minx + 0.03456425666809082, maxy - 0.009298399090766907, minz + 0.05883798003196716),
+ (minx + 0.03063112497329712, maxy - 0.00927523523569107, minz + 0.051327913999557495),
+ (minx + 0.023469924926757812, maxy - 0.009282737970352173, minz + 0.046790480613708496),
+ (minx + 0.014999479055404663, maxy - 0.009318903088569641, minz + 0.046441465616226196),
+ (minx + 0.009239286184310913, maxy - 0.017671361565589905, minz + 0.052188992500305176),
+ (minx + 0.00540238618850708, maxy - 0.017721541225910187, minz + 0.058244675397872925),
+ (minx + 0.005107402801513672, maxy - 0.017761819064617157, maxz - 0.06018096208572388),
+ (minx + 0.00843346118927002, maxy - 0.01778140664100647, maxz - 0.05383017659187317),
+ (minx + 0.014489203691482544, maxy - 0.017775066196918488, maxz - 0.049993157386779785),
+ (minx + 0.021652132272720337, maxy - 0.017744481563568115, maxz - 0.04969802498817444),
+ (minx + 0.028002887964248657, maxy - 0.01769784837961197, maxz - 0.053023844957351685),
+ (minx + 0.03183978796005249, maxy - 0.01764768362045288, maxz - 0.059079527854919434),
+ (minx + 0.03213474154472351, maxy - 0.01760740578174591, minz + 0.05934610962867737),
+ (minx + 0.02880874276161194, maxy - 0.017587818205356598, minz + 0.05299532413482666),
+ (minx + 0.02275294065475464, maxy - 0.01759415864944458, minz + 0.04915827512741089),
+ (minx + 0.015590071678161621, maxy - 0.017624743282794952, minz + 0.04886317253112793),
+ (minx + 0.004389584064483643, maxy - 0.0009383484721183777, minz + 0.05804264545440674),
+ (minx + 0.00849863886833191, maxy - 0.0009383484721183777, minz + 0.0515575110912323),
+ (minx + 0.00407370924949646, maxy - 0.0009383484721183777, maxz - 0.05987495183944702),
+ (minx + 0.007635623216629028, maxy - 0.0009383484721183777, maxz - 0.053073734045028687),
+ (minx + 0.014120936393737793, maxy - 0.0009383484721183777, maxz - 0.04896456003189087),
+ (minx + 0.021791845560073853, maxy - 0.0009383484721183777, maxz - 0.04864847660064697),
+ (minx + 0.0285930335521698, maxy - 0.0009383484721183777, maxz - 0.052210211753845215),
+ (minx + 0.03270205855369568, maxy - 0.0009383484721183777, maxz - 0.05869537591934204),
+ (minx + 0.03301793336868286, maxy - 0.0009383484721183777, minz + 0.05922222137451172),
+ (minx + 0.02945604920387268, maxy - 0.0009383484721183777, minz + 0.052421003580093384),
+ (minx + 0.022970736026763916, maxy - 0.0009383484721183777, minz + 0.048311829566955566),
+ (minx + 0.015299826860427856, maxy - 0.0009383484721183777, minz + 0.04799577593803406),
+ (minx + 0.009323716163635254, maxy - 0.012187294661998749, minz + 0.05233737826347351),
+ (minx + 0.0055314600467681885, maxy - 0.01223689317703247, minz + 0.05832257866859436),
+ (minx + 0.005239963531494141, maxy - 0.012276701629161835, maxz - 0.06018644571304321),
+ (minx + 0.008527249097824097, maxy - 0.012296058237552643, maxz - 0.05390956997871399),
+ (minx + 0.01451253890991211, maxy - 0.012289784848690033, maxz - 0.05011719465255737),
+ (minx + 0.02159211039543152, maxy - 0.012259557843208313, maxz - 0.04982548952102661),
+ (minx + 0.027868926525115967, maxy - 0.012213476002216339, maxz - 0.05311262607574463),
+ (minx + 0.03166118264198303, maxy - 0.012163884937763214, maxz - 0.05909779667854309),
+ (minx + 0.03195270895957947, maxy - 0.01212407648563385, minz + 0.059411197900772095),
+ (minx + 0.028665393590927124, maxy - 0.012104712426662445, minz + 0.05313432216644287),
+ (minx + 0.02268010377883911, maxy - 0.012110985815525055, minz + 0.049341946840286255),
+ (minx + 0.01560056209564209, maxy - 0.012141212821006775, minz + 0.04905024170875549),
+ (minx + 0.009444117546081543, miny + 0.009956002235412598, minz + 0.05219161510467529),
+ (minx + 0.005651921033859253, miny + 0.00990641862154007, minz + 0.05817681550979614),
+ (minx + 0.005360394716262817, miny + 0.009866602718830109, maxz - 0.06033217906951904),
+ (minx + 0.008647710084915161, miny + 0.009847238659858704, maxz - 0.05405530333518982),
+ (minx + 0.014632970094680786, miny + 0.009853512048721313, maxz - 0.0502629280090332),
+ (minx + 0.021712541580200195, miny + 0.00988374650478363, maxz - 0.04997122287750244),
+ (minx + 0.02798938751220703, miny + 0.009929820895195007, maxz - 0.05325835943222046),
+ (minx + 0.03178161382675171, miny + 0.00997941941022873, maxz - 0.05924355983734131),
+ (minx + 0.032073140144348145, miny + 0.010019220411777496, minz + 0.05926543474197388),
+ (minx + 0.02878585457801819, miny + 0.010038584470748901, minz + 0.05298855900764465),
+ (minx + 0.022800534963607788, miny + 0.010032311081886292, minz + 0.04919618368148804),
+ (minx + 0.015720993280410767, miny + 0.010002091526985168, minz + 0.04890450835227966),
+ (minx + 0.009488403797149658, miny + 0.0001087486743927002, minz + 0.05213809013366699),
+ (minx + 0.0056961774826049805, miny + 5.917251110076904e-05, minz + 0.058123260736465454),
+ (minx + 0.005404621362686157, miny + 1.9356608390808105e-05, maxz - 0.06038573384284973),
+ (minx + 0.008691936731338501, miny, maxz - 0.05410885810852051),
+ (minx + 0.014677256345748901, miny + 6.258487701416016e-06, maxz - 0.05031648278236389),
+ (minx + 0.021756768226623535, miny + 3.650784492492676e-05, maxz - 0.05002477765083313),
+ (minx + 0.02803361415863037, miny + 8.258223533630371e-05, maxz - 0.05331191420555115),
+ (minx + 0.031825870275497437, miny + 0.00013218075037002563, maxz - 0.05929708480834961),
+ (minx + 0.03211739659309387, miny + 0.00017196685075759888, minz + 0.059211909770965576),
+ (minx + 0.028830111026763916, miny + 0.00019133836030960083, minz + 0.052935004234313965),
+ (minx + 0.022844791412353516, miny + 0.0001850724220275879, minz + 0.04914262890815735),
+ (minx + 0.015765219926834106, miny + 0.00015483051538467407, minz + 0.04885092377662659),
+ (maxx - 0.010264694690704346, miny + 0.0024030879139900208, minz + 0.0574510395526886),
+ (maxx - 0.009389877319335938, miny + 0.0028769299387931824, minz + 0.05982285737991333),
+ (maxx - 0.00899556279182434, miny + 0.003135383129119873, maxz - 0.06170690059661865),
+ (maxx - 0.00918734073638916, miny + 0.003109179437160492, maxz - 0.0570487380027771),
+ (maxx - 0.009913921356201172, miny + 0.002805367112159729, maxz - 0.0530393123626709),
+ (maxx - 0.010980546474456787, miny + 0.002305328845977783, maxz - 0.0507529079914093),
+ (maxx - 0.011445850133895874, miny + 0.008283689618110657, minz + 0.05754268169403076),
+ (maxx - 0.010571062564849854, miny + 0.008757516741752625, minz + 0.059914469718933105),
+ (maxx - 0.01017671823501587, miny + 0.009015955030918121, maxz - 0.06161528825759888),
+ (maxx - 0.010368555784225464, miny + 0.008989766240119934, maxz - 0.056957095861434937),
+ (maxx - 0.011095106601715088, miny + 0.008685953915119171, maxz - 0.05294764041900635),
+ (maxx - 0.012161701917648315, miny + 0.008185915648937225, maxz - 0.050661295652389526),
+ (maxx - 0.0007557570934295654, miny + 0.019280850887298584, minz + 0.05762714147567749),
+ (maxx - 0.0026130378246307373, miny + 0.019916504621505737, minz + 0.05755424499511719),
+ (maxx - 0.00020641088485717773, miny + 0.020433299243450165, minz + 0.059989362955093384),
+ (maxx, miny + 0.021083541214466095, maxz - 0.06154590845108032),
+ (maxx - 0.00019183754920959473, miny + 0.021057337522506714, maxz - 0.05688774585723877),
+ (maxx - 0.0007305145263671875, miny + 0.020361721515655518, maxz - 0.05287277698516846),
+ (maxx - 0.0014716684818267822, miny + 0.019183076918125153, maxz - 0.05057680606842041),
+ (maxx - 0.0033288896083831787, miny + 0.0198187455534935, maxz - 0.0506497323513031),
+ (maxx - 0.0020636916160583496, miny + 0.021068952977657318, minz + 0.05991646647453308),
+ (maxx - 0.0018572509288787842, miny + 0.021719202399253845, maxz - 0.061618804931640625),
+ (maxx - 0.002049088478088379, miny + 0.021692998707294464, maxz - 0.05696064233779907),
+ (maxx - 0.002587735652923584, miny + 0.020997390151023865, maxz - 0.05294567346572876),
+ (minx + 0.018761008977890015, miny + 9.564310312271118e-05, minz + 0.062207311391830444),
+ (minx + 0.0222054123878479, maxy - 0.009206198155879974, maxz - 0.04723122715950012),
+ (minx, maxy - 0.009349517524242401, minz),
+ (minx, maxy, minz),
+ (minx + 0.03702586889266968, maxy, minz),
+ (minx + 0.03702586889266968, maxy - 0.009349517524242401, minz),
+ (minx, maxy - 0.009349517524242401, maxz),
+ (minx, maxy, maxz),
+ (minx + 0.03702586889266968, maxy, maxz),
+ (minx + 0.03702586889266968, maxy - 0.009349517524242401, maxz),
+ (minx, maxy - 0.009349517524242401, minz + 0.0038556158542633057),
+ (minx, maxy - 0.009349517524242401, maxz - 0.0038556158542633057),
+ (minx, maxy, maxz - 0.0038556158542633057),
+ (minx, maxy, minz + 0.0038556158542633057),
+ (minx + 0.03702586889266968, maxy, maxz - 0.0038556158542633057),
+ (minx + 0.03702586889266968, maxy, minz + 0.0038556158542633057),
+ (minx + 0.03702586889266968, maxy - 0.009349517524242401, maxz - 0.0038556158542633057),
+ (minx + 0.03702586889266968, maxy - 0.009349517524242401, minz + 0.0038556158542633057),
+ (minx, maxy, maxz),
+ (minx, maxy, minz),
+ (minx + 0.03702586889266968, maxy, maxz),
+ (minx + 0.03702586889266968, maxy, minz),
+ (minx, maxy, maxz - 0.0038556158542633057),
+ (minx, maxy, minz + 0.0038556158542633057),
+ (minx + 0.03702586889266968, maxy, maxz - 0.0038556158542633057),
+ (minx + 0.03702586889266968, maxy, minz + 0.0038556158542633057),
+ (minx + 0.00467991828918457, maxy, maxz),
+ (minx + 0.03234601020812988, maxy, maxz),
+ (minx + 0.03234601020812988, maxy, minz),
+ (minx + 0.00467991828918457, maxy, minz),
+ (minx + 0.03234601020812988, maxy - 0.009349517524242401, maxz),
+ (minx + 0.00467991828918457, maxy - 0.009349517524242401, maxz),
+ (minx + 0.00467991828918457, maxy - 0.009349517524242401, minz),
+ (minx + 0.03234601020812988, maxy - 0.009349517524242401, minz),
+ (minx + 0.03234601020812988, maxy, maxz - 0.0038556158542633057),
+ (minx + 0.00467991828918457, maxy, maxz - 0.0038556158542633057),
+ (minx + 0.03234601020812988, maxy, minz + 0.0038556158542633057),
+ (minx + 0.00467991828918457, maxy, minz + 0.0038556158542633057),
+ (minx + 0.00467991828918457, maxy - 0.009349517524242401, maxz - 0.0038556158542633057),
+ (minx + 0.03234601020812988, maxy - 0.009349517524242401, maxz - 0.0038556158542633057),
+ (minx + 0.00467991828918457, maxy - 0.009349517524242401, minz + 0.0038556158542633057),
+ (minx + 0.03234601020812988, maxy - 0.009349517524242401, minz + 0.0038556158542633057),
+ (minx + 0.00467991828918457, maxy, minz),
+ (minx + 0.03234601020812988, maxy, minz),
+ (minx + 0.03234601020812988, maxy, maxz),
+ (minx + 0.00467991828918457, maxy, maxz),
+ (minx + 0.01765689253807068, maxy - 0.008991599082946777, maxz - 0.00847548246383667),
+ (minx + 0.014916181564331055, maxy - 0.008991599082946777, maxz - 0.00961071252822876),
+ (minx + 0.013780921697616577, maxy - 0.008991606533527374, maxz - 0.012351423501968384),
+ (minx + 0.014916181564331055, maxy - 0.008991606533527374, maxz - 0.015092134475708008),
+ (minx + 0.01765689253807068, maxy - 0.008991606533527374, maxz - 0.016227364540100098),
+ (minx + 0.02039763331413269, maxy - 0.008991606533527374, maxz - 0.015092134475708008),
+ (minx + 0.021532833576202393, maxy - 0.008991606533527374, maxz - 0.012351423501968384),
+ (minx + 0.02039763331413269, maxy - 0.008991599082946777, maxz - 0.00961071252822876),
+ (minx + 0.01765689253807068, maxy - 0.0095299631357193, maxz - 0.00847548246383667),
+ (minx + 0.014916181564331055, maxy - 0.0095299631357193, maxz - 0.00961071252822876),
+ (minx + 0.013780921697616577, maxy - 0.0095299631357193, maxz - 0.012351423501968384),
+ (minx + 0.014916181564331055, maxy - 0.0095299631357193, maxz - 0.015092134475708008),
+ (minx + 0.01765689253807068, maxy - 0.0095299631357193, maxz - 0.016227364540100098),
+ (minx + 0.02039763331413269, maxy - 0.0095299631357193, maxz - 0.015092134475708008),
+ (minx + 0.021532833576202393, maxy - 0.0095299631357193, maxz - 0.012351423501968384),
+ (minx + 0.02039763331413269, maxy - 0.0095299631357193, maxz - 0.00961071252822876),
+ (minx + 0.01765689253807068, maxy - 0.0095299631357193, maxz - 0.009734481573104858),
+ (minx + 0.0158064067363739, maxy - 0.0095299631357193, maxz - 0.010500967502593994),
+ (minx + 0.015039980411529541, maxy - 0.0095299631357193, maxz - 0.012351423501968384),
+ (minx + 0.0158064067363739, maxy - 0.0095299631357193, maxz - 0.014201879501342773),
+ (minx + 0.01765689253807068, maxy - 0.0095299631357193, maxz - 0.014968395233154297),
+ (minx + 0.01950731873512268, maxy - 0.0095299631357193, maxz - 0.014201879501342773),
+ (minx + 0.020273834466934204, maxy - 0.0095299631357193, maxz - 0.012351423501968384),
+ (minx + 0.01950731873512268, maxy - 0.0095299631357193, maxz - 0.010500967502593994),
+ (minx + 0.01765689253807068, maxy - 0.009312078356742859, maxz - 0.009734481573104858),
+ (minx + 0.0158064067363739, maxy - 0.009312078356742859, maxz - 0.010500967502593994),
+ (minx + 0.015039980411529541, maxy - 0.009312078356742859, maxz - 0.012351423501968384),
+ (minx + 0.0158064067363739, maxy - 0.009312078356742859, maxz - 0.014201879501342773),
+ (minx + 0.01765689253807068, maxy - 0.009312078356742859, maxz - 0.014968395233154297),
+ (minx + 0.01950731873512268, maxy - 0.009312078356742859, maxz - 0.014201879501342773),
+ (minx + 0.020273834466934204, maxy - 0.009312078356742859, maxz - 0.012351423501968384),
+ (minx + 0.01950731873512268, maxy - 0.009312078356742859, maxz - 0.010500967502593994),
+ (minx + 0.01765689253807068, maxy - 0.009312078356742859, maxz - 0.01099047064781189),
+ (minx + 0.01669454574584961, maxy - 0.009312078356742859, maxz - 0.011389046907424927),
+ (minx + 0.016295909881591797, maxy - 0.009312078356742859, maxz - 0.012351423501968384),
+ (minx + 0.01669454574584961, maxy - 0.009312078356742859, maxz - 0.013313770294189453),
+ (minx + 0.01765689253807068, maxy - 0.009312078356742859, maxz - 0.013712406158447266),
+ (minx + 0.01861920952796936, maxy - 0.009312078356742859, maxz - 0.013313770294189453),
+ (minx + 0.019017815589904785, maxy - 0.009312078356742859, maxz - 0.012351423501968384),
+ (minx + 0.01861920952796936, maxy - 0.009312078356742859, maxz - 0.011389046907424927),
+ (minx + 0.01765689253807068, maxy - 0.009312078356742859, maxz - 0.011496275663375854),
+ (minx + 0.01705223321914673, maxy - 0.009312078356742859, maxz - 0.011746734380722046),
+ (minx + 0.01680171489715576, maxy - 0.009312078356742859, maxz - 0.012351423501968384),
+ (minx + 0.01705223321914673, maxy - 0.009312078356742859, maxz - 0.012956112623214722),
+ (minx + 0.01765689253807068, maxy - 0.009312078356742859, maxz - 0.013206571340560913),
+ (minx + 0.018261581659317017, maxy - 0.009312078356742859, maxz - 0.012956112623214722),
+ (minx + 0.018512040376663208, maxy - 0.009312078356742859, maxz - 0.012351423501968384),
+ (minx + 0.018261581659317017, maxy - 0.009312078356742859, maxz - 0.011746734380722046),
+ (minx + 0.01765689253807068, maxy - 0.009564712643623352, maxz - 0.009734481573104858),
+ (minx + 0.0158064067363739, maxy - 0.009564712643623352, maxz - 0.010500967502593994),
+ (minx + 0.015039980411529541, maxy - 0.009564712643623352, maxz - 0.012351423501968384),
+ (minx + 0.0158064067363739, maxy - 0.009564712643623352, maxz - 0.014201879501342773),
+ (minx + 0.01765689253807068, maxy - 0.009564712643623352, maxz - 0.014968395233154297),
+ (minx + 0.01950731873512268, maxy - 0.009564712643623352, maxz - 0.014201879501342773),
+ (minx + 0.020273834466934204, maxy - 0.009564712643623352, maxz - 0.012351423501968384),
+ (minx + 0.01950731873512268, maxy - 0.009564712643623352, maxz - 0.010500967502593994),
+ (minx + 0.01765689253807068, maxy - 0.009564712643623352, maxz - 0.01099047064781189),
+ (minx + 0.01669454574584961, maxy - 0.009564712643623352, maxz - 0.011389046907424927),
+ (minx + 0.016295909881591797, maxy - 0.009564712643623352, maxz - 0.012351423501968384),
+ (minx + 0.01669454574584961, maxy - 0.009564712643623352, maxz - 0.013313770294189453),
+ (minx + 0.01765689253807068, maxy - 0.009564712643623352, maxz - 0.013712406158447266),
+ (minx + 0.01861920952796936, maxy - 0.009564712643623352, maxz - 0.013313770294189453),
+ (minx + 0.019017815589904785, maxy - 0.009564712643623352, maxz - 0.012351423501968384),
+ (minx + 0.01861920952796936, maxy - 0.009564712643623352, maxz - 0.011389046907424927),
+ (minx + 0.01765689253807068, maxy - 0.009564712643623352, maxz - 0.011496275663375854),
+ (minx + 0.01705223321914673, maxy - 0.009564712643623352, maxz - 0.011746734380722046),
+ (minx + 0.01680171489715576, maxy - 0.009564712643623352, maxz - 0.012351423501968384),
+ (minx + 0.01705223321914673, maxy - 0.009564712643623352, maxz - 0.012956112623214722),
+ (minx + 0.01765689253807068, maxy - 0.009564712643623352, maxz - 0.013206571340560913),
+ (minx + 0.018261581659317017, maxy - 0.009564712643623352, maxz - 0.012956112623214722),
+ (minx + 0.018512040376663208, maxy - 0.009564712643623352, maxz - 0.012351423501968384),
+ (minx + 0.018261581659317017, maxy - 0.009564712643623352, maxz - 0.011746734380722046),
+ (minx + 0.01765689253807068, maxy - 0.008991599082946777, minz + 0.017180711030960083),
+ (minx + 0.014916181564331055, maxy - 0.008991599082946777, minz + 0.016045480966567993),
+ (minx + 0.013780921697616577, maxy - 0.008991606533527374, minz + 0.01330476999282837),
+ (minx + 0.014916181564331055, maxy - 0.008991606533527374, minz + 0.010564059019088745),
+ (minx + 0.01765689253807068, maxy - 0.008991606533527374, minz + 0.009428799152374268),
+ (minx + 0.02039763331413269, maxy - 0.008991606533527374, minz + 0.010564059019088745),
+ (minx + 0.021532833576202393, maxy - 0.008991606533527374, minz + 0.01330476999282837),
+ (minx + 0.02039763331413269, maxy - 0.008991599082946777, minz + 0.016045480966567993),
+ (minx + 0.01765689253807068, maxy - 0.0095299631357193, minz + 0.017180711030960083),
+ (minx + 0.014916181564331055, maxy - 0.0095299631357193, minz + 0.016045480966567993),
+ (minx + 0.013780921697616577, maxy - 0.0095299631357193, minz + 0.01330476999282837),
+ (minx + 0.014916181564331055, maxy - 0.0095299631357193, minz + 0.010564059019088745),
+ (minx + 0.01765689253807068, maxy - 0.0095299631357193, minz + 0.009428799152374268),
+ (minx + 0.02039763331413269, maxy - 0.0095299631357193, minz + 0.010564059019088745),
+ (minx + 0.021532833576202393, maxy - 0.0095299631357193, minz + 0.01330476999282837),
+ (minx + 0.02039763331413269, maxy - 0.0095299631357193, minz + 0.016045480966567993),
+ (minx + 0.01765689253807068, maxy - 0.0095299631357193, minz + 0.015921711921691895),
+ (minx + 0.0158064067363739, maxy - 0.0095299631357193, minz + 0.015155225992202759),
+ (minx + 0.015039980411529541, maxy - 0.0095299631357193, minz + 0.01330476999282837),
+ (minx + 0.0158064067363739, maxy - 0.0095299631357193, minz + 0.01145431399345398),
+ (minx + 0.01765689253807068, maxy - 0.0095299631357193, minz + 0.010687828063964844),
+ (minx + 0.01950731873512268, maxy - 0.0095299631357193, minz + 0.01145431399345398),
+ (minx + 0.020273834466934204, maxy - 0.0095299631357193, minz + 0.01330476999282837),
+ (minx + 0.01950731873512268, maxy - 0.0095299631357193, minz + 0.015155225992202759),
+ (minx + 0.01765689253807068, maxy - 0.009312078356742859, minz + 0.015921711921691895),
+ (minx + 0.0158064067363739, maxy - 0.009312078356742859, minz + 0.015155225992202759),
+ (minx + 0.015039980411529541, maxy - 0.009312078356742859, minz + 0.01330476999282837),
+ (minx + 0.0158064067363739, maxy - 0.009312078356742859, minz + 0.01145431399345398),
+ (minx + 0.01765689253807068, maxy - 0.009312078356742859, minz + 0.010687828063964844),
+ (minx + 0.01950731873512268, maxy - 0.009312078356742859, minz + 0.01145431399345398),
+ (minx + 0.020273834466934204, maxy - 0.009312078356742859, minz + 0.01330476999282837),
+ (minx + 0.01950731873512268, maxy - 0.009312078356742859, minz + 0.015155225992202759),
+ (minx + 0.01765689253807068, maxy - 0.009312078356742859, minz + 0.014665752649307251),
+ (minx + 0.01669454574584961, maxy - 0.009312078356742859, minz + 0.014267116785049438),
+ (minx + 0.016295909881591797, maxy - 0.009312078356742859, minz + 0.01330476999282837),
+ (minx + 0.01669454574584961, maxy - 0.009312078356742859, minz + 0.012342393398284912),
+ (minx + 0.01765689253807068, maxy - 0.009312078356742859, minz + 0.011943817138671875),
+ (minx + 0.01861920952796936, maxy - 0.009312078356742859, minz + 0.012342393398284912),
+ (minx + 0.019017815589904785, maxy - 0.009312078356742859, minz + 0.01330476999282837),
+ (minx + 0.01861920952796936, maxy - 0.009312078356742859, minz + 0.014267116785049438),
+ (minx + 0.01765689253807068, maxy - 0.009312078356742859, minz + 0.014159917831420898),
+ (minx + 0.01705223321914673, maxy - 0.009312078356742859, minz + 0.01390942931175232),
+ (minx + 0.01680171489715576, maxy - 0.009312078356742859, minz + 0.01330476999282837),
+ (minx + 0.01705223321914673, maxy - 0.009312078356742859, minz + 0.012700080871582031),
+ (minx + 0.01765689253807068, maxy - 0.009312078356742859, minz + 0.012449592351913452),
+ (minx + 0.018261581659317017, maxy - 0.009312078356742859, minz + 0.012700080871582031),
+ (minx + 0.018512040376663208, maxy - 0.009312078356742859, minz + 0.01330476999282837),
+ (minx + 0.018261581659317017, maxy - 0.009312078356742859, minz + 0.01390942931175232),
+ (minx + 0.01765689253807068, maxy - 0.009564712643623352, minz + 0.015921711921691895),
+ (minx + 0.0158064067363739, maxy - 0.009564712643623352, minz + 0.015155225992202759),
+ (minx + 0.015039980411529541, maxy - 0.009564712643623352, minz + 0.01330476999282837),
+ (minx + 0.0158064067363739, maxy - 0.009564712643623352, minz + 0.01145431399345398),
+ (minx + 0.01765689253807068, maxy - 0.009564712643623352, minz + 0.010687828063964844),
+ (minx + 0.01950731873512268, maxy - 0.009564712643623352, minz + 0.01145431399345398),
+ (minx + 0.020273834466934204, maxy - 0.009564712643623352, minz + 0.01330476999282837),
+ (minx + 0.01950731873512268, maxy - 0.009564712643623352, minz + 0.015155225992202759),
+ (minx + 0.01765689253807068, maxy - 0.009564712643623352, minz + 0.014665752649307251),
+ (minx + 0.01669454574584961, maxy - 0.009564712643623352, minz + 0.014267116785049438),
+ (minx + 0.016295909881591797, maxy - 0.009564712643623352, minz + 0.01330476999282837),
+ (minx + 0.01669454574584961, maxy - 0.009564712643623352, minz + 0.012342393398284912),
+ (minx + 0.01765689253807068, maxy - 0.009564712643623352, minz + 0.011943817138671875),
+ (minx + 0.01861920952796936, maxy - 0.009564712643623352, minz + 0.012342393398284912),
+ (minx + 0.019017815589904785, maxy - 0.009564712643623352, minz + 0.01330476999282837),
+ (minx + 0.01861920952796936, maxy - 0.009564712643623352, minz + 0.014267116785049438),
+ (minx + 0.01765689253807068, maxy - 0.009564712643623352, minz + 0.014159917831420898),
+ (minx + 0.01705223321914673, maxy - 0.009564712643623352, minz + 0.01390942931175232),
+ (minx + 0.01680171489715576, maxy - 0.009564712643623352, minz + 0.01330476999282837),
+ (minx + 0.01705223321914673, maxy - 0.009564712643623352, minz + 0.012700080871582031),
+ (minx + 0.01765689253807068, maxy - 0.009564712643623352, minz + 0.012449592351913452),
+ (minx + 0.018261581659317017, maxy - 0.009564712643623352, minz + 0.012700080871582031),
+ (minx + 0.018512040376663208, maxy - 0.009564712643623352, minz + 0.01330476999282837),
+ (minx + 0.018261581659317017, maxy - 0.009564712643623352, minz + 0.01390942931175232)]
+
+ # Faces
+ myfaces = [(12, 0, 1, 13), (13, 1, 2, 14), (14, 2, 3, 15), (15, 3, 4, 16), (17, 6, 7, 18),
+ (18, 7, 8, 19), (19, 8, 9, 20), (20, 9, 10, 21), (21, 10, 11, 22), (22, 11, 0, 12),
+ (1, 0, 23, 24), (2, 1, 24, 25), (3, 2, 25, 26), (4, 3, 26, 27), (5, 4, 27, 28),
+ (6, 5, 28, 29), (7, 6, 29, 30), (8, 7, 30, 31), (9, 8, 31, 32), (10, 9, 32, 33),
+ (11, 10, 33, 34), (0, 11, 34, 23), (24, 23, 36, 35), (25, 24, 35, 37), (26, 25, 37, 38),
+ (27, 26, 38, 39), (28, 27, 39, 40), (29, 28, 40, 41), (30, 29, 41, 42), (31, 30, 42, 43),
+ (32, 31, 43, 44), (33, 32, 44, 45), (34, 33, 45, 46), (23, 34, 46, 36), (48, 47, 59, 60),
+ (49, 48, 60, 61), (50, 49, 61, 62), (51, 50, 62, 63), (52, 51, 63, 64), (53, 52, 64, 65),
+ (54, 53, 65, 66), (55, 54, 66, 67), (56, 55, 67, 68), (57, 56, 68, 69), (58, 57, 69, 70),
+ (59, 47, 58, 70), (60, 59, 71, 72), (61, 60, 72, 73), (62, 61, 73, 74), (63, 62, 74, 75),
+ (64, 63, 75, 76), (70, 69, 81, 82), (70, 82, 71, 59), (81, 69, 89, 83), (80, 81, 83, 84),
+ (79, 80, 84, 85), (78, 79, 85, 86), (77, 78, 86, 87), (76, 77, 87, 88), (64, 76, 88, 94),
+ (69, 68, 90, 89), (68, 67, 91, 90), (67, 66, 92, 91), (66, 65, 93, 92), (65, 64, 94, 93),
+ (83, 89, 96, 95), (84, 83, 95, 97), (85, 84, 97, 98), (86, 85, 98, 99), (87, 86, 99, 100),
+ (88, 87, 100, 101), (94, 88, 101, 102), (89, 90, 103, 96), (90, 91, 104, 103), (91, 92, 105, 104),
+ (92, 93, 106, 105), (93, 94, 102, 106), (100, 106, 102, 101), (99, 105, 106, 100), (98, 104, 105, 99),
+ (97, 103, 104, 98), (95, 96, 103, 97), (72, 71, 107), (73, 72, 107), (74, 73, 107),
+ (75, 74, 107), (76, 75, 107), (77, 76, 107), (78, 77, 107), (79, 78, 107),
+ (80, 79, 107), (81, 80, 107), (82, 81, 107), (71, 82, 107), (17, 108, 5, 6),
+ (5, 108, 16, 4), (130, 120, 110, 126), (143, 122, 111, 135), (132, 124, 112, 128), (147, 117, 109, 139),
+ (150, 135, 111, 128), (152, 133, 114, 125), (125, 114, 119, 129),
+ (129, 119, 120, 130), (134, 115, 121, 141),
+ (141, 121, 122, 143), (127, 116, 123, 131), (131, 123, 124, 132),
+ (138, 113, 118, 145), (145, 118, 117, 147),
+ (117, 130, 126, 109), (122, 132, 128, 111), (140, 150, 128, 112),
+ (138, 152, 125, 113), (113, 125, 129, 118),
+ (118, 129, 130, 117), (115, 127, 131, 121), (121, 131, 132, 122),
+ (120, 144, 136, 110), (144, 143, 135, 136),
+ (124, 148, 140, 112), (148, 147, 139, 140), (126, 110, 136, 149),
+ (149, 136, 135, 150), (127, 115, 134, 151),
+ (151, 134, 133, 152), (114, 133, 142, 119), (133, 134, 141, 142),
+ (119, 142, 144, 120), (142, 141, 143, 144),
+ (116, 137, 146, 123), (137, 138, 145, 146), (123, 146, 148, 124),
+ (146, 145, 147, 148), (109, 126, 149, 139),
+ (139, 149, 150, 140), (116, 127, 151, 137), (137, 151, 152, 138),
+ (153, 160, 168, 161), (160, 159, 167, 168),
+ (159, 158, 166, 167), (158, 157, 165, 166), (157, 156, 164, 165),
+ (156, 155, 163, 164), (155, 154, 162, 163),
+ (154, 153, 161, 162), (161, 168, 176, 169), (168, 167, 175, 176),
+ (167, 166, 174, 175), (166, 165, 173, 174),
+ (165, 164, 172, 173), (164, 163, 171, 172), (163, 162, 170, 171),
+ (162, 161, 169, 170), (169, 176, 184, 177),
+ (176, 175, 183, 184), (175, 174, 182, 183), (174, 173, 181, 182),
+ (173, 172, 180, 181), (172, 171, 179, 180),
+ (171, 170, 178, 179), (170, 169, 177, 178), (197, 189, 213, 221),
+ (184, 183, 191, 192), (196, 197, 221, 220),
+ (182, 181, 189, 190), (185, 177, 201, 209), (180, 179, 187, 188),
+ (195, 187, 211, 219), (178, 177, 185, 186),
+ (198, 199, 223, 222), (192, 191, 199, 200), (191, 183, 207, 215),
+ (190, 189, 197, 198), (200, 193, 217, 224),
+ (188, 187, 195, 196), (189, 181, 205, 213), (186, 185, 193, 194),
+ (194, 193, 200, 199, 198, 197, 196, 195),
+ (201, 208, 216, 209),
+ (207, 206, 214, 215), (205, 204, 212, 213), (203, 202, 210, 211),
+ (209, 216, 224, 217), (215, 214, 222, 223),
+ (213, 212, 220, 221), (211, 210, 218, 219), (194, 195, 219, 218),
+ (199, 191, 215, 223), (178, 186, 210, 202),
+ (193, 185, 209, 217), (177, 184, 208, 201), (180, 188, 212, 204),
+ (183, 182, 206, 207), (182, 190, 214, 206),
+ (186, 194, 218, 210), (181, 180, 204, 205), (184, 192, 216, 208),
+ (188, 196, 220, 212), (179, 178, 202, 203),
+ (190, 198, 222, 214), (192, 200, 224, 216), (187, 179, 203, 211),
+ (225, 232, 240, 233), (232, 231, 239, 240),
+ (231, 230, 238, 239), (230, 229, 237, 238), (229, 228, 236, 237),
+ (228, 227, 235, 236), (227, 226, 234, 235),
+ (226, 225, 233, 234), (233, 240, 248, 241), (240, 239, 247, 248),
+ (239, 238, 246, 247), (238, 237, 245, 246),
+ (237, 236, 244, 245), (236, 235, 243, 244), (235, 234, 242, 243),
+ (234, 233, 241, 242), (241, 248, 256, 249),
+ (248, 247, 255, 256), (247, 246, 254, 255), (246, 245, 253, 254),
+ (245, 244, 252, 253), (244, 243, 251, 252),
+ (243, 242, 250, 251), (242, 241, 249, 250), (269, 261, 285, 293),
+ (256, 255, 263, 264), (268, 269, 293, 292),
+ (254, 253, 261, 262), (257, 249, 273, 281), (252, 251, 259, 260),
+ (267, 259, 283, 291), (250, 249, 257, 258),
+ (270, 271, 295, 294), (264, 263, 271, 272), (263, 255, 279, 287),
+ (262, 261, 269, 270), (272, 265, 289, 296),
+ (260, 259, 267, 268), (261, 253, 277, 285), (258, 257, 265, 266),
+ (266, 265, 272, 271, 270, 269, 268, 267),
+ (273, 280, 288, 281),
+ (279, 278, 286, 287), (277, 276, 284, 285), (275, 274, 282, 283),
+ (281, 288, 296, 289), (287, 286, 294, 295),
+ (285, 284, 292, 293), (283, 282, 290, 291), (266, 267, 291, 290),
+ (271, 263, 287, 295), (250, 258, 282, 274),
+ (265, 257, 281, 289), (249, 256, 280, 273), (252, 260, 284, 276),
+ (255, 254, 278, 279), (254, 262, 286, 278),
+ (258, 266, 290, 282), (253, 252, 276, 277), (256, 264, 288, 280),
+ (260, 268, 292, 284), (251, 250, 274, 275),
+ (262, 270, 294, 286), (264, 272, 296, 288), (259, 251, 275, 283)]
+
+ mesh = bpy.data.meshes.new(objname)
+ myobject = bpy.data.objects.new(objname, mesh)
+
+ myobject.location = bpy.context.scene.cursor_location
+ bpy.context.scene.objects.link(myobject)
+
+ mesh.from_pydata(myvertex, [], myfaces)
+ mesh.update(calc_edges=True)
+
+ # Create materials
+ if mat:
+ alumat = create_glossy_material("Handle_material", False, 0.733, 0.779, 0.8)
+ set_material(myobject, alumat)
+
+ return myobject
+
+
+# ------------------------------------------------------------
+# Generate rail handle
+#
+# objName: Object name
+# mat: create materials
+# ------------------------------------------------------------
+def create_rail_handle(objname, mat):
+ # ------------------------------------
+ # Mesh data
+ # ------------------------------------
+ minx = -0.007970962673425674
+ maxx = 0.007971039041876793
+ miny = -0.0038057267665863037
+ maxy = 6.780028343200684e-07
+ minz = -0.07533407211303711
+ maxz = 0.05025443434715271
+
+ # Vertex
+ myvertex = [(minx, miny + 0.0009473562240600586, minz),
+ (minx, maxy, minz),
+ (maxx, maxy, minz),
+ (maxx, miny + 0.0009473562240600586, minz),
+ (minx, miny + 0.0009473562240600586, maxz),
+ (minx, maxy, maxz),
+ (maxx, maxy, maxz),
+ (maxx, miny + 0.0009473562240600586, maxz),
+ (minx, miny + 0.0009473562240600586, minz + 0.0038556158542633057),
+ (minx, miny + 0.0009473562240600586, maxz - 0.0038556158542633057),
+ (minx, maxy, minz + 0.0038556158542633057),
+ (maxx, miny + 0.0009473562240600586, maxz - 0.0038556158542633057),
+ (maxx, miny + 0.0009473562240600586, minz + 0.0038556158542633057),
+ (minx, maxy, maxz - 0.0038556158542633057),
+ (maxx, maxy, maxz - 0.0038556158542633057),
+ (maxx, maxy, minz + 0.0038556158542633057),
+ (maxx - 0.002014978788793087, maxy, maxz),
+ (minx + 0.0020150020718574524, maxy, minz),
+ (maxx - 0.002014978788793087, miny + 0.0009473562240600586, maxz),
+ (minx + 0.0020150020718574524, miny + 0.0009473562240600586, maxz),
+ (minx + 0.0020150020718574524, miny + 0.0009473562240600586, minz),
+ (maxx - 0.002014978788793087, miny + 0.0009473562240600586, minz),
+ (maxx - 0.002014978788793087, maxy, maxz - 0.0038556158542633057),
+ (minx + 0.0020150020718574524, maxy, maxz - 0.0038556158542633057),
+ (maxx - 0.002014978788793087, maxy, minz + 0.0038556158542633057),
+ (minx + 0.0020150020718574524, maxy, minz + 0.0038556158542633057),
+ (minx + 0.0020150020718574524, miny + 0.0009473562240600586, maxz - 0.0038556158542633057),
+ (maxx - 0.002014978788793087, miny + 0.0009473562240600586, maxz - 0.0038556158542633057),
+ (minx + 0.0020150020718574524, miny + 0.0009473562240600586, minz + 0.0038556158542633057),
+ (maxx - 0.002014978788793087, miny + 0.0009473562240600586, minz + 0.0038556158542633057),
+ (maxx - 0.002014978788793087, maxy, minz),
+ (minx + 0.0020150020718574524, maxy, maxz),
+ (minx + 0.007114947948139161, miny + 0.001102180453017354, maxz - 0.004768103361129761),
+ (minx + 0.0057074506767094135, miny + 0.001102180453017354, maxz - 0.005351103842258453),
+ (minx + 0.005124435992911458, miny + 0.001102176494896412, maxz - 0.006758600473403931),
+ (minx + 0.0057074506767094135, miny + 0.001102176494896412, maxz - 0.008166097104549408),
+ (minx + 0.007114947948139161, miny + 0.001102176494896412, maxz - 0.0087490975856781),
+ (maxx - 0.0074195414781570435, miny + 0.001102176494896412, maxz - 0.008166097104549408),
+ (maxx - 0.006836557062342763, miny + 0.001102176494896412, maxz - 0.006758600473403931),
+ (maxx - 0.0074195414781570435, miny + 0.001102180453017354, maxz - 0.005351103842258453),
+ (minx + 0.007114947948139161, miny + 0.0008257024455815554, maxz - 0.004768103361129761),
+ (minx + 0.0057074506767094135, miny + 0.0008257024455815554, maxz - 0.005351103842258453),
+ (minx + 0.005124435992911458, miny + 0.0008257024455815554, maxz - 0.006758600473403931),
+ (minx + 0.0057074506767094135, miny + 0.0008257024455815554, maxz - 0.008166097104549408),
+ (minx + 0.007114947948139161, miny + 0.0008257024455815554, maxz - 0.0087490975856781),
+ (maxx - 0.0074195414781570435, miny + 0.0008257024455815554, maxz - 0.008166097104549408),
+ (maxx - 0.006836557062342763, miny + 0.0008257024455815554, maxz - 0.006758600473403931),
+ (maxx - 0.0074195414781570435, miny + 0.0008257024455815554, maxz - 0.005351103842258453),
+ (minx + 0.007114947948139161, miny + 0.000937597593292594, maxz - 0.0054146647453308105),
+ (minx + 0.006164627615362406, miny + 0.000937597593292594, maxz - 0.00580829381942749),
+ (minx + 0.0057710278779268265, miny + 0.000937597593292594, maxz - 0.006758600473403931),
+ (minx + 0.006164627615362406, miny + 0.000937597593292594, maxz - 0.007708907127380371),
+ (minx + 0.007114947948139161, miny + 0.000937597593292594, maxz - 0.008102551102638245),
+ (maxx - 0.007876764051616192, miny + 0.000937597593292594, maxz - 0.007708907127380371),
+ (maxx - 0.007483118446543813, miny + 0.000937597593292594, maxz - 0.006758600473403931),
+ (maxx - 0.007876764051616192, miny + 0.000937597593292594, maxz - 0.00580829381942749),
+ (minx + 0.007114947948139161, miny + 0.000937597593292594, maxz - 0.006059680134057999),
+ (minx + 0.006620732950977981, miny + 0.000937597593292594, maxz - 0.006264369934797287),
+ (minx + 0.006416012765839696, miny + 0.000937597593292594, maxz - 0.006758600473403931),
+ (minx + 0.006620732950977981, miny + 0.000937597593292594, maxz - 0.0072528161108493805),
+ (minx + 0.007114947948139161, miny + 0.000937597593292594, maxz - 0.0074575357139110565),
+ (minx + 0.0076091475784778595, miny + 0.000937597593292594, maxz - 0.0072528161108493805),
+ (minx + 0.007813852455001324, miny + 0.000937597593292594, maxz - 0.006758600473403931),
+ (minx + 0.0076091475784778595, miny + 0.000937597593292594, maxz - 0.006264369934797287),
+ (minx + 0.007114947948139161, miny + 0.000937597593292594, maxz - 0.006319437175989151),
+ (minx + 0.006804424105212092, miny + 0.000937597593292594, maxz - 0.0064480602741241455),
+ (minx + 0.00667576992418617, miny + 0.000937597593292594, maxz - 0.006758600473403931),
+ (minx + 0.006804424105212092, miny + 0.000937597593292594, maxz - 0.007069140672683716),
+ (minx + 0.007114947948139161, miny + 0.000937597593292594, maxz - 0.00719776377081871),
+ (minx + 0.0074254871578887105, miny + 0.000937597593292594, maxz - 0.007069140672683716),
+ (minx + 0.007554110663477331, miny + 0.000937597593292594, maxz - 0.006758600473403931),
+ (minx + 0.0074254871578887105, miny + 0.000937597593292594, maxz - 0.0064480602741241455),
+ (minx + 0.007114947948139161, miny + 0.0008078569080680609, maxz - 0.0054146647453308105),
+ (minx + 0.006164627615362406, miny + 0.0008078569080680609, maxz - 0.00580829381942749),
+ (minx + 0.0057710278779268265, miny + 0.0008078569080680609, maxz - 0.006758600473403931),
+ (minx + 0.006164627615362406, miny + 0.0008078569080680609, maxz - 0.007708907127380371),
+ (minx + 0.007114947948139161, miny + 0.0008078569080680609, maxz - 0.008102551102638245),
+ (maxx - 0.007876764051616192, miny + 0.0008078569080680609, maxz - 0.007708907127380371),
+ (maxx - 0.007483118446543813, miny + 0.0008078569080680609, maxz - 0.006758600473403931),
+ (maxx - 0.007876764051616192, miny + 0.0008078569080680609, maxz - 0.00580829381942749),
+ (minx + 0.007114947948139161, miny + 0.0008078569080680609, maxz - 0.006059680134057999),
+ (minx + 0.006620732950977981, miny + 0.0008078569080680609, maxz - 0.006264369934797287),
+ (minx + 0.006416012765839696, miny + 0.0008078569080680609, maxz - 0.006758600473403931),
+ (minx + 0.006620732950977981, miny + 0.0008078569080680609, maxz - 0.0072528161108493805),
+ (minx + 0.007114947948139161, miny + 0.0008078569080680609, maxz - 0.0074575357139110565),
+ (minx + 0.0076091475784778595, miny + 0.0008078569080680609, maxz - 0.0072528161108493805),
+ (minx + 0.007813852455001324, miny + 0.0008078569080680609, maxz - 0.006758600473403931),
+ (minx + 0.0076091475784778595, miny + 0.0008078569080680609, maxz - 0.006264369934797287),
+ (minx + 0.007114947948139161, miny + 0.0008078569080680609, maxz - 0.006319437175989151),
+ (minx + 0.006804424105212092, miny + 0.0008078569080680609, maxz - 0.0064480602741241455),
+ (minx + 0.00667576992418617, miny + 0.0008078569080680609, maxz - 0.006758600473403931),
+ (minx + 0.006804424105212092, miny + 0.0008078569080680609, maxz - 0.007069140672683716),
+ (minx + 0.007114947948139161, miny + 0.0008078569080680609, maxz - 0.00719776377081871),
+ (minx + 0.0074254871578887105, miny + 0.0008078569080680609, maxz - 0.007069140672683716),
+ (minx + 0.007554110663477331, miny + 0.0008078569080680609, maxz - 0.006758600473403931),
+ (minx + 0.0074254871578887105, miny + 0.0008078569080680609, maxz - 0.0064480602741241455),
+ (minx + 0.0074254871578887105, miny + 0.0008078569080680609, minz + 0.007765233516693115),
+ (minx + 0.007554110663477331, miny + 0.0008078569080680609, minz + 0.00745469331741333),
+ (minx + 0.0074254871578887105, miny + 0.0008078569080680609, minz + 0.007144153118133545),
+ (minx + 0.007114947948139161, miny + 0.0008078569080680609, minz + 0.007015526294708252),
+ (minx + 0.006804424105212092, miny + 0.0008078569080680609, minz + 0.007144153118133545),
+ (minx + 0.00667576992418617, miny + 0.0008078569080680609, minz + 0.00745469331741333),
+ (minx + 0.006804424105212092, miny + 0.0008078569080680609, minz + 0.007765233516693115),
+ (minx + 0.007114947948139161, miny + 0.0008078569080680609, minz + 0.007893860340118408),
+ (minx + 0.0076091475784778595, miny + 0.0008078569080680609, minz + 0.007948920130729675),
+ (minx + 0.007813852455001324, miny + 0.0008078569080680609, minz + 0.00745469331741333),
+ (minx + 0.0076091475784778595, miny + 0.0008078569080680609, minz + 0.006960481405258179),
+ (minx + 0.007114947948139161, miny + 0.0008078569080680609, minz + 0.006755754351615906),
+ (minx + 0.006620732950977981, miny + 0.0008078569080680609, minz + 0.006960481405258179),
+ (minx + 0.006416012765839696, miny + 0.0008078569080680609, minz + 0.00745469331741333),
+ (minx + 0.006620732950977981, miny + 0.0008078569080680609, minz + 0.007948920130729675),
+ (minx + 0.007114947948139161, miny + 0.0008078569080680609, minz + 0.00815361738204956),
+ (maxx - 0.007876764051616192, miny + 0.0008078569080680609, minz + 0.00840499997138977),
+ (maxx - 0.007483118446543813, miny + 0.0008078569080680609, minz + 0.00745469331741333),
+ (maxx - 0.007876764051616192, miny + 0.0008078569080680609, minz + 0.00650438666343689),
+ (minx + 0.007114947948139161, miny + 0.0008078569080680609, minz + 0.006110742688179016),
+ (minx + 0.006164627615362406, miny + 0.0008078569080680609, minz + 0.00650438666343689),
+ (minx + 0.0057710278779268265, miny + 0.0008078569080680609, minz + 0.00745469331741333),
+ (minx + 0.006164627615362406, miny + 0.0008078569080680609, minz + 0.00840499997138977),
+ (minx + 0.007114947948139161, miny + 0.0008078569080680609, minz + 0.00879862904548645),
+ (minx + 0.0074254871578887105, miny + 0.000937597593292594, minz + 0.007765233516693115),
+ (minx + 0.007554110663477331, miny + 0.000937597593292594, minz + 0.00745469331741333),
+ (minx + 0.0074254871578887105, miny + 0.000937597593292594, minz + 0.007144153118133545),
+ (minx + 0.007114947948139161, miny + 0.000937597593292594, minz + 0.007015526294708252),
+ (minx + 0.006804424105212092, miny + 0.000937597593292594, minz + 0.007144153118133545),
+ (minx + 0.00667576992418617, miny + 0.000937597593292594, minz + 0.00745469331741333),
+ (minx + 0.006804424105212092, miny + 0.000937597593292594, minz + 0.007765233516693115),
+ (minx + 0.007114947948139161, miny + 0.000937597593292594, minz + 0.007893860340118408),
+ (minx + 0.0076091475784778595, miny + 0.000937597593292594, minz + 0.007948920130729675),
+ (minx + 0.007813852455001324, miny + 0.000937597593292594, minz + 0.00745469331741333),
+ (minx + 0.0076091475784778595, miny + 0.000937597593292594, minz + 0.006960481405258179),
+ (minx + 0.007114947948139161, miny + 0.000937597593292594, minz + 0.006755754351615906),
+ (minx + 0.006620732950977981, miny + 0.000937597593292594, minz + 0.006960481405258179),
+ (minx + 0.006416012765839696, miny + 0.000937597593292594, minz + 0.00745469331741333),
+ (minx + 0.006620732950977981, miny + 0.000937597593292594, minz + 0.007948920130729675),
+ (minx + 0.007114947948139161, miny + 0.000937597593292594, minz + 0.00815361738204956),
+ (maxx - 0.007876764051616192, miny + 0.000937597593292594, minz + 0.00840499997138977),
+ (maxx - 0.007483118446543813, miny + 0.000937597593292594, minz + 0.00745469331741333),
+ (maxx - 0.007876764051616192, miny + 0.000937597593292594, minz + 0.00650438666343689),
+ (minx + 0.007114947948139161, miny + 0.000937597593292594, minz + 0.006110742688179016),
+ (minx + 0.006164627615362406, miny + 0.000937597593292594, minz + 0.00650438666343689),
+ (minx + 0.0057710278779268265, miny + 0.000937597593292594, minz + 0.00745469331741333),
+ (minx + 0.006164627615362406, miny + 0.000937597593292594, minz + 0.00840499997138977),
+ (minx + 0.007114947948139161, miny + 0.000937597593292594, minz + 0.00879862904548645),
+ (maxx - 0.0074195414781570435, miny + 0.0008257024455815554, minz + 0.008862189948558807),
+ (maxx - 0.006836557062342763, miny + 0.0008257024455815554, minz + 0.00745469331741333),
+ (maxx - 0.0074195414781570435, miny + 0.0008257024455815554, minz + 0.006047196686267853),
+ (minx + 0.007114947948139161, miny + 0.0008257024455815554, minz + 0.00546419620513916),
+ (minx + 0.0057074506767094135, miny + 0.0008257024455815554, minz + 0.006047196686267853),
+ (minx + 0.005124435992911458, miny + 0.0008257024455815554, minz + 0.00745469331741333),
+ (minx + 0.0057074506767094135, miny + 0.0008257024455815554, minz + 0.008862189948558807),
+ (minx + 0.007114947948139161, miny + 0.0008257024455815554, minz + 0.0094451904296875),
+ (maxx - 0.0074195414781570435, miny + 0.001102180453017354, minz + 0.008862189948558807),
+ (maxx - 0.006836557062342763, miny + 0.001102176494896412, minz + 0.00745469331741333),
+ (maxx - 0.0074195414781570435, miny + 0.001102176494896412, minz + 0.006047196686267853),
+ (minx + 0.007114947948139161, miny + 0.001102176494896412, minz + 0.00546419620513916),
+ (minx + 0.0057074506767094135, miny + 0.001102176494896412, minz + 0.006047196686267853),
+ (minx + 0.005124435992911458, miny + 0.001102176494896412, minz + 0.00745469331741333),
+ (minx + 0.0057074506767094135, miny + 0.001102180453017354, minz + 0.008862189948558807),
+ (minx + 0.007114947948139161, miny + 0.001102180453017354, minz + 0.0094451904296875),
+ (maxx - 0.002014978788793087, maxy, maxz - 0.015039850026369095),
+ (maxx - 0.002014978788793087, maxy, minz + 0.015039850026369095),
+ (minx, miny + 0.0009473562240600586, minz + 0.015039850026369095),
+ (minx, miny + 0.0009473562240600586, maxz - 0.015039850026369095),
+ (minx, maxy, minz + 0.015039850026369095),
+ (maxx, maxy, maxz - 0.015039850026369095),
+ (maxx, miny + 0.0009473562240600586, maxz - 0.015039850026369095),
+ (maxx, miny + 0.0009473562240600586, minz + 0.015039850026369095),
+ (maxx - 0.002014978788793087, miny + 0.0009473562240600586, maxz - 0.015039850026369095),
+ (maxx - 0.002014978788793087, miny + 0.0009473562240600586, minz + 0.015039850026369095),
+ (minx + 0.0020150020718574524, maxy, maxz - 0.015039850026369095),
+ (minx + 0.0020150020718574524, maxy, minz + 0.015039850026369095),
+ (minx + 0.0020150020718574524, miny + 0.0009473562240600586, maxz - 0.015039850026369095),
+ (minx + 0.0020150020718574524, miny + 0.0009473562240600586, minz + 0.015039850026369095),
+ (maxx, maxy, minz + 0.015039850026369095),
+ (minx, maxy, maxz - 0.015039850026369095),
+ (maxx - 0.002014978788793087, maxy - 0.0017695352435112, maxz - 0.015039850026369095),
+ (maxx - 0.002014978788793087, maxy - 0.0017695352435112, minz + 0.015039850026369095),
+ (minx + 0.0020150020718574524, maxy - 0.0017695352435112, maxz - 0.015039850026369095),
+ (minx + 0.0020150020718574524, maxy - 0.0017695352435112, minz + 0.015039850026369095),
+ (maxx - 0.002014978788793087, maxy, maxz - 0.020450454205274582),
+ (minx, miny + 0.0009473562240600586, maxz - 0.020450454205274582),
+ (minx, maxy, maxz - 0.020450454205274582),
+ (maxx, maxy, maxz - 0.020450454205274582),
+ (maxx, miny + 0.0009473562240600586, maxz - 0.020450454205274582),
+ (maxx - 0.002014978788793087, miny + 0.0009473562240600586, maxz - 0.020450454205274582),
+ (minx + 0.0020150020718574524, maxy, maxz - 0.020450454205274582),
+ (minx + 0.0020150020718574524, miny + 0.0009473562240600586, maxz - 0.020450454205274582),
+ (maxx - 0.002014978788793087, maxy - 0.0017695352435112, maxz - 0.020450454205274582),
+ (minx + 0.0020150020718574524, maxy - 0.0017695352435112, maxz - 0.020450454205274582),
+ (minx, miny + 0.0009473562240600586, maxz - 0.04870907962322235),
+ (maxx - 0.002014978788793087, maxy, maxz - 0.04870907962322235),
+ (minx, maxy, maxz - 0.04870907962322235),
+ (maxx, miny + 0.0009473562240600586, maxz - 0.04870907962322235),
+ (maxx - 0.002014978788793087, miny + 0.0009473562240600586, maxz - 0.04870907962322235),
+ (minx + 0.0020150020718574524, maxy, maxz - 0.04870907962322235),
+ (minx + 0.0020150020718574524, miny + 0.0009473562240600586, maxz - 0.04870907962322235),
+ (maxx, maxy, maxz - 0.04870907962322235),
+ (maxx - 0.002014978788793087, maxy - 0.0017695352435112, maxz - 0.04870907962322235),
+ (minx + 0.0020150020718574524, maxy - 0.0017695352435112, maxz - 0.04870907962322235),
+ (maxx - 0.0027115284465253353, miny + 0.0009342432022094727, maxz - 0.020450454205274582),
+ (minx + 0.0027115517295897007, miny + 0.0009342432022094727, maxz - 0.020450454205274582),
+ (maxx - 0.0027115284465253353, miny + 0.0009342432022094727, maxz - 0.04870907962322235),
+ (minx + 0.0027115517295897007, miny + 0.0009342432022094727, maxz - 0.04870907962322235),
+ (minx, miny + 0.0009473562240600586, maxz - 0.026037774980068207),
+ (maxx - 0.002014978788793087, maxy, maxz - 0.026037774980068207),
+ (minx, maxy, maxz - 0.026037774980068207),
+ (maxx, maxy, maxz - 0.026037774980068207),
+ (maxx, miny + 0.0009473562240600586, maxz - 0.026037774980068207),
+ (maxx - 0.002014978788793087, miny + 0.0009473562240600586, maxz - 0.026037774980068207),
+ (minx + 0.0020150020718574524, maxy, maxz - 0.026037774980068207),
+ (minx + 0.0020150020718574524, miny + 0.0009473562240600586, maxz - 0.026037774980068207),
+ (maxx - 0.002014978788793087, maxy - 0.0017695352435112, maxz - 0.026037774980068207),
+ (minx + 0.0020150020718574524, maxy - 0.0017695352435112, maxz - 0.026037774980068207),
+ (maxx - 0.0027115284465253353, miny + 0.0009342432022094727, maxz - 0.026037774980068207),
+ (minx + 0.0027115517295897007, miny + 0.0009342432022094727, maxz - 0.026037774980068207),
+ (minx, miny + 0.0009473562240600586, maxz - 0.03058292716741562),
+ (maxx - 0.002014978788793087, maxy, maxz - 0.03058292716741562),
+ (maxx, miny + 0.0009473562240600586, maxz - 0.03058292716741562),
+ (maxx - 0.002014978788793087, miny + 0.0009473562240600586, maxz - 0.03058292716741562),
+ (minx + 0.0020150020718574524, maxy, maxz - 0.03058292716741562),
+ (minx + 0.0020150020718574524, miny + 0.0009473562240600586, maxz - 0.03058292716741562),
+ (maxx, maxy, maxz - 0.03058292716741562),
+ (minx, maxy, maxz - 0.03058292716741562),
+ (maxx - 0.002014978788793087, maxy - 0.0017695352435112, maxz - 0.03058292716741562),
+ (minx + 0.0020150020718574524, maxy - 0.0017695352435112, maxz - 0.03058292716741562),
+ (maxx - 0.0027115284465253353, miny + 0.0009342432022094727, maxz - 0.03058292716741562),
+ (minx + 0.0027115517295897007, miny + 0.0009342432022094727, maxz - 0.03058292716741562),
+ (maxx - 0.004523299168795347, miny, maxz - 0.026820629835128784),
+ (minx + 0.004523322451859713, miny, maxz - 0.026820629835128784),
+ (maxx - 0.004523299168795347, miny, maxz - 0.02980007231235504),
+ (minx + 0.004523322451859713, miny, maxz - 0.02980007231235504)]
+
+ # Faces
+ myfaces = [(28, 8, 0, 20), (174, 167, 12, 15), (19, 4, 9, 26), (173, 162, 8, 28), (10, 25, 17, 1),
+ (12, 29, 21, 3), (29, 28, 20, 21), (164, 171, 25, 10), (171, 161, 24, 25), (7, 18, 27, 11),
+ (18, 19, 26, 27), (167, 169, 29, 12), (169, 173, 28, 29), (32, 40, 47, 39), (39, 47, 46, 38),
+ (38, 46, 45, 37), (37, 45, 44, 36), (36, 44, 43, 35), (35, 43, 42, 34), (34, 42, 41, 33),
+ (33, 41, 40, 32), (68, 92, 84, 60), (55, 63, 62, 54), (67, 91, 92, 68), (53, 61, 60, 52),
+ (56, 80, 72, 48), (51, 59, 58, 50), (66, 90, 82, 58), (49, 57, 56, 48), (69, 93, 94, 70),
+ (63, 71, 70, 62), (62, 86, 78, 54), (61, 69, 68, 60), (71, 95, 88, 64), (59, 67, 66, 58),
+ (60, 84, 76, 52), (57, 65, 64, 56), (65, 66, 67, 68, 69, 70, 71, 64), (72, 80, 87, 79), (78, 86, 85, 77),
+ (76, 84, 83, 75), (74, 82, 81, 73), (80, 88, 95, 87), (86, 94, 93, 85), (84, 92, 91, 83),
+ (82, 90, 89, 81), (65, 89, 90, 66), (70, 94, 86, 62), (49, 73, 81, 57), (64, 88, 80, 56),
+ (48, 55, 79, 72), (51, 75, 83, 59), (54, 53, 77, 78), (53, 77, 85, 61), (57, 81, 89, 65),
+ (52, 51, 75, 76), (55, 79, 87, 63), (59, 83, 91, 67), (50, 49, 73, 74), (61, 85, 93, 69),
+ (63, 87, 95, 71), (58, 82, 74, 50), (133, 109, 117, 141), (128, 104, 96, 120), (130, 106, 98, 122),
+ (141, 142, 118, 117), (132, 108, 100, 124), (136, 112, 104, 128), (139, 140, 116, 115),
+ (134, 110, 102, 126),
+ (138, 114, 106, 130), (137, 138, 114, 113), (140, 116, 108, 132), (143, 136, 112, 119),
+ (127, 103, 111, 135),
+ (142, 118, 110, 134), (121, 97, 105, 129), (126, 102, 101, 125), (109, 101, 102, 110),
+ (107, 99, 100, 108),
+ (105, 97, 98, 106), (111, 103, 96, 104), (117, 109, 110, 118), (115, 107, 108, 116),
+ (113, 105, 106, 114),
+ (119, 111, 104, 112), (126, 125, 124, 123, 122, 121, 120, 127), (134, 126, 127, 135),
+ (131, 107, 115, 139),
+ (132, 124, 125, 133),
+ (120, 96, 103, 127), (130, 122, 123, 131), (129, 105, 113, 137),
+ (128, 120, 121, 129), (122, 98, 97, 121),
+ (142, 134, 135, 143), (125, 101, 109, 133), (140, 132, 133, 141),
+ (135, 111, 119, 143), (138, 130, 131, 139),
+ (124, 100, 99, 123), (136, 128, 129, 137), (123, 99, 107, 131),
+ (158, 150, 151, 159), (157, 149, 150, 158),
+ (156, 148, 149, 157), (155, 147, 148, 156), (154, 146, 147, 155),
+ (153, 145, 146, 154), (152, 144, 145, 153),
+ (159, 151, 144, 152), (197, 193, 167, 174), (26, 9, 163, 172),
+ (196, 190, 162, 173), (9, 13, 175, 163),
+ (192, 195, 171, 164), (23, 22, 160, 170), (195, 191, 161, 171),
+ (11, 27, 168, 166), (193, 194, 169, 167),
+ (27, 26, 172, 168), (173, 169, 177, 179), (198, 199, 179, 177),
+ (168, 172, 178, 176), (196, 173, 179, 199),
+ (185, 168, 176, 188), (160, 165, 183, 180), (172, 163, 181, 187),
+ (170, 160, 180, 186), (166, 168, 185, 184),
+ (176, 178, 189, 188), (172, 187, 189, 178), (209, 185, 188, 212),
+ (222, 218, 193, 197), (221, 216, 190, 196),
+ (220, 217, 191, 195), (218, 219, 194, 193), (199, 198, 202, 203),
+ (221, 196, 199, 225), (169, 194, 198, 177),
+ (226, 227, 203, 202), (225, 199, 203, 227), (212, 188, 200, 214),
+ (188, 189, 201, 200), (219, 209, 212, 224),
+ (180, 183, 207, 205), (187, 181, 204, 211), (182, 186, 210, 206),
+ (186, 180, 205, 210), (184, 185, 209, 208),
+ (187, 211, 213, 189), (200, 201, 215, 214), (189, 213, 215, 201),
+ (224, 212, 214, 226), (211, 204, 216, 221),
+ (210, 205, 217, 220), (208, 209, 219, 218), (211, 221, 225, 213),
+ (227, 226, 230, 231), (213, 225, 227, 215),
+ (194, 219, 224, 198), (198, 224, 226, 202), (228, 229, 231, 230),
+ (215, 227, 231, 229), (226, 214, 228, 230),
+ (214, 215, 229, 228), (24, 15, 2, 30), (15, 12, 3, 2), (16, 6, 14, 22), (161, 174, 15, 24),
+ (6, 7, 11, 14), (8, 10, 1, 0), (21, 30, 2, 3), (19, 31, 5, 4), (4, 5, 13, 9),
+ (162, 164, 10, 8), (25, 24, 30, 17), (5, 31, 23, 13), (31, 16, 22, 23), (0, 1, 17, 20),
+ (20, 17, 30, 21), (7, 6, 16, 18), (18, 16, 31, 19), (40, 72, 79, 47), (47, 79, 78, 46),
+ (46, 78, 77, 45), (45, 77, 76, 44), (44, 76, 75, 43), (43, 75, 74, 42), (42, 74, 73, 41),
+ (41, 73, 72, 40), (79, 55, 54, 78), (77, 53, 52, 76), (75, 51, 50, 74), (73, 49, 48, 72),
+ (118, 142, 143, 119), (116, 140, 141, 117), (114, 138, 139, 115),
+ (112, 136, 137, 113), (150, 118, 119, 151),
+ (149, 117, 118, 150), (148, 116, 117, 149), (147, 115, 116, 148),
+ (146, 114, 115, 147), (145, 113, 114, 146),
+ (144, 112, 113, 145), (151, 119, 112, 144), (22, 14, 165, 160),
+ (191, 197, 174, 161), (14, 11, 166, 165),
+ (190, 192, 164, 162), (13, 23, 170, 175), (165, 166, 184, 183),
+ (163, 175, 182, 181), (175, 170, 186, 182),
+ (217, 222, 197, 191), (216, 223, 192, 190), (223, 220, 195, 192),
+ (183, 184, 208, 207), (181, 182, 206, 204),
+ (205, 207, 222, 217), (207, 208, 218, 222), (204, 206, 223, 216), (206, 210, 220, 223)]
+
+ mesh = bpy.data.meshes.new(objname)
+ myobject = bpy.data.objects.new(objname, mesh)
+
+ myobject.location = bpy.context.scene.cursor_location
+ bpy.context.scene.objects.link(myobject)
+
+ mesh.from_pydata(myvertex, [], myfaces)
+ mesh.update(calc_edges=True)
+
+ # Create materials
+ if mat:
+ plastic = create_diffuse_material("Plastic_Handle_material", False, 0.01, 0.01, 0.01, 0.082, 0.079, 0.02, 0.01)
+ set_material(myobject, plastic)
+
+ return myobject
+
+
+# ------------------------------------------------------------------------------
+# Create rectangular sill
+#
+# objName: Object name
+# x: size x axis
+# y: size y axis
+# z: size z axis
+# mat: material flag
+# ------------------------------------------------------------------------------
+def create_sill(objname, x, y, z, mat):
+ myvertex = [(-x / 2, 0, 0.0),
+ (-x / 2, y, 0.0),
+ (x / 2, y, 0.0),
+ (x / 2, 0, 0.0),
+ (-x / 2, 0, -z),
+ (-x / 2, y, -z),
+ (x / 2, y, -z),
+ (x / 2, 0, -z)]
+
+ myfaces = [(0, 1, 2, 3), (0, 1, 5, 4), (1, 2, 6, 5), (2, 6, 7, 3), (5, 6, 7, 4), (0, 4, 7, 3)]
+
+ mesh = bpy.data.meshes.new(objname)
+ myobject = bpy.data.objects.new(objname, mesh)
+
+ myobject.location = bpy.context.scene.cursor_location
+ bpy.context.scene.objects.link(myobject)
+
+ mesh.from_pydata(myvertex, [], myfaces)
+ mesh.update(calc_edges=True)
+
+ if mat:
+ mymat = create_diffuse_material("Sill_material", False, 0.8, 0.8, 0.8)
+ set_material(myobject, mymat)
+
+ return myobject
+
+
+# ------------------------------------------------------------------------------
+# Create blind box
+#
+# objName: Object name
+# x: size x axis
+# y: size y axis
+# z: size z axis
+# mat: material flag
+# ------------------------------------------------------------------------------
+def create_blind_box(objname, x, y, z):
+ myvertex = [(-x / 2, 0, 0.0),
+ (-x / 2, y, 0.0),
+ (x / 2, y, 0.0),
+ (x / 2, 0, 0.0),
+ (-x / 2, 0, z),
+ (-x / 2, y, z),
+ (x / 2, y, z),
+ (x / 2, 0, z)]
+
+ myfaces\
+ = [(0, 1, 2, 3), (0, 1, 5, 4), (1, 2, 6, 5), (2, 6, 7, 3), (5, 6, 7, 4), (0, 4, 7, 3)]
+
+ mesh = bpy.data.meshes.new(objname)
+ myobject = bpy.data.objects.new(objname, mesh)
+
+ myobject.location = bpy.context.scene.cursor_location
+ bpy.context.scene.objects.link(myobject)
+
+ mesh.from_pydata(myvertex, [], myfaces)
+ mesh.update(calc_edges=True)
+
+ return myobject
+
+
+# ------------------------------------------------------------------------------
+# Create blind rails
+#
+# objName: Name for the new object
+# sX: Size in X axis
+# sZ: Size in Z axis
+# pX: position X axis
+# pY: position Y axis
+# pZ: position Z axis
+# mat: Flag for creating materials
+# matdata: Aluminum material
+# blind_rail: distance of the rail
+# ------------------------------------------------------------------------------
+def create_blind_rail(objname, sx, sz, px, py, pz, mat, matdata, blind_rail):
+ myvertex = []
+ myfaces = []
+ sideb = 0.04
+ space = 0.012 # blind is 10 mm thick
+ thicka = 0.002 # aluminum thickness
+ thickb = 0.002 # aluminum thickness
+
+ for x in (-sx / 2, sx / 2):
+ for z in (0, sz):
+ myvertex.extend([(x, 0, z),
+ (x, blind_rail, z),
+ (x + sideb, blind_rail, z),
+ (x + sideb, blind_rail - thicka, z),
+ (x + thickb, blind_rail - thicka, z),
+ (x + thickb, blind_rail - thicka - space, z),
+ (x + sideb, blind_rail - thicka - space, z),
+ (x + sideb, blind_rail - thicka - space - thicka, z),
+ (x + thickb, blind_rail - thicka - space - thicka, z),
+ (x + thickb, 0, z)])
+
+ # reverse
+ thickb *= -1
+ sideb *= -1
+
+ # Faces
+ myfaces.extend([(31, 30, 20, 21), (32, 31, 21, 22), (33, 32, 22, 23), (37, 36, 26, 27), (35, 34, 24, 25),
+ (26, 36, 35, 25), (37, 27, 28, 38), (33, 23, 24, 34), (39, 38, 28, 29), (37, 38, 35, 36),
+ (31, 32, 33, 34), (31, 34, 39, 30), (21, 24, 23, 22), (27, 26, 25, 28), (21, 20, 29, 24),
+ (11, 1, 0, 10), (12, 2, 1, 11), (13, 14, 4, 3), (12, 13, 3, 2), (17, 7, 6, 16),
+ (16, 6, 5, 15), (14, 15, 5, 4), (17, 18, 8, 7), (19, 9, 8, 18), (17, 16, 15, 18),
+ (11, 14, 13, 12), (11, 10, 19, 14), (7, 8, 5, 6), (2, 3, 4, 1), (1, 4, 9, 0)])
+
+ mymesh = bpy.data.meshes.new(objname)
+ myblind = bpy.data.objects.new(objname, mymesh)
+
+ myblind.location[0] = px
+ myblind.location[1] = py
+ myblind.location[2] = pz
+ bpy.context.scene.objects.link(myblind)
+
+ mymesh.from_pydata(myvertex, [], myfaces)
+ mymesh.update(calc_edges=True)
+
+ if mat:
+ set_material(myblind, matdata)
+
+ return myblind
+
+
+# ------------------------------------------------------------------------------
+# Create blind estructure
+#
+# objName: Name for the new object
+# sX: Size in X axis
+# sY: Size in Y axis
+# sZ: Size in Z axis
+# pX: position X axis
+# pY: position Y axis
+# pZ: position Z axis
+# mat: Flag for creating materials
+# blind_ratio: extension factor
+# ------------------------------------------------------------------------------
+def create_blind(objname, sx, sz, px, py, pz, mat, blind_ratio):
+ myvertex = []
+ myfaces = []
+ v = 0
+ h = 0.05
+ railgap = 0.005
+ # calculate total pieces
+ pieces = int((sz * (blind_ratio / 100)) / h)
+ if pieces * h < sz:
+ pieces += 1
+
+ z = h
+ for p in range(pieces):
+ for x in (-sx / 2, sx / 2):
+ myvertex.extend([(x, 0, z),
+ (x, 0, z + h - railgap),
+ (x, 0.002, z + h - railgap),
+ (x, 0.002, z + h),
+ (x, 0.008, z + h),
+ (x, 0.008, z + h - railgap),
+ (x, 0.01, z + h - railgap),
+ (x, 0.01, z)])
+
+ z -= h
+ # Faces
+ myfaces.extend([(v + 15, v + 7, v + 6, v + 14), (v + 7, v + 15, v + 8, v + 0),
+ (v + 9, v + 1, v + 0, v + 8),
+ (v + 10, v + 2, v + 1, v + 9), (v + 13, v + 14, v + 6, v + 5),
+ (v + 13, v + 5, v + 4, v + 12), (v + 10, v + 11, v + 3, v + 2),
+ (v + 4, v + 3, v + 11, v + 12)])
+ v = len(myvertex)
+
+ mymesh = bpy.data.meshes.new(objname)
+ myblind = bpy.data.objects.new(objname, mymesh)
+
+ myblind.location[0] = px
+ myblind.location[1] = py
+ myblind.location[2] = pz
+ bpy.context.scene.objects.link(myblind)
+
+ mymesh.from_pydata(myvertex, [], myfaces)
+ mymesh.update(calc_edges=True)
+
+ myblind.lock_location = (True, True, False) # only Z axis
+
+ if mat:
+ mat = create_diffuse_material("Blind_plastic_material", False, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.15)
+ set_material(myblind, mat)
+
+ return myblind
diff --git a/archimesh/achm_window_panel.py b/archimesh/achm_window_panel.py
new file mode 100644
index 00000000..c3c6862b
--- /dev/null
+++ b/archimesh/achm_window_panel.py
@@ -0,0 +1,1867 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+# ----------------------------------------------------------
+# Main panel for windows
+# Author: Antonio Vazquez (antonioya)
+#
+# This code is base on the windows generator add-on created by SayProduction
+# and has been adapted to continuous editing and cycles materials
+#
+# ----------------------------------------------------------
+# noinspection PyUnresolvedReferences
+import bpy
+import math
+# noinspection PyUnresolvedReferences
+import mathutils
+from achm_tools import *
+
+
+def fitil(vr, fc, px, pz, x, y, z, zz, xx):
+ k3 = z * 2
+ vr.extend([[px[x] + xx, -z + zz, pz[y] + xx], [px[x] + xx + k3, -z + zz, pz[y] + xx + k3],
+ [px[x] + xx + k3, z + zz, pz[y] + xx + k3], [px[x] + xx, z + zz, pz[y] + xx]])
+ vr.extend([[px[x] + xx, -z + zz, pz[y + 1] - xx], [px[x] + xx + k3, -z + zz, pz[y + 1] - xx - k3],
+ [px[x] + xx + k3, z + zz, pz[y + 1] - xx - k3], [px[x] + xx, z + zz, pz[y + 1] - xx]])
+ vr.extend([[px[x + 1] - xx, -z + zz, pz[y + 1] - xx], [px[x + 1] - xx - k3, -z + zz, pz[y + 1] - xx - k3],
+ [px[x + 1] - xx - k3, z + zz, pz[y + 1] - xx - k3], [px[x + 1] - xx, z + zz, pz[y + 1] - xx]])
+ vr.extend([[px[x + 1] - xx, -z + zz, pz[y] + xx], [px[x + 1] - xx - k3, -z + zz, pz[y] + xx + k3],
+ [px[x + 1] - xx - k3, z + zz, pz[y] + xx + k3], [px[x + 1] - xx, z + zz, pz[y] + xx]])
+ n = len(vr)
+ fc.extend([[n - 16, n - 15, n - 11, n - 12], [n - 15, n - 14, n - 10, n - 11], [n - 14, n - 13, n - 9, n - 10]])
+ fc.extend([[n - 12, n - 11, n - 7, n - 8], [n - 11, n - 10, n - 6, n - 7], [n - 10, n - 9, n - 5, n - 6]])
+ fc.extend([[n - 8, n - 7, n - 3, n - 4], [n - 7, n - 6, n - 2, n - 3], [n - 6, n - 5, n - 1, n - 2]])
+ fc.extend([[n - 4, n - 3, n - 15, n - 16], [n - 3, n - 2, n - 14, n - 15], [n - 2, n - 1, n - 13, n - 14]])
+ z = 0.005
+ vr.extend([[px[x] + xx + k3, -z + zz, pz[y] + xx + k3], [px[x] + xx + k3, -z + zz, pz[y + 1] - xx - k3],
+ [px[x + 1] - xx - k3, -z + zz, pz[y + 1] - xx - k3], [px[x + 1] - xx - k3, -z + zz, pz[y] + xx + k3]])
+ vr.extend([[px[x] + xx + k3, z + zz, pz[y] + xx + k3], [px[x] + xx + k3, z + zz, pz[y + 1] - xx - k3],
+ [px[x + 1] - xx - k3, z + zz, pz[y + 1] - xx - k3], [px[x + 1] - xx - k3, z + zz, pz[y] + xx + k3]])
+ fc.extend([[n + 1, n + 0, n + 3, n + 2], [n + 4, n + 5, n + 6, n + 7]])
+
+
+def kapak(vr, fc, px, pz, x, y, z, zz):
+ k2 = z * 2
+ vr.extend(
+ [[px[x], -z + zz, pz[y]], [px[x] + k2, -z + zz, pz[y] + k2], [px[x] + k2, z + zz, pz[y] + k2],
+ [px[x], z + zz, pz[y]]])
+ vr.extend([[px[x], -z + zz, pz[y + 1]], [px[x] + k2, -z + zz, pz[y + 1] - k2], [px[x] + k2, z + zz, pz[y + 1] - k2],
+ [px[x], z + zz, pz[y + 1]]])
+ vr.extend(
+ [[px[x + 1], -z + zz, pz[y + 1]], [px[x + 1] - k2, -z + zz, pz[y + 1] - k2],
+ [px[x + 1] - k2, z + zz, pz[y + 1] - k2],
+ [px[x + 1], z + zz, pz[y + 1]]])
+ vr.extend([[px[x + 1], -z + zz, pz[y]], [px[x + 1] - k2, -z + zz, pz[y] + k2], [px[x + 1] - k2, z + zz, pz[y] + k2],
+ [px[x + 1], z + zz, pz[y]]])
+ n = len(vr)
+ fc.extend([[n - 16, n - 15, n - 11, n - 12], [n - 15, n - 14, n - 10, n - 11], [n - 14, n - 13, n - 9, n - 10],
+ [n - 13, n - 16, n - 12, n - 9]])
+ fc.extend([[n - 12, n - 11, n - 7, n - 8], [n - 11, n - 10, n - 6, n - 7], [n - 10, n - 9, n - 5, n - 6],
+ [n - 9, n - 12, n - 8, n - 5]])
+ fc.extend([[n - 8, n - 7, n - 3, n - 4], [n - 7, n - 6, n - 2, n - 3], [n - 6, n - 5, n - 1, n - 2],
+ [n - 5, n - 8, n - 4, n - 1]])
+ fc.extend([[n - 4, n - 3, n - 15, n - 16], [n - 3, n - 2, n - 14, n - 15], [n - 2, n - 1, n - 13, n - 14],
+ [n - 1, n - 4, n - 16, n - 13]])
+
+
+# -----------------------------------------
+# Set default values for each window type
+# -----------------------------------------
+def set_defaults(s):
+ if s.prs == '1':
+ s.gen = 3
+ s.yuk = 1
+ s.kl1 = 5
+ s.kl2 = 5
+ s.fk = 2
+ s.gny0 = 190
+ s.mr = True
+ s.gnx0 = 60
+ s.gnx1 = 110
+ s.gnx2 = 60
+ s.k00 = True
+ s.k01 = False
+ s.k02 = True
+ if s.prs == '2':
+ s.gen = 3
+ s.yuk = 1
+ s.kl1 = 5
+ s.kl2 = 5
+ s.fk = 2
+ s.gny0 = 190
+ s.mr = True
+ s.gnx0 = 60
+ s.gnx1 = 60
+ s.gnx2 = 60
+ s.k00 = True
+ s.k01 = False
+ s.k02 = True
+ if s.prs == '3':
+ s.gen = 3
+ s.yuk = 1
+ s.kl1 = 5
+ s.kl2 = 5
+ s.fk = 2
+ s.gny0 = 190
+ s.mr = True
+ s.gnx0 = 55
+ s.gnx1 = 50
+ s.gnx2 = 55
+ s.k00 = True
+ s.k01 = False
+ s.k02 = True
+ if s.prs == '4':
+ s.gen = 3
+ s.yuk = 1
+ s.kl1 = 5
+ s.kl2 = 5
+ s.fk = 2
+ s.gny0 = 150
+ s.mr = True
+ s.gnx0 = 55
+ s.gnx1 = 50
+ s.gnx2 = 55
+ s.k00 = True
+ s.k01 = False
+ s.k02 = True
+ if s.prs == '5':
+ s.gen = 3
+ s.yuk = 1
+ s.kl1 = 5
+ s.kl2 = 5
+ s.fk = 2
+ s.gny0 = 150
+ s.mr = True
+ s.gnx0 = 50
+ s.gnx1 = 40
+ s.gnx2 = 50
+ s.k00 = True
+ s.k01 = False
+ s.k02 = True
+ if s.prs == '6':
+ s.gen = 1
+ s.yuk = 1
+ s.kl1 = 5
+ s.kl2 = 5
+ s.fk = 2
+ s.gny0 = 40
+ s.mr = True
+ s.gnx0 = 40
+ s.k00 = False
+ if s.prs == '7':
+ s.gen = 1
+ s.yuk = 2
+ s.kl1 = 5
+ s.kl2 = 5
+ s.fk = 2
+ s.gny0 = 195
+ s.gny1 = 40
+ s.gnx0 = 70
+ s.k00 = True
+ s.k10 = False
+ s.mr = False
+ if s.prs == '8':
+ s.gen = 1
+ s.yuk = 2
+ s.kl1 = 5
+ s.kl2 = 5
+ s.fk = 2
+ s.gny0 = 180
+ s.gny1 = 35
+ s.gnx0 = 70
+ s.k00 = True
+ s.k10 = False
+ s.mr = False
+
+
+# ------------------------------------------------------------------
+# Define operator class to create window panels
+# ------------------------------------------------------------------
+class AchmWinPanel(bpy.types.Operator):
+ bl_idname = "mesh.archimesh_winpanel"
+ bl_label = "Panel Window"
+ bl_description = "Generate editable flat windows"
+ bl_category = 'Archimesh'
+ bl_options = {'REGISTER', 'UNDO'}
+
+ # -----------------------------------------------------
+ # Draw (create UI interface)
+ # -----------------------------------------------------
+ # noinspection PyUnusedLocal
+ def draw(self, context):
+ layout = self.layout
+ row = layout.row()
+ row.label("Use Properties panel (N) to define parms", icon='INFO')
+
+ # -----------------------------------------------------
+ # Execute
+ # -----------------------------------------------------
+ # noinspection PyUnusedLocal
+ def execute(self, context):
+ if bpy.context.mode == "OBJECT":
+ create_window()
+ return {'FINISHED'}
+ else:
+ self.report({'WARNING'}, "Archimesh: Option only valid in Object mode")
+ return {'CANCELLED'}
+
+
+# ------------------------------------------------------------------------------
+# Create the window
+# ------------------------------------------------------------------------------
+def create_window():
+ # deselect all objects
+ for o in bpy.data.objects:
+ o.select = False
+ # Create main object
+ window_mesh = bpy.data.meshes.new("Window")
+ window_object = bpy.data.objects.new("Window", window_mesh)
+
+ # Link object to scene
+ bpy.context.scene.objects.link(window_object)
+ window_object.WindowPanelGenerator.add()
+ window_object.location = bpy.context.scene.cursor_location
+
+ # Shape the mesh.
+ do_mesh(window_object, window_mesh)
+
+ # deactivate others
+ for o in bpy.data.objects:
+ if o.select is True and o.name != window_object.name:
+ o.select = False
+
+ # Select, and activate object
+ window_object.select = True
+ bpy.context.scene.objects.active = window_object
+
+ do_ctrl_box(window_object)
+ # Reselect
+ window_object.select = True
+ bpy.context.scene.objects.active = window_object
+
+
+# ------------------------------------------------------------------------------
+# Update mesh of the window
+# ------------------------------------------------------------------------------
+# noinspection PyUnusedLocal
+def update_window(self, context):
+ # When update, the active object is the main object.
+ o = bpy.context.active_object
+ oldmesh = o.data
+ oldname = o.data.name
+ # Now deselect that object to not delete it.
+ o.select = False
+ # # and create a new mesh for the object:
+ # tmp_mesh = bpy.data.meshes.new("temp")
+ # deselect all objects
+ for obj in bpy.data.objects:
+ obj.select = False
+ # ---------------------------------
+ # Clear Parent objects (autohole)
+ # ---------------------------------
+ myparent = o.parent
+ if myparent is not None:
+ ploc = myparent.location
+ else:
+ ploc = o.location
+ if myparent is not None:
+ o.parent = None
+ o.location = ploc
+ # remove_children(parent)
+ for child in myparent.children:
+ # noinspection PyBroadException
+ try:
+ # clear child data
+ child.hide = False # must be visible to avoid bug
+ child.hide_render = False # must be visible to avoid bug
+ old = child.data
+ child.select = True
+ bpy.ops.object.delete()
+ bpy.data.meshes.remove(old)
+ except:
+ pass
+
+ myparent.select = True
+ bpy.ops.object.delete()
+
+ # Finally create all that again
+ tmp_mesh = bpy.data.meshes.new("temp")
+ do_mesh(o, tmp_mesh, True)
+ o.data = tmp_mesh
+ # Remove data (mesh of active object),
+ if oldmesh.users == 0:
+ bpy.data.meshes.remove(oldmesh)
+ else:
+ oldmesh.name = "invalid"
+
+ tmp_mesh.name = oldname
+ # deactivate others
+ for ob in bpy.data.objects:
+ if ob.select is True and ob.name != o.name:
+ ob.select = False
+ # and select, and activate, the object.
+ o.select = True
+ bpy.context.scene.objects.active = o
+
+ do_ctrl_box(o)
+
+ # Reselect
+ o.select = True
+ bpy.context.scene.objects.active = o
+
+
+# ------------------------------------------------------------------------------
+# Generate object
+# For object, it only shapes mesh
+# ------------------------------------------------------------------------------
+# noinspection PyUnusedLocal
+def do_mesh(myobject, tmp_mesh, update=False):
+ # noinspection PyBroadException
+ try:
+ op = myobject.WindowPanelGenerator[0]
+ # Create only mesh, because the object was created before.
+ r = generate_window_object(op, tmp_mesh)
+ if r is False:
+ return False
+
+ # refine unit
+ remove_doubles(myobject)
+ set_normals(myobject)
+
+ # saves OpenGL data
+ # sum width
+ totx = myobject.dimensions.x
+ op.glpoint_a = (-totx / 2, 0, 0)
+ top_a, top_b, top_c = get_high_points(myobject, totx, op.UST)
+ op.glpoint_b = (-totx / 2, 0, top_a)
+ op.glpoint_c = (totx / 2, 0, top_b)
+ op.glpoint_d = (0, 0, top_c)
+
+ # Lock
+ myobject.lock_location = (True, True, True)
+ myobject.lock_rotation = (True, True, True)
+ return True
+ except:
+ return False
+
+
+# ------------------------------------------------------------------------------
+# Generate ctrl box
+#
+# ------------------------------------------------------------------------------
+# noinspection PyUnusedLocal
+def do_ctrl_box(myobject):
+ op = myobject.WindowPanelGenerator[0]
+ # -------------------------
+ # Create empty and parent
+ # -------------------------
+ bpy.ops.object.empty_add(type='PLAIN_AXES')
+ myempty = bpy.data.objects[bpy.context.active_object.name]
+ myempty.location = myobject.location
+
+ myempty.name = "Window_Group"
+ parentobject(myempty, myobject)
+ myobject["archimesh.hole_enable"] = True
+ # Rotate Empty
+ myempty.rotation_euler.z = math.radians(op.r)
+ # Create control box to open wall holes
+ myctrl = create_ctrl_box(myobject, "CTRL_Hole")
+
+ # Add custom property to detect Controller
+ myctrl["archimesh.ctrl_hole"] = True
+
+ set_normals(myctrl)
+ myctrl.parent = myempty
+ myctrl.location.x = 0
+ myctrl.location.y = 0
+ myctrl.location.z = 0
+ myctrl.draw_type = 'WIRE'
+ myctrl.hide = False
+ myctrl.hide_render = True
+ myctrl.cycles_visibility.camera = False
+ myctrl.cycles_visibility.diffuse = False
+ myctrl.cycles_visibility.glossy = False
+ myctrl.cycles_visibility.transmission = False
+ myctrl.cycles_visibility.scatter = False
+ myctrl.cycles_visibility.shadow = False
+
+ mat = create_transparent_material("hidden_material", False)
+ set_material(myctrl, mat)
+
+
+# ------------------------------------------------------------------------------
+# Update the parameters using a default value
+# ------------------------------------------------------------------------------
+# noinspection PyUnusedLocal
+def update_using_default(self, context):
+ o = context.object
+ myobject = o.WindowPanelGenerator[0]
+ if myobject.son != myobject.prs:
+ set_defaults(myobject)
+ myobject.son = myobject.prs
+
+
+# ------------------------------------------------------------------------------
+# Generate window object
+# ------------------------------------------------------------------------------
+def generate_window_object(op, mymesh):
+ myvertex = []
+ mfaces = []
+ # noinspection PyBroadException
+ try:
+ rst, ft1, cam, mer, sm = generate_vertex_data(op, myvertex, mfaces)
+ if rst is not True:
+ return False
+
+ mymesh.from_pydata(myvertex, [], mfaces)
+ # Uncomment for debug
+ # mymesh.validate(verbose=True)
+ # Assign materials
+ if op.mt1 == '1':
+ mymesh.materials.append(create_diffuse_material("PVC", False, 1, 1, 1, 1, 1, 1))
+ elif op.mt1 == '2':
+ mymesh.materials.append(create_diffuse_material("Wood", False, 0.3, 0.2, 0.1, 0.3, 0.2, 0.1))
+ elif op.mt1 == '3':
+ mymesh.materials.append(create_diffuse_material("Plastic", False, 0, 0, 0, 0, 0, 0))
+ if op.mt2 == '1':
+ mymesh.materials.append(create_diffuse_material("PVC", False, 1, 1, 1, 1, 1, 1))
+ elif op.mt2 == '2':
+ mymesh.materials.append(create_diffuse_material("Wood", False, 0.3, 0.2, 0.1, 0.3, 0.2, 0.1))
+ elif op.mt2 == '3':
+ mymesh.materials.append(create_diffuse_material("Plastic", False, 0, 0, 0, 0, 0, 0))
+
+ mymesh.materials.append(create_glass_material("Glass", False))
+ if op.mr is True:
+ mymesh.materials.append(create_diffuse_material("Marble", False, 0.9, 0.8, 0.7, 0.9, 0.8, 0.7))
+
+ p = len(mymesh.polygons)
+ for i in ft1:
+ if -1 < i < p:
+ mymesh.polygons[i].material_index = 1
+ for i in cam:
+ if -1 < i < p:
+ mymesh.polygons[i].material_index = 2
+ for i in mer:
+ if -1 < i < p:
+ mymesh.polygons[i].material_index = 3
+ for i in sm:
+ if -1 < i < p:
+ mymesh.polygons[i].use_smooth = 1
+
+ mymesh.update(calc_edges=True)
+
+ return True
+ except:
+ return False
+
+
+# -----------------------------------------
+# Generate vertex and faces data
+# -----------------------------------------
+def generate_vertex_data(op, myvertex, myfaces):
+ # noinspection PyBroadException
+ try:
+ h1 = 0
+ c = 0
+ t1 = 0
+
+ mx = op.gen
+ my = op.yuk
+ k1 = op.kl1 / 100
+ k2 = op.kl2 / 100
+ k3 = op.fk / 200
+ res = op.res
+
+ u = op.kl1 / 100
+ xlist = [0, round(u, 2)]
+ if mx > 0:
+ u += op.gnx0 / 100
+ xlist.append(round(u, 2))
+ u += k2
+ xlist.append(round(u, 2))
+ if mx > 1:
+ u += op.gnx1 / 100
+ xlist.append(round(u, 2))
+ u += k2
+ xlist.append(round(u, 2))
+ if mx > 2:
+ u += op.gnx2 / 100
+ xlist.append(round(u, 2))
+ u += k2
+ xlist.append(round(u, 2))
+ if mx > 3:
+ u += op.gnx3 / 100
+ xlist.append(round(u, 2))
+ u += k2
+ xlist.append(round(u, 2))
+ if mx > 4:
+ u += op.gnx4 / 100
+ xlist.append(round(u, 2))
+ u += k2
+ xlist.append(round(u, 2))
+ if mx > 5:
+ u += op.gnx5 / 100
+ xlist.append(round(u, 2))
+ u += k2
+ xlist.append(round(u, 2))
+ if mx > 6:
+ u += op.gnx6 / 100
+ xlist.append(round(u, 2))
+ u += k2
+ xlist.append(round(u, 2))
+ if mx > 7:
+ u += op.gnx7 / 100
+ xlist.append(round(u, 2))
+ u += k2
+ xlist.append(round(u, 2))
+
+ xlist[-1] = xlist[-2] + k1
+
+ u = op.kl1 / 100
+ zlist = [0, round(u, 2)]
+ if my > 0:
+ u += op.gny0 / 100
+ zlist.append(round(u, 2))
+ u += k2
+ zlist.append(round(u, 2))
+ if my > 1:
+ u += op.gny1 / 100
+ zlist.append(round(u, 2))
+ u += k2
+ zlist.append(round(u, 2))
+ if my > 2:
+ u += op.gny2 / 100
+ zlist.append(round(u, 2))
+ u += k2
+ zlist.append(round(u, 2))
+ if my > 3:
+ u += op.gny3 / 100
+ zlist.append(round(u, 2))
+ u += k2
+ zlist.append(round(u, 2))
+ if my > 4:
+ u += op.gny4 / 100
+ zlist.append(round(u, 2))
+ u += k2
+ zlist.append(round(u, 2))
+ zlist[-1] = zlist[-2] + k1
+
+ u = xlist[-1] / 2
+ for i in range(0, len(xlist)):
+ xlist[i] -= u
+ kx = [[op.k00, op.k10, op.k20, op.k30, op.k40],
+ [op.k01, op.k11, op.k21, op.k31, op.k41],
+ [op.k02, op.k12, op.k22, op.k32, op.k42],
+ [op.k03, op.k13, op.k23, op.k33, op.k43],
+ [op.k04, op.k14, op.k24, op.k34, op.k44],
+ [op.k05, op.k15, op.k25, op.k35, op.k45],
+ [op.k06, op.k16, op.k26, op.k36, op.k46],
+ [op.k07, op.k17, op.k27, op.k37, op.k47]]
+ cam = []
+ mer = []
+ ftl = []
+ sm = []
+ # -------------------------
+ # VERTICES
+ # -------------------------
+ myvertex.extend([[xlist[0], -k1 / 2, zlist[0]], [xlist[0], k1 / 2, zlist[0]]])
+ for x in range(1, len(xlist) - 1):
+ myvertex.extend([[xlist[x], -k1 / 2, zlist[1]], [xlist[x], k1 / 2, zlist[1]]])
+ myvertex.extend([[xlist[-1], -k1 / 2, zlist[0]], [xlist[-1], k1 / 2, zlist[0]]])
+ for z in range(2, len(zlist) - 2, 2):
+ for x in range(0, len(xlist)):
+ myvertex.extend([[xlist[x], -k1 / 2, zlist[z]], [xlist[x], k1 / 2, zlist[z]]])
+ for x in range(0, len(xlist)):
+ myvertex.extend([[xlist[x], -k1 / 2, zlist[z + 1]], [xlist[x], k1 / 2, zlist[z + 1]]])
+ z = len(zlist) - 2
+ myvertex.extend([[xlist[0], -k1 / 2, zlist[z + 1]], [xlist[0], k1 / 2, zlist[z + 1]]])
+ alt = []
+ ust = [len(myvertex) - 2, len(myvertex) - 1]
+ for x in range(1, len(xlist) - 1):
+ myvertex.extend([[xlist[x], -k1 / 2, zlist[z]], [xlist[x], k1 / 2, zlist[z]]])
+ alt.extend([len(myvertex) - 2, len(myvertex) - 1])
+ myvertex.extend([[xlist[-1], -k1 / 2, zlist[z + 1]], [xlist[-1], k1 / 2, zlist[z + 1]]])
+ son = [len(myvertex) - 2, len(myvertex) - 1]
+ # -------------------------
+ # FACES
+ # -------------------------
+ myfaces.append([0, 1, 3 + mx * 4, 2 + mx * 4])
+ fb = [0]
+ fr = [1]
+ for i in range(0, mx * 4, 4):
+ myfaces.append([i + 3, i + 2, i + 4, i + 5])
+ fb.extend([i + 2, i + 4])
+ fr.extend([i + 3, i + 5])
+ fr.append(3 + mx * 4)
+ fb.append(2 + mx * 4)
+ fb.reverse()
+ myfaces.extend([fb, fr])
+ # Yatay
+ y = (mx * 4 + 4)
+ v = mx * 4 + 2
+ for z in range(0, (my - 1) * y * 2, y * 2):
+ myfaces.extend([[z + y + 1, z + y, z + y + 4 + mx * 4, z + y + 5 + mx * 4],
+ [z + y + v, z + y + v + 1, z + y + v + 5 + mx * 4, z + y + v + 4 + mx * 4]])
+ for i in range(0, mx * 4 + 2, 2):
+ myfaces.extend([[z + i + y + 0, z + i + y + 2, z + i + y + v + 4, z + i + y + v + 2],
+ [z + i + y + 3, z + i + y + 1, z + i + y + v + 3, z + i + y + v + 5]])
+ for i in range(0, mx * 4 - 3, 4):
+ myfaces.extend([[z + i + y + 2, z + i + y + 3, z + i + y + 5, z + i + y + 4],
+ [z + i + y + v + 5, z + i + y + v + 4, z + i + y + v + 6,
+ z + i + y + v + 7]])
+ # Dikey
+ for y in range(0, my):
+ z = y * (mx * 4 + 4) * 2
+ for i in range(0, mx * 4 + 2, 4):
+ myfaces.extend([[z + i + 1, z + i + 0, z + i + v + 2, z + i + v + 3],
+ [z + i + 3, z + i + 1, z + i + v + 3, z + i + v + 5],
+ [z + i + 2, z + i + 3, z + i + v + 5, z + i + v + 4],
+ [z + i + 0, z + i + 2, z + i + v + 4, z + i + v + 2]])
+ # Fitil
+ if op.UST == '1':
+ y1 = my
+ else:
+ y1 = my - 1
+ for y in range(0, y1):
+ for x in range(0, mx):
+ if kx[x][y] is True:
+ kapak(myvertex, myfaces, xlist, zlist, x * 2 + 1, y * 2 + 1, k2 / 2, (k1 + k2) * 0.5 - 0.01)
+ fitil(myvertex, myfaces, xlist, zlist, x * 2 + 1, y * 2 + 1, k3, (k1 + k2) * 0.5 - 0.01, k2)
+ else:
+ fitil(myvertex, myfaces, xlist, zlist, x * 2 + 1, y * 2 + 1, k3, 0, 0)
+ m = len(myfaces)
+ cam.extend([m - 1, m - 2])
+ ftl.extend([m - 3, m - 4, m - 5, m - 6, m - 7, m - 8, m - 9, m - 10, m - 11, m - 12, m - 13, m - 14])
+ # -----------------------------------------------------
+ if op.UST == '1': # Duz
+ myfaces.append([ust[1], ust[0], son[0], son[1]])
+ for i in range(0, mx * 4, 4):
+ myfaces.append([alt[i], alt[i + 1], alt[i + 3], alt[i + 2]])
+ on = [ust[0]]
+ ar = [ust[1]]
+ for i in range(0, len(alt) - 1, 2):
+ on.append(alt[i])
+ ar.append(alt[i + 1])
+ on.append(son[0])
+ myfaces.append(on)
+ ar.append(son[1])
+ ar.reverse()
+ myfaces.append(ar)
+ elif op.UST == '2': # Arch
+ if op.DT2 == '1':
+ h1 = op.VL1 / 100
+ if op.VL1 < 6:
+ h1 = 6 / 100
+
+ if h1 < 0.01:
+ h1 = 0.01
+ # op.VL1 = 1
+ elif h1 >= u:
+ h1 = u - 0.01
+ # op.VL1 = h1 * 100
+ if h1 < 0.07:
+ h1 = 0.07
+
+ h = math.sqrt(u ** 2 + h1 ** 2) / 2
+ e = h * (u / h1)
+ c = math.sqrt(h ** 2 + e ** 2)
+ t1 = zlist[-1] - h1
+ elif op.DT2 == '2':
+ c = op.VL2 / 100
+ if c < u + 0.01:
+ c = u + 0.01
+ # op.VL2 = c * 100
+ t1 = math.sqrt(c ** 2 - u ** 2) + zlist[-1] - c
+ r = c - k1
+ z = zlist[-1] - c
+
+ myvertex[ust[0]][2] = t1
+ myvertex[ust[1]][2] = t1
+ myvertex[son[0]][2] = t1
+ myvertex[son[1]][2] = t1
+ for i in alt:
+ myvertex[i][2] = math.sqrt(r ** 2 - myvertex[i][0] ** 2) + z
+
+ on = [son[0]]
+ u1 = []
+ for i in range(0, res):
+ a = i * math.pi / res
+ x = math.cos(a) * c
+ if -u < x < u:
+ myvertex.append([x, -k1 / 2, math.sin(a) * c + z])
+ on.append(len(myvertex) - 1)
+ u1.extend(on)
+ u1.append(ust[0])
+ on.extend([ust[0], alt[0]])
+ ar = []
+ d1 = []
+ d2 = []
+ for i in range(0, len(alt) - 2, 4):
+ x1 = myvertex[alt[i + 0]][0]
+ x2 = myvertex[alt[i + 2]][0]
+ on.append(alt[i + 0])
+ ar.append(alt[i + 1])
+ t1 = [alt[i + 0]]
+ t2 = [alt[i + 1]]
+ for j in range(0, res):
+ a = j * math.pi / res
+ x = -math.cos(a) * r
+ if x1 < x < x2:
+ myvertex.extend([[x, -k1 / 2, math.sin(a) * r + z], [x, k1 / 2, math.sin(a) * r + z]])
+ on.append(len(myvertex) - 2)
+ ar.append(len(myvertex) - 1)
+ t1.append(len(myvertex) - 2)
+ t2.append(len(myvertex) - 1)
+ on.append(alt[i + 2])
+ ar.append(alt[i + 3])
+ t1.append(alt[i + 2])
+ t2.append(alt[i + 3])
+ d1.append(t1)
+ d2.append(t2)
+ ar.append(son[1])
+ u2 = [son[1]]
+ for i in range(0, res):
+ a = i * math.pi / res
+ x = math.cos(a) * c
+ if -u < x < u:
+ myvertex.append([x, k1 / 2, math.sin(a) * c + z])
+ ar.append(len(myvertex) - 1)
+ u2.append(len(myvertex) - 1)
+ ar.append(ust[1])
+ u2.append(ust[1])
+ ar.reverse()
+ myfaces.extend([on, ar])
+ for i in range(0, len(u1) - 1):
+ myfaces.append([u1[i + 1], u1[i], u2[i], u2[i + 1]])
+ sm.append(len(myfaces) - 1)
+ for a in range(0, mx):
+ for i in range(0, len(d1[a]) - 1):
+ myfaces.append([d1[a][i + 1], d1[a][i], d2[a][i], d2[a][i + 1]])
+ sm.append(len(myfaces) - 1)
+ y = my - 1
+ for x in range(0, mx):
+ if kx[x][y] is True:
+ fr = (k1 + k2) * 0.5 - 0.01
+ ek = k2
+ r = c - k1
+ k = r - k2
+
+ x1 = xlist[x * 2 + 1]
+ x2 = xlist[x * 2 + 2]
+ myvertex.extend([[x2, fr - k2 / 2, z + 1], [x2 - k2, fr - k2 / 2, z + 1],
+ [x2 - k2, fr + k2 / 2, z + 1],
+ [x2, fr + k2 / 2, z + 1]])
+ myvertex.extend([[x2, fr - k2 / 2, zlist[-3]], [x2 - k2, fr - k2 / 2, zlist[-3] + k2],
+ [x2 - k2, fr + k2 / 2,
+ zlist[-3] + k2],
+ [x2, fr + k2 / 2, zlist[-3]]])
+ myvertex.extend([[x1, fr - k2 / 2, zlist[-3]], [x1 + k2, fr - k2 / 2, zlist[-3] + k2],
+ [x1 + k2, fr + k2 / 2,
+ zlist[-3] + k2],
+ [x1, fr + k2 / 2, zlist[-3]]])
+ myvertex.extend([[x1, fr - k2 / 2, z + 1], [x1 + k2, fr - k2 / 2, z + 1],
+ [x1 + k2, fr + k2 / 2, z + 1],
+ [x1, fr + k2 / 2, z + 1]])
+
+ n = len(myvertex)
+ myfaces.extend([[n - 16, n - 15, n - 11, n - 12], [n - 15, n - 14, n - 10, n - 11],
+ [n - 14, n - 13, n - 9, n - 10], [n - 13, n - 16, n - 12, n - 9]])
+ myfaces.extend(
+ [[n - 12, n - 11, n - 7, n - 8], [n - 11, n - 10, n - 6, n - 7], [n - 10, n - 9, n - 5, n - 6],
+ [n - 9, n - 12, n - 8, n - 5]])
+ myfaces.extend(
+ [[n - 8, n - 7, n - 3, n - 4], [n - 7, n - 6, n - 2, n - 3], [n - 6, n - 5, n - 1, n - 2],
+ [n - 5, n - 8, n - 4, n - 1]])
+ alt = [n - 16, n - 15, n - 14, n - 13, n - 4, n - 3, n - 2, n - 1]
+ myvertex[alt[0]][2] = math.sqrt(r ** 2 - myvertex[alt[0]][0] ** 2) + z
+ myvertex[alt[1]][2] = math.sqrt(k ** 2 - myvertex[alt[1]][0] ** 2) + z
+ myvertex[alt[2]][2] = math.sqrt(k ** 2 - myvertex[alt[2]][0] ** 2) + z
+ myvertex[alt[3]][2] = math.sqrt(r ** 2 - myvertex[alt[3]][0] ** 2) + z
+ myvertex[alt[4]][2] = math.sqrt(r ** 2 - myvertex[alt[4]][0] ** 2) + z
+ myvertex[alt[5]][2] = math.sqrt(k ** 2 - myvertex[alt[5]][0] ** 2) + z
+ myvertex[alt[6]][2] = math.sqrt(k ** 2 - myvertex[alt[6]][0] ** 2) + z
+ myvertex[alt[7]][2] = math.sqrt(r ** 2 - myvertex[alt[7]][0] ** 2) + z
+
+ d1 = []
+ d2 = []
+ t1 = []
+ t2 = []
+ for i in range(0, res):
+ a = i * math.pi / res
+ y1 = math.cos(a) * r
+ y2 = -math.cos(a) * k
+ if x1 < y1 < x2:
+ myvertex.extend([[y1, fr - k2 / 2, math.sin(a) * r + z], [y1, fr + k2 / 2,
+ math.sin(a) * r + z]])
+ t1.append(len(myvertex) - 2)
+ t2.append(len(myvertex) - 1)
+ if x1 + k2 < y2 < x2 - k2:
+ myvertex.extend([[y2, fr - k2 / 2, math.sin(a) * k + z], [y2, fr + k2 / 2,
+ math.sin(a) * k + z]])
+ d1.append(len(myvertex) - 2)
+ d2.append(len(myvertex) - 1)
+ on = [alt[1], alt[0]]
+ on.extend(t1)
+ on.extend([alt[4], alt[5]])
+ on.extend(d1)
+ ar = [alt[2], alt[3]]
+ ar.extend(t2)
+ ar.extend([alt[7], alt[6]])
+ ar.extend(d2)
+ ar.reverse()
+
+ if d1 == [] and t1 == []:
+ myfaces.extend([on, ar, [alt[5], alt[6], alt[2], alt[1]], [alt[7], alt[4], alt[0], alt[
+ 3]]])
+ m = len(myfaces)
+ sm.extend(
+ [m - 1, m - 2])
+ elif d1 == [] and t1 != []:
+ myfaces.extend([on, ar, [alt[5], alt[6], alt[2], alt[1]], [alt[7], alt[4], t1[-1], t2[-1]],
+ [alt[0], alt[3], t2[0], t1[0]]])
+ m = len(myfaces)
+ sm.extend(
+ [m - 1, m - 2, m - 3])
+ elif d1 != [] and t1 == []:
+ myfaces.extend([on, ar, [alt[5], alt[6], d2[0], d1[0]], [alt[2], alt[1], d1[-1], d2[-1]],
+ [alt[7], alt[4], alt[0], alt[3]]])
+ m = len(myfaces)
+ sm.extend(
+ [m - 1, m - 2, m - 3])
+ else:
+ myfaces.extend([on, ar, [alt[5], alt[6], d2[0], d1[0]], [alt[2], alt[1], d1[-1], d2[-1]],
+ [alt[7], alt[4], t1[-1], t2[-1]], [alt[0], alt[3], t2[0], t1[0]]])
+ m = len(myfaces)
+ sm.extend(
+ [m - 1, m - 2, m - 3, m - 4])
+
+ for i in range(0, len(d1) - 1):
+ myfaces.append([d1[i + 1], d1[i], d2[i], d2[i + 1]])
+ sm.append(len(myfaces) - 1)
+ for i in range(0, len(t1) - 1):
+ myfaces.append([t1[i + 1], t1[i], t2[i], t2[i + 1]])
+ sm.append(len(myfaces) - 1)
+ r = c - k1 - k2
+ k = r - k3 * 2
+ else:
+ fr = 0
+ ek = 0
+ r = c - k1
+ k = r - k3 * 2
+ # Fitil
+ x1 = xlist[x * 2 + 1] + ek
+ x2 = xlist[x * 2 + 2] - ek
+ myvertex.extend([[x2, fr - k3, z + 1], [x2 - k3 * 2, fr - k3, z + 1], [x2 - k3 * 2, fr + k3, z + 1],
+ [x2, fr + k3, z + 1]])
+ myvertex.extend([[x2, fr - k3, zlist[-3] + ek], [x2 - k3 * 2, fr - k3, zlist[-3] + ek + k3 * 2],
+ [x2 - k3 * 2, fr + k3, zlist[-3] + ek + k3 * 2], [x2, fr + k3, zlist[-3] + ek]])
+ myvertex.extend([[x1, fr - k3, zlist[-3] + ek], [x1 + k3 * 2, fr - k3, zlist[-3] + ek + k3 * 2],
+ [x1 + k3 * 2, fr + k3, zlist[-3] + ek + k3 * 2], [x1, fr + k3, zlist[-3] + ek]])
+ myvertex.extend([[x1, fr - k3, z + 1], [x1 + k3 * 2, fr - k3, z + 1], [x1 + k3 * 2, fr + k3, z + 1],
+ [x1, fr + k3, z + 1]])
+ n = len(myvertex)
+ myfaces.extend(
+ [[n - 16, n - 15, n - 11, n - 12], [n - 15, n - 14, n - 10, n - 11], [n - 14, n - 13, n - 9,
+ n - 10]])
+ myfaces.extend(
+ [[n - 12, n - 11, n - 7, n - 8], [n - 11, n - 10, n - 6, n - 7], [n - 10, n - 9, n - 5, n - 6]])
+ myfaces.extend([[n - 8, n - 7, n - 3, n - 4], [n - 7, n - 6, n - 2, n - 3], [n - 6, n - 5, n - 1,
+ n - 2]])
+ m = len(myfaces)
+ ftl.extend([m - 1, m - 2, m - 3, m - 4, m - 5, m - 6, m - 7, m - 8, m - 9])
+ alt = [n - 16, n - 15, n - 14, n - 13, n - 4, n - 3, n - 2, n - 1]
+ myvertex[alt[0]][2] = math.sqrt(r ** 2 - myvertex[alt[0]][0] ** 2) + z
+ myvertex[alt[1]][2] = math.sqrt(k ** 2 - myvertex[alt[1]][0] ** 2) + z
+ myvertex[alt[2]][2] = math.sqrt(k ** 2 - myvertex[alt[2]][0] ** 2) + z
+ myvertex[alt[3]][2] = math.sqrt(r ** 2 - myvertex[alt[3]][0] ** 2) + z
+ myvertex[alt[4]][2] = math.sqrt(r ** 2 - myvertex[alt[4]][0] ** 2) + z
+ myvertex[alt[5]][2] = math.sqrt(k ** 2 - myvertex[alt[5]][0] ** 2) + z
+ myvertex[alt[6]][2] = math.sqrt(k ** 2 - myvertex[alt[6]][0] ** 2) + z
+ myvertex[alt[7]][2] = math.sqrt(r ** 2 - myvertex[alt[7]][0] ** 2) + z
+ d1 = []
+ d2 = []
+ t1 = []
+ t2 = []
+ for i in range(0, res):
+ a = i * math.pi / res
+ y1 = math.cos(a) * r
+ y2 = -math.cos(a) * k
+ if x1 < y1 < x2:
+ myvertex.extend([[y1, fr - k3, math.sin(a) * r + z], [y1, fr + k3, math.sin(a) * r + z]])
+ t1.append(len(myvertex) - 2)
+ t2.append(len(myvertex) - 1)
+ ftl.extend([len(myfaces) - 1, len(myfaces) - 2])
+ if x1 + k3 * 2 < y2 < x2 - k3 * 2:
+ myvertex.extend([[y2, fr - k3, math.sin(a) * k + z], [y2, fr + k3, math.sin(a) * k + z]])
+ d1.append(len(myvertex) - 2)
+ d2.append(len(myvertex) - 1)
+ ftl.extend([len(myfaces) - 1, len(myfaces) - 2])
+ on = [alt[1], alt[0]]
+ on.extend(t1)
+ on.extend([alt[4], alt[5]])
+ on.extend(d1)
+ ar = [alt[2], alt[3]]
+ ar.extend(t2)
+ ar.extend([alt[7], alt[6]])
+ ar.extend(d2)
+ ar.reverse()
+
+ if not d1:
+ myfaces.extend([on, ar, [alt[5], alt[6], alt[2], alt[1]]])
+ m = len(myfaces)
+ ftl.extend([m - 1, m - 2, m - 3])
+ sm.extend([m - 1])
+ else:
+ myfaces.extend([on, ar, [alt[5], alt[6], d2[0], d1[0]], [alt[2], alt[1], d1[-1], d2[-1]]])
+ m = len(myfaces)
+ ftl.extend([m - 1, m - 2, m - 3, m - 4])
+ sm.extend([m - 1, m - 2])
+
+ for i in range(0, len(d1) - 1):
+ myfaces.append([d1[i + 1], d1[i], d2[i], d2[i + 1]])
+ ftl.append(len(myfaces) - 1)
+ sm.append(len(myfaces) - 1)
+ # Cam
+ x1 = xlist[x * 2 + 1] + ek + k3 * 2
+ x2 = xlist[x * 2 + 2] - ek - k3 * 2
+ on = []
+ ar = []
+ for i in range(0, res):
+ a = i * math.pi / res
+ y1 = -math.cos(a) * k
+ if x1 < y1 < x2:
+ myvertex.extend([[y1, fr - 0.005, math.sin(a) * k + z], [y1, fr + 0.005, math.sin(a) * k + z]])
+ n = len(myvertex)
+ on.append(n - 1)
+ ar.append(n - 2)
+ myvertex.extend(
+ [[x1, fr - 0.005, math.sqrt(k ** 2 - x1 ** 2) + z], [x1, fr + 0.005,
+ math.sqrt(k ** 2 - x1 ** 2) + z]])
+ myvertex.extend([[x1, fr - 0.005, zlist[-3] + ek + k3 * 2], [x1, fr + 0.005, zlist[-3] + ek + k3 * 2]])
+ myvertex.extend([[x2, fr - 0.005, zlist[-3] + ek + k3 * 2], [x2, fr + 0.005, zlist[-3] + ek + k3 * 2]])
+ myvertex.extend(
+ [[x2, fr - 0.005, math.sqrt(k ** 2 - x2 ** 2) + z], [x2, fr + 0.005,
+ math.sqrt(k ** 2 - x2 ** 2) + z]])
+ n = len(myvertex)
+ on.extend([n - 1, n - 3, n - 5, n - 7])
+ ar.extend([n - 2, n - 4, n - 6, n - 8])
+ myfaces.append(on)
+ ar.reverse()
+ myfaces.append(ar)
+ m = len(myfaces)
+ cam.extend([m - 1, m - 2])
+
+ elif op.UST == '3': # Egri
+ if op.DT3 == '1':
+ h1 = (op.VL1 / 200) / u
+ elif op.DT3 == '2':
+ h1 = op.VL3 / 100
+ elif op.DT3 == '3':
+ h1 = math.sin(op.VL4 * math.pi / 180) / math.cos(op.VL4 * math.pi / 180)
+ z = math.sqrt(k1 ** 2 + (k1 * h1) ** 2)
+ k = math.sqrt(k2 ** 2 + (k2 * h1) ** 2)
+ f = math.sqrt(k3 ** 2 + (k3 * h1) ** 2) * 2
+ myvertex[ust[0]][2] = zlist[-1] + myvertex[ust[0]][0] * h1
+ myvertex[ust[1]][2] = zlist[-1] + myvertex[ust[1]][0] * h1
+ for i in alt:
+ myvertex[i][2] = zlist[-1] + myvertex[i][0] * h1 - z
+ myvertex[son[0]][2] = zlist[-1] + myvertex[son[0]][0] * h1
+ myvertex[son[1]][2] = zlist[-1] + myvertex[son[1]][0] * h1
+ myfaces.append([ust[1], ust[0], son[0], son[1]])
+ for i in range(0, mx * 4, 4):
+ myfaces.append([alt[i], alt[i + 1], alt[i + 3], alt[i + 2]])
+ on = [ust[0]]
+ ar = [ust[1]]
+ for i in range(0, len(alt) - 1, 2):
+ on.append(alt[i])
+ ar.append(alt[i + 1])
+ on.append(son[0])
+ myfaces.append(on)
+ ar.append(son[1])
+ ar.reverse()
+ myfaces.append(ar)
+ y = my - 1
+ for x in range(0, mx):
+ if kx[x][y] is True:
+ kapak(myvertex, myfaces, xlist, zlist, x * 2 + 1, y * 2 + 1, k2 / 2, (k1 + k2) * 0.5 - 0.01)
+ n = len(myvertex)
+ myvertex[n - 5][2] = zlist[-1] + myvertex[n - 5][0] * h1 - z
+ myvertex[n - 6][2] = zlist[-1] + myvertex[n - 6][0] * h1 - z - k
+ myvertex[n - 7][2] = zlist[-1] + myvertex[n - 7][0] * h1 - z - k
+ myvertex[n - 8][2] = zlist[-1] + myvertex[n - 8][0] * h1 - z
+ myvertex[n - 9][2] = zlist[-1] + myvertex[n - 9][0] * h1 - z
+ myvertex[n - 10][2] = zlist[-1] + myvertex[n - 10][0] * h1 - z - k
+ myvertex[n - 11][2] = zlist[-1] + myvertex[n - 11][0] * h1 - z - k
+ myvertex[n - 12][2] = zlist[-1] + myvertex[n - 12][0] * h1 - z
+ fitil(myvertex, myfaces, xlist, zlist, x * 2 + 1, y * 2 + 1, k3, (k1 + k2) * 0.5 - 0.01, k2)
+ n = len(myvertex)
+ myvertex[n - 2][2] = zlist[-1] + myvertex[n - 2][0] * h1 - z - k - f
+ myvertex[n - 3][2] = zlist[-1] + myvertex[n - 3][0] * h1 - z - k - f
+ myvertex[n - 6][2] = zlist[-1] + myvertex[n - 6][0] * h1 - z - k - f
+ myvertex[n - 7][2] = zlist[-1] + myvertex[n - 7][0] * h1 - z - k - f
+ myvertex[n - 13][2] = zlist[-1] + myvertex[n - 13][0] * h1 - z - k
+ myvertex[n - 14][2] = zlist[-1] + myvertex[n - 14][0] * h1 - z - k - f
+ myvertex[n - 15][2] = zlist[-1] + myvertex[n - 15][0] * h1 - z - k - f
+ myvertex[n - 16][2] = zlist[-1] + myvertex[n - 16][0] * h1 - z - k
+ myvertex[n - 17][2] = zlist[-1] + myvertex[n - 17][0] * h1 - z - k
+ myvertex[n - 18][2] = zlist[-1] + myvertex[n - 18][0] * h1 - z - k - f
+ myvertex[n - 19][2] = zlist[-1] + myvertex[n - 19][0] * h1 - z - k - f
+ myvertex[n - 20][2] = zlist[-1] + myvertex[n - 20][0] * h1 - z - k
+ else:
+ fitil(myvertex, myfaces, xlist, zlist, x * 2 + 1, y * 2 + 1, k3, 0, 0)
+ n = len(myvertex)
+ myvertex[n - 2][2] = zlist[-1] + myvertex[n - 2][0] * h1 - z - f
+ myvertex[n - 3][2] = zlist[-1] + myvertex[n - 3][0] * h1 - z - f
+ myvertex[n - 6][2] = zlist[-1] + myvertex[n - 6][0] * h1 - z - f
+ myvertex[n - 7][2] = zlist[-1] + myvertex[n - 7][0] * h1 - z - f
+ myvertex[n - 13][2] = zlist[-1] + myvertex[n - 13][0] * h1 - z
+ myvertex[n - 14][2] = zlist[-1] + myvertex[n - 14][0] * h1 - z - f
+ myvertex[n - 15][2] = zlist[-1] + myvertex[n - 15][0] * h1 - z - f
+ myvertex[n - 16][2] = zlist[-1] + myvertex[n - 16][0] * h1 - z
+ myvertex[n - 17][2] = zlist[-1] + myvertex[n - 17][0] * h1 - z
+ myvertex[n - 18][2] = zlist[-1] + myvertex[n - 18][0] * h1 - z - f
+ myvertex[n - 19][2] = zlist[-1] + myvertex[n - 19][0] * h1 - z - f
+ myvertex[n - 20][2] = zlist[-1] + myvertex[n - 20][0] * h1 - z
+ m = len(myfaces)
+ cam.extend([m - 1, m - 2])
+ ftl.extend([m - 3, m - 4, m - 5, m - 6, m - 7, m - 8, m - 9, m - 10, m - 11, m - 12, m - 13, m - 14])
+ elif op.UST == '4': # Ucgen
+ if op.DT3 == '1':
+ h1 = (op.VL1 / 100) / u
+ elif op.DT3 == '2':
+ h1 = op.VL3 / 100
+ elif op.DT3 == '3':
+ h1 = math.sin(op.VL4 * math.pi / 180) / math.cos(op.VL4 * math.pi / 180)
+ z = math.sqrt(k1 ** 2 + (k1 * h1) ** 2)
+ k = math.sqrt(k2 ** 2 + (k2 * h1) ** 2)
+ f = math.sqrt(k3 ** 2 + (k3 * h1) ** 2) * 2
+ myvertex[ust[0]][2] = zlist[-1] + myvertex[ust[0]][0] * h1
+ myvertex[ust[1]][2] = zlist[-1] + myvertex[ust[1]][0] * h1
+ for i in alt:
+ myvertex[i][2] = zlist[-1] - abs(myvertex[i][0]) * h1 - z
+ myvertex[son[0]][2] = zlist[-1] - myvertex[son[0]][0] * h1
+ myvertex[son[1]][2] = zlist[-1] - myvertex[son[1]][0] * h1
+ myvertex.extend([[0, -k1 / 2, zlist[-1]], [0, k1 / 2, zlist[-1]]])
+
+ x = 0
+ for j in range(2, len(alt) - 2, 4):
+ if myvertex[alt[j]][0] < 0 < myvertex[alt[j + 2]][0]:
+ x = 1
+
+ n = len(myvertex)
+ myfaces.extend([[ust[1], ust[0], n - 2, n - 1], [n - 1, n - 2, son[0], son[1]]])
+ on = [son[0], n - 2, ust[0]]
+ ar = [son[1], n - 1, ust[1]]
+
+ if x == 0:
+ myvertex.extend([[0, -k1 / 2, zlist[-1] - z], [0, k1 / 2, zlist[-1] - z]])
+ for j in range(0, len(alt) - 2, 4):
+ if myvertex[alt[j]][0] < 0 and myvertex[alt[j + 2]][0] < 0:
+ myfaces.append([alt[j], alt[j + 1], alt[j + 3], alt[j + 2]])
+ on.extend([alt[j], alt[j + 2]])
+ ar.extend([alt[j + 1], alt[j + 3]])
+ elif myvertex[alt[j]][0] > 0 and myvertex[alt[j + 2]][0] > 0:
+ myfaces.append([alt[j], alt[j + 1], alt[j + 3], alt[j + 2]])
+ on.extend([alt[j], alt[j + 2]])
+ ar.extend([alt[j + 1], alt[j + 3]])
+ else:
+ n = len(myvertex)
+ myfaces.extend([[alt[j], alt[j + 1], n - 1, n - 2], [n - 2, n - 1, alt[j + 3], alt[j + 2]]])
+ on.extend([alt[j + 0], n - 2, alt[j + 2]])
+ ar.extend([alt[j + 1], n - 1, alt[j + 3]])
+ myfaces.append(on)
+ ar.reverse()
+ myfaces.append(ar)
+ y = my - 1
+ for x in range(0, mx):
+ if myvertex[alt[x * 4]][0] < 0 and myvertex[alt[x * 4 + 2]][0] < 0:
+ if kx[x][y] is True:
+ kapak(myvertex, myfaces, xlist, zlist, x * 2 + 1, y * 2 + 1, k2 / 2, (k1 + k2) * 0.5 - 0.01)
+ n = len(myvertex)
+ myvertex[n - 5][2] = zlist[-1] + myvertex[n - 5][0] * h1 - z
+ myvertex[n - 6][2] = zlist[-1] + myvertex[n - 6][0] * h1 - z - k
+ myvertex[n - 7][2] = zlist[-1] + myvertex[n - 7][0] * h1 - z - k
+ myvertex[n - 8][2] = zlist[-1] + myvertex[n - 8][0] * h1 - z
+ myvertex[n - 9][2] = zlist[-1] + myvertex[n - 9][0] * h1 - z
+ myvertex[n - 10][2] = zlist[-1] + myvertex[n - 10][0] * h1 - z - k
+ myvertex[n - 11][2] = zlist[-1] + myvertex[n - 11][0] * h1 - z - k
+ myvertex[n - 12][2] = zlist[-1] + myvertex[n - 12][0] * h1 - z
+ fitil(myvertex, myfaces, xlist, zlist, x * 2 + 1, y * 2 + 1, k3, (k1 + k2) * 0.5 - 0.01, k2)
+ n = len(myvertex)
+ myvertex[n - 2][2] = zlist[-1] + myvertex[n - 2][0] * h1 - z - k - f
+ myvertex[n - 3][2] = zlist[-1] + myvertex[n - 3][0] * h1 - z - k - f
+ myvertex[n - 6][2] = zlist[-1] + myvertex[n - 6][0] * h1 - z - k - f
+ myvertex[n - 7][2] = zlist[-1] + myvertex[n - 7][0] * h1 - z - k - f
+ myvertex[n - 13][2] = zlist[-1] + myvertex[n - 13][0] * h1 - z - k
+ myvertex[n - 14][2] = zlist[-1] + myvertex[n - 14][0] * h1 - z - k - f
+ myvertex[n - 15][2] = zlist[-1] + myvertex[n - 15][0] * h1 - z - k - f
+ myvertex[n - 16][2] = zlist[-1] + myvertex[n - 16][0] * h1 - z - k
+ myvertex[n - 17][2] = zlist[-1] + myvertex[n - 17][0] * h1 - z - k
+ myvertex[n - 18][2] = zlist[-1] + myvertex[n - 18][0] * h1 - z - k - f
+ myvertex[n - 19][2] = zlist[-1] + myvertex[n - 19][0] * h1 - z - k - f
+ myvertex[n - 20][2] = zlist[-1] + myvertex[n - 20][0] * h1 - z - k
+ else:
+ fitil(myvertex, myfaces, xlist, zlist, x * 2 + 1, y * 2 + 1, k3, 0, 0)
+ n = len(myvertex)
+ myvertex[n - 2][2] = zlist[-1] + myvertex[n - 2][0] * h1 - z - f
+ myvertex[n - 3][2] = zlist[-1] + myvertex[n - 3][0] * h1 - z - f
+ myvertex[n - 6][2] = zlist[-1] + myvertex[n - 6][0] * h1 - z - f
+ myvertex[n - 7][2] = zlist[-1] + myvertex[n - 7][0] * h1 - z - f
+ myvertex[n - 13][2] = zlist[-1] + myvertex[n - 13][0] * h1 - z
+ myvertex[n - 14][2] = zlist[-1] + myvertex[n - 14][0] * h1 - z - f
+ myvertex[n - 15][2] = zlist[-1] + myvertex[n - 15][0] * h1 - z - f
+ myvertex[n - 16][2] = zlist[-1] + myvertex[n - 16][0] * h1 - z
+ myvertex[n - 17][2] = zlist[-1] + myvertex[n - 17][0] * h1 - z
+ myvertex[n - 18][2] = zlist[-1] + myvertex[n - 18][0] * h1 - z - f
+ myvertex[n - 19][2] = zlist[-1] + myvertex[n - 19][0] * h1 - z - f
+ myvertex[n - 20][2] = zlist[-1] + myvertex[n - 20][0] * h1 - z
+ m = len(myfaces)
+ cam.extend([m - 1, m - 2])
+ ftl.extend([m - 3, m - 4, m - 5, m - 6, m - 7, m - 8, m - 9, m - 10, m - 11,
+ m - 12, m - 13, m - 14])
+ elif myvertex[alt[x * 4]][0] > 0 and myvertex[alt[x * 4 + 2]][0] > 0:
+ if kx[x][y] is True:
+ kapak(myvertex, myfaces, xlist, zlist, x * 2 + 1, y * 2 + 1, k2 / 2, (k1 + k2) * 0.5 - 0.01)
+ n = len(myvertex)
+ myvertex[n - 5][2] = zlist[-1] - myvertex[n - 5][0] * h1 - z
+ myvertex[n - 6][2] = zlist[-1] - myvertex[n - 6][0] * h1 - z - k
+ myvertex[n - 7][2] = zlist[-1] - myvertex[n - 7][0] * h1 - z - k
+ myvertex[n - 8][2] = zlist[-1] - myvertex[n - 8][0] * h1 - z
+ myvertex[n - 9][2] = zlist[-1] - myvertex[n - 9][0] * h1 - z
+ myvertex[n - 10][2] = zlist[-1] - myvertex[n - 10][0] * h1 - z - k
+ myvertex[n - 11][2] = zlist[-1] - myvertex[n - 11][0] * h1 - z - k
+ myvertex[n - 12][2] = zlist[-1] - myvertex[n - 12][0] * h1 - z
+ fitil(myvertex, myfaces, xlist, zlist, x * 2 + 1, y * 2 + 1, k3, (k1 + k2) * 0.5 - 0.01, k2)
+ n = len(myvertex)
+ myvertex[n - 2][2] = zlist[-1] - myvertex[n - 2][0] * h1 - z - k - f
+ myvertex[n - 3][2] = zlist[-1] - myvertex[n - 3][0] * h1 - z - k - f
+ myvertex[n - 6][2] = zlist[-1] - myvertex[n - 6][0] * h1 - z - k - f
+ myvertex[n - 7][2] = zlist[-1] - myvertex[n - 7][0] * h1 - z - k - f
+ myvertex[n - 13][2] = zlist[-1] - myvertex[n - 13][0] * h1 - z - k
+ myvertex[n - 14][2] = zlist[-1] - myvertex[n - 14][0] * h1 - z - k - f
+ myvertex[n - 15][2] = zlist[-1] - myvertex[n - 15][0] * h1 - z - k - f
+ myvertex[n - 16][2] = zlist[-1] - myvertex[n - 16][0] * h1 - z - k
+ myvertex[n - 17][2] = zlist[-1] - myvertex[n - 17][0] * h1 - z - k
+ myvertex[n - 18][2] = zlist[-1] - myvertex[n - 18][0] * h1 - z - k - f
+ myvertex[n - 19][2] = zlist[-1] - myvertex[n - 19][0] * h1 - z - k - f
+ myvertex[n - 20][2] = zlist[-1] - myvertex[n - 20][0] * h1 - z - k
+ else:
+ fitil(myvertex, myfaces, xlist, zlist, x * 2 + 1, y * 2 + 1, k3, 0, 0)
+ n = len(myvertex)
+ myvertex[n - 2][2] = zlist[-1] - myvertex[n - 2][0] * h1 - z - f
+ myvertex[n - 3][2] = zlist[-1] - myvertex[n - 3][0] * h1 - z - f
+ myvertex[n - 6][2] = zlist[-1] - myvertex[n - 6][0] * h1 - z - f
+ myvertex[n - 7][2] = zlist[-1] - myvertex[n - 7][0] * h1 - z - f
+ myvertex[n - 13][2] = zlist[-1] - myvertex[n - 13][0] * h1 - z
+ myvertex[n - 14][2] = zlist[-1] - myvertex[n - 14][0] * h1 - z - f
+ myvertex[n - 15][2] = zlist[-1] - myvertex[n - 15][0] * h1 - z - f
+ myvertex[n - 16][2] = zlist[-1] - myvertex[n - 16][0] * h1 - z
+ myvertex[n - 17][2] = zlist[-1] - myvertex[n - 17][0] * h1 - z
+ myvertex[n - 18][2] = zlist[-1] - myvertex[n - 18][0] * h1 - z - f
+ myvertex[n - 19][2] = zlist[-1] - myvertex[n - 19][0] * h1 - z - f
+ myvertex[n - 20][2] = zlist[-1] - myvertex[n - 20][0] * h1 - z
+ m = len(myfaces)
+ cam.extend([m - 1, m - 2])
+ ftl.extend([m - 3, m - 4, m - 5, m - 6, m - 7, m - 8, m - 9, m - 10,
+ m - 11, m - 12, m - 13, m - 14])
+ else:
+ k4 = k3 * 2
+ if kx[x][y] is True:
+ zz = (k1 + k2) * 0.5 - 0.01
+ xx = xlist[x * 2 + 1]
+ myvertex.extend([[xx, -k2 / 2 + zz, zlist[-3]], [xx + k2, -k2 / 2 + zz, zlist[-3] + k2],
+ [xx + k2, k2 / 2 + zz, zlist[-3] + k2], [xx, k2 / 2 + zz, zlist[-3]]])
+ myvertex.extend(
+ [[xx, -k2 / 2 + zz, zlist[-1] + xx * h1 - z], [xx + k2, -k2 / 2 + zz,
+ zlist[-1] + (xx + k2) * h1 - z - k],
+ [xx + k2, k2 / 2 + zz, zlist[-1] + (xx + k2) * h1 - z - k],
+ [xx, k2 / 2 + zz, zlist[-1] + xx * h1 - z]])
+ myvertex.extend([[0, -k2 / 2 + zz, zlist[-1] - z], [0, -k2 / 2 + zz, zlist[-1] - z - k],
+ [0, k2 / 2 + zz, zlist[-1] - z - k], [0, k2 / 2 + zz, zlist[-1] - z]])
+ xx = xlist[x * 2 + 2]
+ myvertex.extend(
+ [[xx, -k2 / 2 + zz, zlist[-1] - xx * h1 - z], [xx - k2, -k2 / 2 + zz,
+ zlist[-1] - (xx - k2) * h1 - z - k],
+ [xx - k2, k2 / 2 + zz, zlist[-1] - (xx - k2) * h1 - z - k],
+ [xx, k2 / 2 + zz, zlist[-1] - xx * h1 - z]])
+ myvertex.extend([[xx, -k2 / 2 + zz, zlist[-3]], [xx - k2, -k2 / 2 + zz, zlist[-3] + k2],
+ [xx - k2, k2 / 2 + zz, zlist[-3] + k2], [xx, k2 / 2 + zz, zlist[-3]]])
+ n = len(myvertex)
+ myfaces.extend([[n - 20, n - 19, n - 15, n - 16], [n - 19, n - 18, n - 14, n - 15],
+ [n - 18, n - 17, n - 13, n - 14], [n - 17, n - 20, n - 16, n - 13]])
+ myfaces.extend([[n - 16, n - 15, n - 11, n - 12], [n - 15, n - 14, n - 10, n - 11],
+ [n - 14, n - 13, n - 9, n - 10], [n - 13, n - 16, n - 12, n - 9]])
+ myfaces.extend(
+ [[n - 12, n - 11, n - 7, n - 8], [n - 11, n - 10, n - 6, n - 7], [n - 10, n - 9,
+ n - 5, n - 6],
+ [n - 9, n - 12, n - 8, n - 5]])
+ myfaces.extend(
+ [[n - 8, n - 7, n - 3, n - 4], [n - 7, n - 6, n - 2, n - 3], [n - 6, n - 5, n - 1, n - 2],
+ [n - 5, n - 8, n - 4, n - 1]])
+ myfaces.extend(
+ [[n - 4, n - 3, n - 19, n - 20], [n - 3, n - 2, n - 18, n - 19],
+ [n - 2, n - 1, n - 17, n - 18],
+ [n - 1, n - 4, n - 20, n - 17]])
+ xx = xlist[x * 2 + 1]
+ myvertex.extend([[xx + k2, -k3 + zz, zlist[-3] + k2], [xx + k4 + k2, -k3 + zz,
+ zlist[-3] + k2 + k4],
+ [xx + k4 + k2, k3 + zz, zlist[-3] + k2 + k4], [xx + k2, k3 + zz,
+ zlist[-3] + k2]])
+ myvertex.extend([[xx + k2, -k3 + zz, zlist[-1] + (xx + k2) * h1 - z - k],
+ [xx + k4 + k2, -k3 + zz, zlist[-1] + (xx + k2 + k4) * h1 - z - k - f],
+ [xx + k4 + k2, k3 + zz, zlist[-1] + (xx + k2 + k4) * h1 - z - k - f],
+ [xx + k2, k3 + zz, zlist[-1] + (xx + k2) * h1 - z - k]])
+ myvertex.extend([[0, -k3 + zz, zlist[-1] - k - z], [0, -k3 + zz, zlist[-1] - k - z - f],
+ [0, k3 + zz, zlist[-1] - k - z - f], [0, k3 + zz, zlist[-1] - k - z]])
+ xx = xlist[x * 2 + 2]
+ myvertex.extend([[xx - k2, -k3 + zz, zlist[-1] - (xx - k2) * h1 - z - k],
+ [xx - k4 - k2, -k3 + zz, zlist[-1] - (xx - k2 - k4) * h1 - z - k - f],
+ [xx - k4 - k2, k3 + zz, zlist[-1] - (xx - k2 - k4) * h1 - z - k - f],
+ [xx - k2, k3 + zz, zlist[-1] - (xx - k2) * h1 - z - k]])
+ myvertex.extend([[xx - k2, -k3 + zz, zlist[-3] + k2],
+ [xx - k4 - k2, -k3 + zz, zlist[-3] + k2 + k4],
+ [xx - k4 - k2, k3 + zz, zlist[-3] + k2 + k4],
+ [xx - k2, k3 + zz, zlist[-3] + k2]])
+ n = len(myvertex)
+ myfaces.extend([[n - 20, n - 19, n - 15, n - 16], [n - 19, n - 18, n - 14, n - 15],
+ [n - 18, n - 17, n - 13, n - 14]])
+ myfaces.extend([[n - 16, n - 15, n - 11, n - 12], [n - 15, n - 14, n - 10, n - 11],
+ [n - 14, n - 13, n - 9, n - 10]])
+ myfaces.extend(
+ [[n - 12, n - 11, n - 7, n - 8], [n - 11, n - 10, n - 6, n - 7], [n - 10,
+ n - 9, n - 5, n - 6]])
+ myfaces.extend(
+ [[n - 8, n - 7, n - 3, n - 4], [n - 7, n - 6, n - 2, n - 3], [n - 6, n - 5, n - 1, n - 2]])
+ myfaces.extend([[n - 4, n - 3, n - 19, n - 20], [n - 3, n - 2, n - 18, n - 19],
+ [n - 2, n - 1, n - 17, n - 18]])
+ xx = xlist[x * 2 + 1]
+ myvertex.extend(
+ [[xx + k4 + k2, -k3 + zz, zlist[-3] + k2 + k4], [xx + k4 + k2, k3 + zz, zlist[-3] +
+ k2 + k4]])
+ myvertex.extend([[xx + k4 + k2, -k3 + zz, zlist[-1] + (xx + k2 + k4) * h1 - z - k - f],
+ [xx + k4 + k2, k3 + zz, zlist[-1] + (xx + k2 + k4) * h1 - z - k - f]])
+ myvertex.extend([[0, -k3 + zz, zlist[-1] - k - z - f], [0, k3 + zz, zlist[-1] - k - z - f]])
+ xx = xlist[x * 2 + 2]
+ myvertex.extend([[xx - k4 - k2, -k3 + zz, zlist[-1] - (xx - k2 - k4) * h1 - z - k - f],
+ [xx - k4 - k2, k3 + zz, zlist[-1] - (xx - k2 - k4) * h1 - z - k - f]])
+ myvertex.extend(
+ [[xx - k4 - k2, -k3 + zz, zlist[-3] + k2 + k4], [xx - k4 - k2, k3 + zz, zlist[-3] +
+ k2 + k4]])
+ myfaces.extend([[n + 8, n + 6, n + 4, n + 2, n + 0], [n + 1, n + 3, n + 5, n + 7, n + 9]])
+ else:
+ xx = xlist[x * 2 + 1]
+ myvertex.extend(
+ [[xx, -k3, zlist[-3]], [xx + k4, -k3, zlist[-3] + k4], [xx + k4, k3, zlist[-3] + k4],
+ [xx, k3, zlist[-3]]])
+ myvertex.extend(
+ [[xx, -k3, zlist[-1] + xx * h1 - z], [xx + k4, -k3, zlist[-1] + (xx + k4) * h1 - z - f],
+ [xx + k4, k3, zlist[-1] + (xx + k4) * h1 - z - f], [xx, k3, zlist[-1] + xx * h1 - z]])
+ myvertex.extend(
+ [[0, -k3, zlist[-1] - z], [0, -k3, zlist[-1] - z - f], [0, k3, zlist[-1] - z - f],
+ [0, k3, zlist[-1] - z]])
+ xx = xlist[x * 2 + 2]
+ myvertex.extend(
+ [[xx, -k3, zlist[-1] - xx * h1 - z], [xx - k4, -k3, zlist[-1] - (xx - k4) * h1 - z - f],
+ [xx - k4, k3, zlist[-1] - (xx - k4) * h1 - z - f], [xx, k3, zlist[-1] - xx * h1 - z]])
+ myvertex.extend(
+ [[xx, -k3, zlist[-3]], [xx - k4, -k3, zlist[-3] + k4], [xx - k4, k3, zlist[-3] + k4],
+ [xx, k3, zlist[-3]]])
+ n = len(myvertex)
+ myfaces.extend([[n - 20, n - 19, n - 15, n - 16], [n - 19, n - 18, n - 14, n - 15],
+ [n - 18, n - 17, n - 13, n - 14]])
+ myfaces.extend([[n - 16, n - 15, n - 11, n - 12], [n - 15, n - 14, n - 10, n - 11],
+ [n - 14, n - 13, n - 9, n - 10]])
+ myfaces.extend(
+ [[n - 12, n - 11, n - 7, n - 8], [n - 11, n - 10, n - 6, n - 7], [n - 10, n - 9, n - 5,
+ n - 6]])
+ myfaces.extend(
+ [[n - 8, n - 7, n - 3, n - 4], [n - 7, n - 6, n - 2, n - 3], [n - 6, n - 5, n - 1, n - 2]])
+ myfaces.extend([[n - 4, n - 3, n - 19, n - 20], [n - 3, n - 2, n - 18, n - 19],
+ [n - 2, n - 1, n - 17, n - 18]])
+ xx = xlist[x * 2 + 1]
+ myvertex.extend([[xx + k4, -0.005, zlist[-3] + k4], [xx + k4, 0.005, zlist[-3] + k4]])
+ myvertex.extend([[xx + k4, -0.005, zlist[-1] + (xx + k4) * h1 - z - f],
+ [xx + k4, 0.005, zlist[-1] + (xx + k4) * h1 - z - f]])
+ myvertex.extend([[0, -0.005, zlist[-1] - z - f], [0, 0.005, zlist[-1] - z - f]])
+ xx = xlist[x * 2 + 2]
+ myvertex.extend([[xx - k4, -0.005, zlist[-1] - (xx - k4) * h1 - z - f],
+ [xx - k4, 0.005, zlist[-1] - (xx - k4) * h1 - z - f]])
+ myvertex.extend([[xx - k4, -0.005, zlist[-3] + k4], [xx - k4, 0.005, zlist[-3] + k4]])
+ myfaces.extend([[n + 8, n + 6, n + 4, n + 2, n + 0], [n + 1, n + 3, n + 5, n + 7, n + 9]])
+ m = len(myfaces)
+ cam.extend([m - 1, m - 2])
+ ftl.extend(
+ [m - 3, m - 4, m - 5, m - 6, m - 7, m - 8, m - 9, m - 10, m - 11, m - 12, m - 13,
+ m - 14, m - 15,
+ m - 16, m - 17])
+ # Mermer
+ if op.mr is True:
+ mrh = -op.mr1 / 100
+ mrg = op.mr2 / 100
+ mdv = (op.mr3 / 200) + mrg
+ msv = -(mdv + (op.mr4 / 100))
+ myvertex.extend([[-u, mdv, 0], [u, mdv, 0], [-u, msv, 0], [u, msv, 0], [-u, mdv, mrh], [u, mdv, mrh],
+ [-u, msv, mrh],
+ [u, msv, mrh]])
+ n = len(myvertex)
+ myfaces.extend([[n - 1, n - 2, n - 4, n - 3], [n - 3, n - 4, n - 8, n - 7], [n - 6, n - 5, n - 7, n - 8],
+ [n - 2, n - 1, n - 5, n - 6], [n - 4, n - 2, n - 6, n - 8], [n - 5, n - 1, n - 3, n - 7]])
+ n = len(myfaces)
+ mer.extend([n - 1, n - 2, n - 3, n - 4, n - 5, n - 6])
+
+ return True, ftl, cam, mer, sm
+ except:
+ return False, None, None, None, None
+
+
+# ------------------------------------
+# Get highest points of the panel
+# ------------------------------------
+def get_high_points(selobject, width, tip):
+ obverts = selobject.data.vertices
+
+ top_a = 0
+ top_b = 0
+ top_c = 0
+ # --------------------------
+ # Recover all vertex
+ # --------------------------
+ for vertex in obverts:
+ if vertex.co[0] == -width / 2:
+ if vertex.co[2] >= top_a:
+ top_a = vertex.co[2]
+ if vertex.co[0] == width / 2:
+ if vertex.co[2] >= top_b:
+ top_b = vertex.co[2]
+ # top center
+ if tip == "2":
+ if vertex.co[2] >= top_c:
+ top_c = vertex.co[2]
+ else:
+ if vertex.co[0] == 0 and vertex.co[2] >= top_c:
+ top_c = vertex.co[2]
+
+ return top_a, top_b, top_c
+
+
+# ---------------------------------------------------------
+# Defines a point
+# ---------------------------------------------------------
+class Cpoint:
+
+ def __init__(self, x, y):
+ self.x = float(x)
+ self.y = float(y)
+
+
+# ---------------------------------------------------------
+# Get angle between two vectors
+# ---------------------------------------------------------
+def get_angle(p1, p2):
+ v1 = mathutils.Vector((p1[0], 0.0, p1[1]))
+ v2 = mathutils.Vector((p2[0], 0.0, p2[1]))
+
+ a = v1.angle(v2)
+ return a
+
+
+# ---------------------------------------------------------
+# Get center of circle base on 3 points
+#
+# Point a: (x,z)
+# Point b: (x,z)
+# Point c: (x,z)
+# Return:
+# x, y: center poistion
+# r: radio
+# ang: angle
+# ---------------------------------------------------------
+def get_circle_center(a, b, c):
+ try:
+ # line between a and b: s1 + k * d1
+ s1 = Cpoint((a.x + b.x) / 2.0, (a.y + b.y) / 2.0)
+ d1 = Cpoint(b.y - a.y, a.x - b.x)
+ # line between a and c: s2 + k * d2
+ s2 = Cpoint((a.x + c.x) / 2.0, (a.y + c.y) / 2.0)
+ d2 = Cpoint(c.y - a.y, a.x - c.x)
+ # intersection of both lines:
+ l = d1.x * (s2.y - s1.y) - d1.y * (s2.x - s1.x)
+ l /= d2.x * d1.y - d2.y * d1.x
+ center = Cpoint(s2.x + l * d2.x, s2.y + l * d2.y)
+ dx = center.x - a.x
+ dy = center.y - a.y
+ radio = math.sqrt(dx * dx + dy * dy)
+
+ # angle
+ v1 = (a.x - center.x, a.y - center.y)
+ v2 = (b.x - center.x, b.y - center.y)
+ ang = get_angle(v1, v2)
+ return center, radio, ang
+ except ZeroDivisionError:
+ return Cpoint(0, 0), 1, 1
+
+
+# -----------------------------------------
+# Get limits
+# lb, rb: limits x
+# lt, rt: limits z
+# mp: limit z in med point
+# lo: Z low limit
+# my: max y
+# top: top vertex
+# -----------------------------------------
+def get_limits(myobject):
+ verts = myobject.data.vertices
+
+ lb = 0
+ lt = 0
+ rb = 0
+ rt = 0
+ mp = 0
+ lo = 0
+ my = 0
+ top = 0
+ for v in verts:
+ if v.co[2] > top:
+ top = v.co[2]
+
+ if v.co[2] < lo:
+ lo = v.co[2]
+
+ if v.co[1] > my:
+ my = v.co[1]
+ if v.co[0] > rb:
+ rb = v.co[0]
+ if v.co[0] < lb:
+ lb = v.co[0]
+ if v.co[0] == 0:
+ if v.co[2] > mp:
+ mp = v.co[2]
+ # max sides
+ for v in verts:
+ if v.co[2] > lt and v.co[0] == lb:
+ lt = v.co[2]
+ if v.co[2] > rt and v.co[0] == rb:
+ rt = v.co[2]
+
+ return lb, lt, rb, rt, mp, lo, my, top
+
+
+# ------------------------------------------
+# Create control box for panels
+#
+# ------------------------------------------
+def create_ctrl_box(parentobj, objname):
+ myvertex = []
+ myfaces = []
+
+ o = parentobj
+ op = o.WindowPanelGenerator[0]
+
+ lb, lt, rb, rt, mp, lo, my, top = get_limits(o)
+ ypos = my * 1.8
+ # -----------------------------
+ # Flat, Triangle and inclined
+ # -----------------------------
+ if op.UST == "1" or op.UST == "3" or op.UST == "4":
+ if mp == 0:
+ myvertex.extend([(lb, ypos, lo), (lb, ypos, lt), (rb, ypos, rt), (rb, ypos, lo)])
+ myvertex.extend([(lb, -ypos, lo), (lb, -ypos, lt), (rb, -ypos, rt), (rb, -ypos, lo)])
+ myfaces.extend([(0, 4, 5, 1), (3, 2, 6, 7), (0, 1, 2, 3), (4, 7, 6, 5), (1, 5, 6, 2), (0, 3, 7, 4)])
+ else:
+ myvertex.extend([(lb, ypos, lo), (lb, ypos, lt), (0, ypos, mp), (rb, ypos, rt), (rb, ypos, lo)])
+ myvertex.extend([(lb, -ypos, lo), (lb, -ypos, lt), (0, -ypos, mp), (rb, -ypos, rt), (rb, -ypos, lo)])
+ myfaces.extend([(0, 5, 6, 1), (4, 3, 8, 9), (0, 1, 2, 3, 4), (9, 8, 7, 6, 5), (1, 6, 7, 2), (2, 7, 8, 3),
+ (0, 4, 9, 5)])
+ # -----------------------------
+ # Arch
+ # -----------------------------
+ if op.UST == "2":
+ center, r, ang = get_circle_center(Cpoint(lb, lt), Cpoint(0, top), Cpoint(rb, rt))
+
+ # cx = center.x
+ cz = center.y
+
+ sg = op.res
+ arc = ((math.pi / 2) + ang) - ((math.pi / 2) - ang)
+ step = arc / sg
+ a = (math.pi / 2) + ang
+
+ myvertex.extend([(lb, ypos, lt), (lb, -ypos, lt)])
+ for x in range(0, sg):
+ myvertex.extend([(r * math.cos(a), ypos, r * math.sin(a) + cz),
+ (r * math.cos(a), -ypos, r * math.sin(a) + cz)])
+ a -= step
+
+ # close sides
+ myvertex.extend([(rb, ypos, rt), (rb, -ypos, rt)])
+
+ v = 0
+ nf = len(myvertex)
+ for x in range(0, nf - 2, 2):
+ myfaces.extend([(v, v + 1, v + 3, v + 2)])
+ v += 2
+
+ nf = len(myvertex)
+ myvertex.extend([(lb, ypos, lo), (lb, -ypos, lo)])
+ myvertex.extend([(rb, ypos, lo), (rb, -ypos, lo)])
+
+ nf2 = len(myvertex)
+ myfaces.extend([(0, nf2 - 4, nf2 - 3, 1)])
+ myfaces.extend([(nf - 2, nf - 1, nf2 - 1, nf2 - 2)])
+
+ nf2 = len(myvertex)
+ myfaces.extend([(nf2 - 4, nf2 - 2, nf2 - 1, nf2 - 3)])
+
+ # --------------------------
+ # Create mesh
+ # --------------------------
+ myfaces = check_mesh_errors(myvertex, myfaces)
+ mymesh = bpy.data.meshes.new(objname)
+ myobj = bpy.data.objects.new(objname, mymesh)
+
+ myobj.location = bpy.context.scene.cursor_location
+ bpy.context.scene.objects.link(myobj)
+
+ mymesh.from_pydata(myvertex, [], myfaces)
+ mymesh.update(calc_edges=True)
+
+ return myobj
+
+
+# ------------------------------------------------------------------
+# Define property group class to create or modify
+# ------------------------------------------------------------------
+class GeneralPanelProperties(bpy.types.PropertyGroup):
+ prs = bpy.props.EnumProperty(
+ items=(
+ ('1', "WINDOW 250X200", ""),
+ ('2', "WINDOW 200X200", ""),
+ ('3', "WINDOW 180X200", ""),
+ ('4', "WINDOW 180X160", ""),
+ ('5', "WINDOW 160X160", ""),
+ ('6', "WINDOW 50X50", ""),
+ ('7', "DOOR 80X250", ""),
+ ('8', "DOOR 80X230", ""),
+ ),
+ name="",
+ description='Predefined types',
+ update=update_using_default,
+ )
+ son = prs
+ gen = bpy.props.IntProperty(
+ name='H Count', min=1, max=8, default=3,
+ description='Horizontal Panes',
+ update=update_window,
+ )
+ yuk = bpy.props.IntProperty(
+ name='V Count', min=1, max=5, default=1,
+ description='Vertical Panes',
+ update=update_window,
+ )
+ kl1 = bpy.props.IntProperty(
+ name='Outer Frame', min=2, max=50, default=5,
+ description='Outside Frame Thickness',
+ update=update_window,
+ )
+ kl2 = bpy.props.IntProperty(
+ name='Risers', min=2, max=50, default=5,
+ description='Risers Width',
+ update=update_window,
+ )
+ fk = bpy.props.IntProperty(
+ name='Inner Frame', min=1, max=20, default=2,
+ description='Inside Frame Thickness',
+ update=update_window,
+ )
+
+ mr = bpy.props.BoolProperty(name='Sill', default=True, description='Window Sill', update=update_window)
+ mr1 = bpy.props.IntProperty(name='', min=1, max=20, default=4, description='Height', update=update_window)
+ mr2 = bpy.props.IntProperty(name='', min=0, max=20, default=4, description='First Depth', update=update_window)
+ mr3 = bpy.props.IntProperty(name='', min=1, max=50, default=20, description='Second Depth', update=update_window)
+ mr4 = bpy.props.IntProperty(name='', min=0, max=50, default=0, description='Extrusion for Jamb',
+ update=update_window)
+
+ mt1 = bpy.props.EnumProperty(
+ items=(
+ ('1', "PVC", ""),
+ ('2', "WOOD", ""),
+ ('3', "Plastic", ""),
+ ),
+ name="",
+ default='1',
+ description='Material to use',
+ update=update_window,
+ )
+ mt2 = bpy.props.EnumProperty(
+ items=(
+ ('1', "PVC", ""),
+ ('2', "WOOD", ""),
+ ('3', "Plastic", ""),
+ ),
+ name="",
+ default='3',
+ description='Material to use',
+ update=update_window,
+ )
+
+ r = bpy.props.FloatProperty(
+ name='Rotation',
+ min=0, max=360, default=0, precision=1,
+ description='Panel rotation',
+ update=update_window,
+ )
+
+ UST = bpy.props.EnumProperty(
+ items=(
+ ('1', "Flat", ""),
+ ('2', "Arch", ""),
+ ('3', "Inclined", ""),
+ ('4', "Triangle", ""),
+ ),
+ name="Top", default='1',
+ description='Type of window upper section',
+ update=update_window,
+ )
+ DT2 = bpy.props.EnumProperty(
+ items=(
+ ('1', "Difference", ""),
+ ('2', "Radius", ""),
+ ),
+ name="",
+ default='1',
+ update=update_window,
+ )
+ DT3 = bpy.props.EnumProperty(
+ items=(
+ ('1', "Difference", ""),
+ ('2', "Incline %", ""),
+ ('3', "Incline Angle", ""),
+ ),
+ name="",
+ default='1', update=update_window,
+ )
+
+ VL1 = bpy.props.IntProperty(name='', min=-10000, max=10000, default=30, update=update_window) # Fark
+ VL2 = bpy.props.IntProperty(name='', min=1, max=10000, default=30, update=update_window) # Cap
+ VL3 = bpy.props.IntProperty(name='', min=-100, max=100, default=30, update=update_window) # Egim %
+ VL4 = bpy.props.IntProperty(name='', min=-45, max=45, default=30, update=update_window) # Egim Aci
+
+ res = bpy.props.IntProperty(name='Resolution', min=2, max=360, default=36, update=update_window) # Res
+
+ gnx0 = bpy.props.IntProperty(name='', min=1, max=300, default=60, description='1st Window Width',
+ update=update_window)
+ gnx1 = bpy.props.IntProperty(name='', min=1, max=300, default=110, description='2nd Window Width',
+ update=update_window)
+ gnx2 = bpy.props.IntProperty(name='', min=1, max=300, default=60, description='3rd Window Width',
+ update=update_window)
+ gnx3 = bpy.props.IntProperty(name='', min=1, max=300, default=60, description='4th Window Width',
+ update=update_window)
+ gnx4 = bpy.props.IntProperty(name='', min=1, max=300, default=60, description='5th Window Width',
+ update=update_window)
+ gnx5 = bpy.props.IntProperty(name='', min=1, max=300, default=60, description='6th Window Width',
+ update=update_window)
+ gnx6 = bpy.props.IntProperty(name='', min=1, max=300, default=60, description='7th Window Width',
+ update=update_window)
+ gnx7 = bpy.props.IntProperty(name='', min=1, max=300, default=60, description='8th Window Width',
+ update=update_window)
+
+ gny0 = bpy.props.IntProperty(name='', min=1, max=300, default=190, description='1st Row Height',
+ update=update_window)
+ gny1 = bpy.props.IntProperty(name='', min=1, max=300, default=45, description='2nd Row Height',
+ update=update_window)
+ gny2 = bpy.props.IntProperty(name='', min=1, max=300, default=45, description='3rd Row Height',
+ update=update_window)
+ gny3 = bpy.props.IntProperty(name='', min=1, max=300, default=45, description='4th Row Height',
+ update=update_window)
+ gny4 = bpy.props.IntProperty(name='', min=1, max=300, default=45, description='5th Row Height',
+ update=update_window)
+
+ k00 = bpy.props.BoolProperty(name='', default=True, update=update_window)
+ k01 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+ k02 = bpy.props.BoolProperty(name='', default=True, update=update_window)
+ k03 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+ k04 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+ k05 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+ k06 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+ k07 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+
+ k10 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+ k11 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+ k12 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+ k13 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+ k14 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+ k15 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+ k16 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+ k17 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+
+ k20 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+ k21 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+ k22 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+ k23 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+ k24 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+ k25 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+ k26 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+ k27 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+
+ k30 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+ k31 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+ k32 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+ k33 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+ k34 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+ k35 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+ k36 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+ k37 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+
+ k40 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+ k41 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+ k42 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+ k43 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+ k44 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+ k45 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+ k46 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+ k47 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+ # opengl internal data
+ glpoint_a = bpy.props.FloatVectorProperty(
+ name="glpointa",
+ description="Hidden property for opengl",
+ default=(0, 0, 0),
+ )
+ glpoint_b = bpy.props.FloatVectorProperty(
+ name="glpointb",
+ description="Hidden property for opengl",
+ default=(0, 0, 0),
+ )
+ glpoint_c = bpy.props.FloatVectorProperty(
+ name="glpointc",
+ description="Hidden property for opengl",
+ default=(0, 0, 0),
+ )
+ glpoint_d = bpy.props.FloatVectorProperty(
+ name="glpointc",
+ description="Hidden property for opengl",
+ default=(0, 0, 0),
+ )
+
+
+bpy.utils.register_class(GeneralPanelProperties)
+bpy.types.Object.WindowPanelGenerator = bpy.props.CollectionProperty(type=GeneralPanelProperties)
+
+
+# ------------------------------------------------------------------
+# Define panel class to modify myobjects.
+# ------------------------------------------------------------------
+class AchmWindowEditPanel(bpy.types.Panel):
+ bl_idname = "window.edit_panel2"
+ bl_label = "Window Panel"
+ bl_space_type = 'VIEW_3D'
+ bl_region_type = 'UI'
+ bl_category = 'Window'
+
+ # -----------------------------------------------------
+ # Verify if visible
+ # -----------------------------------------------------
+ @classmethod
+ def poll(cls, context):
+ o = context.object
+ if o is None:
+ return False
+ if 'WindowPanelGenerator' not in o:
+ return False
+ else:
+ return True
+
+ # -----------------------------------------------------
+ # Draw (create UI interface)
+ # -----------------------------------------------------
+ def draw(self, context):
+ o = context.object
+ # If the selected object didn't be created with the group 'WindowPanelGenerator', this panel is not created.
+ # noinspection PyBroadException
+ try:
+ if 'WindowPanelGenerator' not in o:
+ return
+ except:
+ return
+
+ layout = self.layout
+ if bpy.context.mode == 'EDIT_MESH':
+ layout.label('Warning: Operator does not work in edit mode.', icon='ERROR')
+ else:
+ myobject = o.WindowPanelGenerator[0]
+ layout.prop(myobject, 'prs')
+ box = layout.box()
+ box.prop(myobject, 'gen')
+ box.prop(myobject, 'yuk')
+ box.prop(myobject, 'kl1')
+ box.prop(myobject, 'kl2')
+ box.prop(myobject, 'fk')
+ box.prop(myobject, 'r') # rotation
+
+ box.prop(myobject, 'mr')
+ if myobject.mr is True:
+ row = box.row()
+ row.prop(myobject, 'mr1')
+ row.prop(myobject, 'mr2')
+ row = box.row()
+ row.prop(myobject, 'mr3')
+ row.prop(myobject, 'mr4')
+ row = layout.row()
+ row.label('Frame')
+ row.label('Inner Frame')
+ row = layout.row()
+ row.prop(myobject, 'mt1')
+ row.prop(myobject, 'mt2')
+
+ box.prop(myobject, 'UST')
+ if myobject.UST == '2':
+ row = box.row()
+ row.prop(myobject, 'DT2')
+ if myobject.DT2 == '1':
+ row.prop(myobject, 'VL1')
+ elif myobject.DT2 == '2':
+ row.prop(myobject, 'VL2')
+ box.prop(myobject, 'res')
+ elif myobject.UST == '3':
+ row = box.row()
+ row.prop(myobject, 'DT3')
+ if myobject.DT3 == '1':
+ row.prop(myobject, 'VL1')
+ elif myobject.DT3 == '2':
+ row.prop(myobject, 'VL3')
+ elif myobject.DT3 == '3':
+ row.prop(myobject, 'VL4')
+ elif myobject.UST == '4':
+ row = box.row()
+ row.prop(myobject, 'DT3')
+ if myobject.DT3 == '1':
+ row.prop(myobject, 'VL1')
+ elif myobject.DT3 == '2':
+ row.prop(myobject, 'VL3')
+ elif myobject.DT3 == '3':
+ row.prop(myobject, 'VL4')
+ row = layout.row()
+ for i in range(0, myobject.gen):
+ row.prop(myobject, 'gnx' + str(i))
+ for j in range(0, myobject.yuk):
+ row = layout.row()
+ row.prop(myobject, 'gny' + str(myobject.yuk - j - 1))
+ for i in range(0, myobject.gen):
+ row.prop(myobject, 'k' + str(myobject.yuk - j - 1) + str(i))
diff --git a/archimesh/images/fabric_diffuse.png b/archimesh/images/fabric_diffuse.png
new file mode 100644
index 00000000..f5366602
--- /dev/null
+++ b/archimesh/images/fabric_diffuse.png
Binary files differ