def add_common_door_prompts(assembly): if assembly.door_type == 'BASE': door_type = 0 if assembly.door_type == 'TALL': door_type = 1 if assembly.door_type == 'UPPER': door_type = 2 assembly.add_prompt(name="Door Thickness", prompt_type='DISTANCE', value=unit.inch(.75), tab_index=1) assembly.add_prompt(name="Pull Location", prompt_type='COMBOBOX', items=['BASE', 'TALL', 'UPPER'], value=door_type, tab_index=1, columns=3) assembly.add_prompt(name="Pull From Edge", prompt_type='DISTANCE', value=unit.inch(1.5), tab_index=0) assembly.add_prompt(name="Pull From Top", prompt_type='DISTANCE', value=unit.inch(1.5), tab_index=0) assembly.add_prompt(name="Pull From Bottom", prompt_type='DISTANCE', value=unit.inch(1.5), tab_index=0) assembly.add_prompt(name="Pull From Floor", prompt_type='DISTANCE', value=unit.inch(40), tab_index=0)
def draw(self): self.create_assembly() ass_obj = self.add_object(file_path = self.appliance_path) ass_obj.set_name(get_file_name(self.appliance_path)) self.obj_x.empty_draw_size = unit.inch(1) self.obj_y.empty_draw_size = unit.inch(1) self.obj_z.empty_draw_size = unit.inch(1)
def position_wall(self,p): x = p[0] - self.starting_point[0] y = p[1] - self.starting_point[1] if math.fabs(x) > math.fabs(y): if x > 0: self.wall.obj_bp.rotation_euler.z = math.radians(0) else: self.wall.obj_bp.rotation_euler.z = math.radians(180) if self.typed_value == "": self.wall.obj_x.location.x = math.fabs(x) else: value = eval(self.typed_value) if bpy.context.scene.unit_settings.system == 'METRIC': self.wall.obj_x.location.x = unit.millimeter(float(value)) else: self.wall.obj_x.location.x = unit.inch(float(value)) if math.fabs(y) > math.fabs(x): if y > 0: self.wall.obj_bp.rotation_euler.z = math.radians(90) else: self.wall.obj_bp.rotation_euler.z = math.radians(-90) if self.typed_value == "": self.wall.obj_x.location.x = math.fabs(y) else: value = eval(self.typed_value) if bpy.context.scene.unit_settings.system == 'METRIC': self.wall.obj_x.location.x = unit.millimeter(float(value)) else: self.wall.obj_x.location.x = unit.inch(float(value))
def __init__(self): self.category_name = "Appliances" self.assembly_name = "Refrigerator" self.width = unit.inch(36) self.height = unit.inch(84) self.depth = unit.inch(27) self.appliance_path = os.path.join(WALL_APPLIANCE_PATH,"Professional Refrigerator Generic.blend")
def __init__(self): self.category_name = "Appliances" self.assembly_name = "Range" self.width = unit.inch(30) self.height = unit.inch(42) self.depth = unit.inch(28) self.appliance_path = os.path.join(WALL_APPLIANCE_PATH,"Professional Gas Range Generic.blend")
def add_corner_carcass_with_base_assembly(product,cabinet_type="Base",pie_cut=True): product.add_prompt(name="Left Cabinet Depth",prompt_type='DISTANCE',value=unit.inch(24),tab_index=0) product.add_prompt(name="Right Cabinet Depth",prompt_type='DISTANCE',value=unit.inch(24),tab_index=0) product.add_prompt(name="Base Inset Rear Left",prompt_type='CHECKBOX',value= False,tab_index=0) product.add_prompt(name="Base Inset Rear Right",prompt_type='CHECKBOX',value= False,tab_index=0) Product_Width = product.get_var('dim_x','Product_Width') Product_Height = product.get_var('dim_z','Product_Height') Product_Depth = product.get_var('dim_y','Product_Depth') Toe_Kick_Height = product.get_var('Toe Kick Height') Toe_Kick_Setback = product.get_var('Toe Kick Setback') Base_Inset_Front = product.get_var('Base Inset Front') Base_Inset_Left = product.get_var('Base Inset Left') Base_Inset_Right = product.get_var('Base Inset Right') Left_Cabinet_Depth = product.get_var('Left Cabinet Depth') Right_Cabinet_Depth = product.get_var('Right Cabinet Depth') Base_Inset_Rear_Left = product.get_var('Base Inset Rear Left') Base_Inset_Rear_Right = product.get_var('Base Inset Rear Right') carcass = product.add_assembly(PIE_CUT_CORNER_CARCASS if pie_cut else DIAGONAL_CORNER_CARCASS) carcass.x_loc(value = 0) carcass.y_loc(value = 0) if cabinet_type == "Base": carcass.z_loc('Toe_Kick_Height',[Toe_Kick_Height]) if cabinet_type == "Upper": carcass.z_loc('Product_Height',[Product_Height]) carcass.x_rot(value = 0) carcass.y_rot(value = 0) carcass.z_rot(value = 0) carcass.x_dim('Product_Width',[Product_Width]) carcass.y_dim('Product_Depth',[Product_Depth]) if cabinet_type == "Base": carcass.z_dim('Product_Height-Toe_Kick_Height',[Product_Height,Toe_Kick_Height]) if cabinet_type == "Upper": carcass.z_dim('fabs(Product_Height)',[Product_Height]) carcass.set_material_pointers(EXPOSED_EXTERIOR_SURFACE,EXTERIOR) carcass.set_material_pointers(EXPOSED_INTERIOR_SURFACE,INTERIOR) carcass.set_material_pointers(EXPOSED_EXTERIOR_SURFACE,LEFT_EXTERIOR) carcass.set_material_pointers(EXPOSED_EXTERIOR_SURFACE,RIGHT_EXTERIOR) carcass.set_material_pointers(EXPOSED_EXTERIOR_EDGE,EDGES) carcass.prompt('Left Depth','Left_Cabinet_Depth',[Left_Cabinet_Depth]) carcass.prompt('Right Depth','Right_Cabinet_Depth',[Right_Cabinet_Depth]) if cabinet_type == "Base": base_assembly = product.add_assembly(PIE_CUT_BASE_ASSEMBLY if pie_cut else DIAGONAL_BASE_ASSEMBLY) base_assembly.x_loc('IF(Base_Inset_Rear_Left,Toe_Kick_Setback,0)',[Base_Inset_Rear_Left,Toe_Kick_Setback]) base_assembly.y_loc('IF(Base_Inset_Rear_Right,-Toe_Kick_Setback,0)',[Base_Inset_Rear_Right,Toe_Kick_Setback]) base_assembly.z_loc(value = 0) base_assembly.x_rot(value = 0) base_assembly.y_rot(value = 0) base_assembly.z_rot(value = 0) base_assembly.x_dim('Product_Width-IF(Base_Inset_Rear_Left,Toe_Kick_Setback,0)-IF(Base_Inset_Right,Toe_Kick_Setback,0)',[Product_Width,Base_Inset_Rear_Left,Base_Inset_Right,Toe_Kick_Setback]) base_assembly.y_dim('Product_Depth+IF(Base_Inset_Rear_Right,Toe_Kick_Setback,0)+IF(Base_Inset_Left,Toe_Kick_Setback,0)',[Product_Depth,Base_Inset_Rear_Right,Base_Inset_Left,Toe_Kick_Setback]) base_assembly.z_dim('Toe_Kick_Height',[Toe_Kick_Height]) base_assembly.material("Exposed_Exterior_Surface") base_assembly.set_material_pointers(EXPOSED_EXTERIOR_SURFACE,EXTERIOR) base_assembly.set_material_pointers(EXPOSED_EXTERIOR_SURFACE,LEFT_EXTERIOR) base_assembly.set_material_pointers(EXPOSED_EXTERIOR_SURFACE,RIGHT_EXTERIOR) base_assembly.prompt('Left Depth','Left_Cabinet_Depth-IF(Base_Inset_Front,Toe_Kick_Setback,0)-IF(Base_Inset_Rear_Left,Toe_Kick_Setback,0)',[Left_Cabinet_Depth,Base_Inset_Front,Base_Inset_Rear_Left,Toe_Kick_Setback]) base_assembly.prompt('Right Depth','Right_Cabinet_Depth-IF(Base_Inset_Front,Toe_Kick_Setback,0)-IF(Base_Inset_Rear_Right,Toe_Kick_Setback,0)',[Right_Cabinet_Depth,Base_Inset_Front,Base_Inset_Rear_Right,Toe_Kick_Setback])
def draw_product_size(self, layout): row = layout.row() box = row.box() col = box.column(align=True) row1 = col.row(align=True) if self.object_has_driver(self.product.obj_x): row1.label( 'Width: ' + str(unit.inch(math.fabs(self.product.obj_x.location.x)))) else: row1.label('Width:') row1.prop(self, 'width', text="") row1.prop(self.product.obj_x, 'hide', text="") row1 = col.row(align=True) if self.object_has_driver(self.product.obj_z): row1.label( 'Height: ' + str(unit.inch(math.fabs(self.product.obj_z.location.z)))) else: row1.label('Height:') row1.prop(self, 'height', text="") row1.prop(self.product.obj_z, 'hide', text="") row1 = col.row(align=True) if self.object_has_driver(self.product.obj_y): row1.label( 'Depth: ' + str(unit.inch(math.fabs(self.product.obj_y.location.y)))) else: row1.label('Depth:') row1.prop(self, 'depth', text="") row1.prop(self.product.obj_y, 'hide', text="")
def draw_product_size(self,layout): row = layout.row() box = row.box() col = box.column(align=True) row1 = col.row(align=True) if self.object_has_driver(self.product.obj_x): row1.label('Width: ' + str(unit.inch(math.fabs(self.product.obj_x.location.x)))) else: row1.label('Width:') row1.prop(self,'width',text="") row1.prop(self.product.obj_x,'hide',text="") row1 = col.row(align=True) if self.object_has_driver(self.product.obj_z): row1.label('Height: ' + str(unit.inch(math.fabs(self.product.obj_z.location.z)))) else: row1.label('Height:') row1.prop(self,'height',text="") row1.prop(self.product.obj_z,'hide',text="") row1 = col.row(align=True) if self.object_has_driver(self.product.obj_y): row1.label('Depth: ' + str(unit.inch(math.fabs(self.product.obj_y.location.y)))) else: row1.label('Depth:') row1.prop(self,'depth',text="") row1.prop(self.product.obj_y,'hide',text="")
class OPS_add_assembly(Operator): bl_idname = "fd_assembly.add_assembly" bl_label = "Empty Assembly" bl_description = "This operator adds a new empty assembly to the scene." bl_options = {'UNDO'} assembly_size = FloatVectorProperty(name="Group Size", default=(unit.inch(24), unit.inch(24), unit.inch(24))) @classmethod def poll(cls, context): return True def execute(self, context): group = fd_types.Assembly() group.create_assembly() group.obj_x.location.x = self.assembly_size[0] group.obj_y.location.y = self.assembly_size[1] group.obj_z.location.z = self.assembly_size[2] group.build_cage() bpy.ops.object.select_all(action='DESELECT') group.obj_bp.select = True context.scene.objects.active = group.obj_bp return {'FINISHED'}
def sink_drop(self, context, event): selected_point, selected_obj = utils.get_selection_point( context, event) bpy.ops.object.select_all(action='DESELECT') sel_product_bp = utils.get_bp(selected_obj, 'PRODUCT') sel_assembly_bp = utils.get_assembly_bp(selected_obj) if sel_product_bp and sel_assembly_bp: product = fd_types.Assembly(sel_product_bp) if product: product_depth = math.fabs(product.obj_y.location.y) assembly_depth = math.fabs(self.assembly.obj_y.location.y) self.assembly.obj_bp.parent = product.obj_bp if product.obj_z.location.z < 0: self.assembly.obj_bp.location.z = unit.inch( 1.5) #SUSPENDED CABINETS else: self.assembly.obj_bp.location.z = product.obj_z.location.z + unit.inch( 1.5) #BASE CABINETS self.assembly.obj_bp.location.y = -math.fabs( product_depth - assembly_depth) / 2 self.assembly.obj_bp.location.x = product.obj_x.location.x / 2 - self.assembly.obj_x.location.x / 2 if event.type == 'LEFTMOUSE' and event.value == 'PRESS': self.assign_boolean(selected_obj) utils.set_wireframe(self.assembly.obj_bp, False) bpy.context.window.cursor_set('DEFAULT') bpy.ops.object.select_all(action='DESELECT') context.scene.objects.active = self.assembly.obj_bp self.assembly.obj_bp.select = True return {'FINISHED'} return {'RUNNING_MODAL'}
def execute(self, context): largest_x = 0 largest_y = 0 smallest_x = 0 smallest_y = 0 wall_groups = [] height = 0 for obj in context.visible_objects: if obj.mv.type == 'BPWALL': wall_groups.append(fd_types.Wall(obj)) for group in wall_groups: start_point = (group.obj_bp.matrix_world[0][3], group.obj_bp.matrix_world[1][3], 0) end_point = (group.obj_x.matrix_world[0][3], group.obj_x.matrix_world[1][3], 0) height = group.obj_z.location.z if start_point[0] > largest_x: largest_x = start_point[0] if start_point[1] > largest_y: largest_y = start_point[1] if start_point[0] < smallest_x: smallest_x = start_point[0] if start_point[1] < smallest_y: smallest_y = start_point[1] if end_point[0] > largest_x: largest_x = end_point[0] if end_point[1] > largest_y: largest_y = end_point[1] if end_point[0] < smallest_x: smallest_x = end_point[0] if end_point[1] < smallest_y: smallest_y = end_point[1] x = (math.fabs(largest_x) - math.fabs(smallest_x)) / 2 y = (math.fabs(largest_y) - math.fabs(smallest_y)) / 2 z = height - unit.inch(.01) width = math.fabs(smallest_y) + math.fabs(largest_y) length = math.fabs(largest_x) + math.fabs(smallest_x) if width == 0: width = unit.inch(-48) if length == 0: length = unit.inch(-48) bpy.ops.object.lamp_add(type='AREA') obj_lamp = context.active_object obj_lamp.location.x = x obj_lamp.location.y = y obj_lamp.location.z = z obj_lamp.data.shape = 'RECTANGLE' obj_lamp.data.size = length + unit.inch(20) obj_lamp.data.size_y = width + unit.inch(20) for node in obj_lamp.data.node_tree.nodes: if node.type == 'EMISSION': node.inputs[1].default_value = max( unit.meter_to_active_unit(largest_x), unit.meter_to_active_unit(largest_y)) return {'FINISHED'}
def draw(self): self.create_assembly() assembly = self.add_assembly(file_path=self.appliance_path) assembly.set_name(get_file_name(self.appliance_path)) self.width = assembly.obj_x.location.x self.height = assembly.obj_z.location.z self.depth = -assembly.obj_y.location.y assembly.assign_material("Chrome", MATERIAL_FILE, "Chrome") assembly.assign_material("Stainless Steel", MATERIAL_FILE, "Stainless Steel") assembly.assign_material("Black Anodized Metal", MATERIAL_FILE, "Black Anodized Metal") dim_x = self.get_var("dim_x") dim_z = self.get_var("dim_z") dim_y = self.get_var("dim_y") if self.add_countertop: self.add_tab(name="Counter Top Options", tab_type='VISIBLE') self.add_prompt(name="Countertop Overhang Front", prompt_type='DISTANCE', value=unit.inch(1), tab_index=0) self.add_prompt(name="Countertop Overhang Back", prompt_type='DISTANCE', value=unit.inch(0), tab_index=0) self.add_prompt(name="Countertop Overhang Left", prompt_type='DISTANCE', value=unit.inch(0), tab_index=0) self.add_prompt(name="Countertop Overhang Right", prompt_type='DISTANCE', value=unit.inch(0), tab_index=0) Countertop_Overhang_Front = self.get_var( 'Countertop Overhang Front') Countertop_Overhang_Left = self.get_var('Countertop Overhang Left') Countertop_Overhang_Right = self.get_var( 'Countertop Overhang Right') Countertop_Overhang_Back = self.get_var('Countertop Overhang Back') ctop = cabinet_countertops.PRODUCT_Straight_Countertop() ctop.draw() ctop.obj_bp.mv.type_group = 'INSERT' ctop.obj_bp.parent = self.obj_bp ctop.x_loc('-Countertop_Overhang_Left', [Countertop_Overhang_Left]) ctop.y_loc('Countertop_Overhang_Back', [Countertop_Overhang_Back]) ctop.z_loc('dim_z', [dim_z]) ctop.x_rot(value=0) ctop.y_rot(value=0) ctop.z_rot(value=0) ctop.x_dim( 'dim_x+Countertop_Overhang_Left+Countertop_Overhang_Right', [dim_x, Countertop_Overhang_Left, Countertop_Overhang_Right]) ctop.y_dim( 'dim_y-Countertop_Overhang_Front-Countertop_Overhang_Back', [dim_y, Countertop_Overhang_Front, Countertop_Overhang_Back]) ctop.z_dim(value=unit.inch(4))
def __init__(self): self.library_name = "Countertops" self.category_name = "Countertops" self.assembly_name = "Straight Countertop" self.width = unit.inch(30) self.height = unit.inch(5.5) self.depth = unit.inch(24) self.height_above_floor = unit.inch(34.1)
def __init__(self): self.category_name = "Appliances" self.assembly_name = "Dishwasher" self.width = unit.inch(24) self.height = unit.inch(34) self.depth = unit.inch(23) self.appliance_path = os.path.join(WALL_APPLIANCE_PATH,"Professional Dishwasher Generic.blend") self.add_countertop = True
def __init__(self): self.category_name = "Appliances" self.assembly_name = "Range Hood" self.width = unit.inch(30) self.height = unit.inch(14) self.depth = unit.inch(12.5) self.appliance_path = os.path.join(WALL_APPLIANCE_PATH,"Wall Mounted Range Hood 01.blend") self.height_above_floor = unit.inch(60)
def __init__(self): self.category_name = "Standard" self.assembly_name = "Rollouts" self.carcass_type = "Base" self.width = unit.inch(18) self.height = unit.inch(34) self.depth = unit.inch(23) self.rollout_qty = 2
def __init__(self): self.category_name = "Standard" self.assembly_name = "Divisions" self.carcass_type = "Base" self.width = unit.inch(18) self.height = unit.inch(34) self.depth = unit.inch(23) self.shelf_qty = 1
def execute(self, context): largest_x = 0 largest_y = 0 smallest_x = 0 smallest_y = 0 wall_groups = [] height = 0 for obj in context.visible_objects: if obj.mv.type == 'BPWALL': wall_groups.append(fd_types.Wall(obj)) for group in wall_groups: start_point = (group.obj_bp.matrix_world[0][3],group.obj_bp.matrix_world[1][3],0) end_point = (group.obj_x.matrix_world[0][3],group.obj_x.matrix_world[1][3],0) height = group.obj_z.location.z if start_point[0] > largest_x: largest_x = start_point[0] if start_point[1] > largest_y: largest_y = start_point[1] if start_point[0] < smallest_x: smallest_x = start_point[0] if start_point[1] < smallest_y: smallest_y = start_point[1] if end_point[0] > largest_x: largest_x = end_point[0] if end_point[1] > largest_y: largest_y = end_point[1] if end_point[0] < smallest_x: smallest_x = end_point[0] if end_point[1] < smallest_y: smallest_y = end_point[1] x = (math.fabs(largest_x) - math.fabs(smallest_x))/2 y = (math.fabs(largest_y) - math.fabs(smallest_y))/2 z = height - unit.inch(.01) width = math.fabs(smallest_y) + math.fabs(largest_y) length = math.fabs(largest_x) + math.fabs(smallest_x) if width == 0: width = unit.inch(-48) if length == 0: length = unit.inch(-48) bpy.ops.object.lamp_add(type = 'AREA') obj_lamp = context.active_object obj_lamp.location.x = x obj_lamp.location.y = y obj_lamp.location.z = z obj_lamp.data.shape = 'RECTANGLE' obj_lamp.data.size = length + unit.inch(20) obj_lamp.data.size_y = math.fabs(width) + unit.inch(20) for node in obj_lamp.data.node_tree.nodes: if node.type == 'EMISSION': node.inputs[1].default_value = max(unit.meter_to_active_unit(largest_x), unit.meter_to_active_unit(largest_y)) return {'FINISHED'}
def __init__(self): self.library_name = "Countertops" self.category_name = "Countertops" self.assembly_name = "Diagonal Corner Countertop" self.placement_type = "Corner" self.corner_type = "Diagonal" self.width = unit.inch(36) self.height = unit.inch(5.5) self.depth = unit.inch(36) self.height_above_floor = unit.inch(34.1)
def add_text(self, context, assembly): bpy.ops.object.text_add() text = context.active_object text.parent = assembly.obj_bp text.location.x = unit.inch(-2) text.location.z = unit.inch(-10) text.rotation_euler.x = math.radians(90) text.data.size = .1 text.data.body = assembly.obj_bp.mv.name_object text.data.align_x = 'RIGHT' text.data.font = self.font
def __init__(self): self.category_name = "Windows" self.assembly_name = "Triple Window Georgian" self.width = unit.inch(64) self.height = unit.inch(48) self.depth = DEFAULT_DEPTH self.height_above_floor = HEIGHT_ABOVE_FLOOR self.window_frame = "Window_Frame_Triple.blend" self.window_divider = "Window_Divider_Georgian.blend" self.window_blinds = ""
def add_blind_panel(product, side="Left", cabinet_type="Base"): product.add_prompt(name="Blind Panel Width", prompt_type='DISTANCE', value=unit.inch(23), tab_index=1) product.add_prompt(name="Blind Panel Reveal", prompt_type='DISTANCE', value=unit.inch(3), tab_index=1) product.add_prompt(name="Blind Panel Thickness", prompt_type='DISTANCE', value=unit.inch(.75), tab_index=2) Product_Width = product.get_var('dim_x', 'Product_Width') Product_Height = product.get_var('dim_z', 'Product_Height') Product_Depth = product.get_var('dim_y', 'Product_Depth') Toe_Kick_Height = product.get_var('Toe Kick Height') Material_Thickness = product.get_var('Material_Thickness') Blind_Panel_Width = product.get_var('Blind Panel Width') Blind_Panel_Reveal = product.get_var('Blind Panel Reveal') blind_panel = product.add_assembly(PART_WITH_EDGEBANDING) blind_panel.set_name("Right Filler") if side == "Left": blind_panel.x_loc('Material_Thickness', [Material_Thickness]) else: blind_panel.x_loc( 'Product_Width-Material_Thickness-Blind_Panel_Width-Blind_Panel_Reveal', [ Product_Width, Material_Thickness, Blind_Panel_Width, Blind_Panel_Reveal ]) blind_panel.y_loc('Product_Depth', [Product_Depth]) if cabinet_type == "Base": blind_panel.z_loc('Toe_Kick_Height+Material_Thickness', [Toe_Kick_Height, Material_Thickness]) if cabinet_type == "Upper": blind_panel.z_loc('Product_Height+Material_Thickness', [Product_Height, Material_Thickness]) blind_panel.x_rot(value=0) blind_panel.y_rot(value=-90) blind_panel.z_rot(value=-90) if cabinet_type == "Base": blind_panel.x_dim( 'Product_Height-Toe_Kick_Height-Material_Thickness*2', [Product_Height, Toe_Kick_Height, Material_Thickness]) if cabinet_type == "Upper": blind_panel.x_dim('fabs(Product_Height)-Material_Thickness*2', [Product_Height, Material_Thickness]) blind_panel.y_dim('Blind_Panel_Width+Blind_Panel_Reveal', [Blind_Panel_Width, Blind_Panel_Reveal]) blind_panel.z_dim(value=unit.inch(.75)) blind_panel.set_material_pointers(EXPOSED_EXTERIOR_SURFACE)
def draw(self): self.create_assembly() self.obj_bp.mv.dont_export = True self.add_tab(name='Main Options', tab_type='VISIBLE') self.add_tab(name='Formulas', tab_type='HIDDEN') self.add_prompt(name="Open Door", prompt_type='PERCENTAGE', value=0, tab_index=0) self.add_prompt(name="Frame Width", prompt_type='DISTANCE', value=unit.inch(3.25), tab_index=1) self.add_prompt(name="Panel Depth",prompt_type='DISTANCE',value=unit.inch(1.75), tab_index=1) Width = self.get_var('dim_x','Width') Height = self.get_var('dim_z','Height') Depth = self.get_var('dim_y','Depth') Open_Door = self.get_var('Open Door') Frame_Width = self.get_var('Frame Width') Panel_Depth = self.get_var('Panel Depth') door_frame = self.add_assembly(os.path.join(DOOR_FRAME_PATH,self.door_frame)) door_frame.set_name("Door Frame") door_frame.x_dim('Width', [Width]) door_frame.y_dim('Depth', [Depth]) door_frame.z_dim('Height', [Height]) door_frame.assign_material("Frame", MATERIAL_FILE, "White") door_panel = self.add_assembly(os.path.join(DOOR_PANEL,self.door_panel)) door_panel.set_name("Door Panel") door_panel.y_loc('Depth*0.5+Panel_Depth*0.5', [Depth, Panel_Depth]) door_panel.z_dim('Height-INCH(3.25)', [Height]) door_panel.prompt('No Hardware', value=True) if not self.double_door: door_panel.x_loc('Frame_Width-Open_Door*(Width-Frame_Width*2)', [Width, Frame_Width, Open_Door]) door_panel.x_dim('(Width-Frame_Width*2)', [Width, Frame_Width]) else: door_panel.x_loc('Frame_Width-Open_Door*((Width-Frame_Width*2)*0.5)', [Width, Frame_Width, Open_Door]) door_panel.x_dim('(Width-Frame_Width*2)*0.5', [Width, Frame_Width]) door_panel.assign_material("Door", MATERIAL_FILE, "White") door_panel.assign_material("Glass", MATERIAL_FILE, "Glass") if self.double_door: door_panel_right = self.add_assembly(os.path.join(DOOR_PANEL,self.door_panel)) door_panel_right.set_name("Door Panel Right") door_panel_right.x_loc('Width*0.5+(Open_Door*(Width*0.5-Frame_Width))', [Width, Frame_Width, Open_Door]) door_panel_right.y_loc('Depth*0.5+Panel_Depth*0.5', [Depth, Panel_Depth]) door_panel_right.x_dim('(Width-Frame_Width*2)*0.5',[Width, Frame_Width]) door_panel_right.z_dim('Height-INCH(3.25)', [Height]) door_panel_right.prompt('No Hardware', value=True) door_panel_right.assign_material("Door", MATERIAL_FILE, "White") door_panel_right.assign_material("Glass", MATERIAL_FILE, "Glass") self.update()
def add_corner_fillers(product): product.add_prompt(name="Left Side Wall Filler", prompt_type='DISTANCE', value=0, tab_index=0, export=True) product.add_prompt(name="Right Side Wall Filler", prompt_type='DISTANCE', value=0, tab_index=0, export=True) Product_Width = product.get_var('dim_x', 'Product_Width') Product_Height = product.get_var('dim_z', 'Product_Height') Product_Depth = product.get_var('dim_y', 'Product_Depth') Toe_Kick_Height = product.get_var('Toe Kick Height') Left_Side_Wall_Filler = product.get_var('Left Side Wall Filler') Right_Side_Wall_Filler = product.get_var('Right Side Wall Filler') Left_Cabinet_Depth = product.get_var('Left Cabinet Depth') Right_Cabinet_Depth = product.get_var('Right Cabinet Depth') left_filler = product.add_assembly(PART_WITH_EDGEBANDING) left_filler.set_name("Left Filler") left_filler.x_loc('Left_Cabinet_Depth', [Left_Cabinet_Depth]) left_filler.y_loc('Product_Depth-Left_Side_Wall_Filler', [Product_Depth, Left_Side_Wall_Filler]) left_filler.z_loc('Toe_Kick_Height', [Toe_Kick_Height]) left_filler.x_rot(value=0) left_filler.y_rot(value=-90) left_filler.z_rot(value=0) left_filler.x_dim('Product_Height-Toe_Kick_Height', [Product_Height, Toe_Kick_Height]) left_filler.y_dim('Left_Side_Wall_Filler', [Left_Side_Wall_Filler]) left_filler.z_dim(value=unit.inch(.75)) left_filler.set_material_pointers(EXPOSED_EXTERIOR_SURFACE) left_filler.prompt('Hide', 'IF(Left_Side_Wall_Filler==0,True,False)', [Left_Side_Wall_Filler]) right_filler = product.add_assembly(PART_WITH_EDGEBANDING) right_filler.set_name("Right Filler") right_filler.x_loc('Product_Width', [Product_Width]) right_filler.y_loc('-Right_Cabinet_Depth', [Right_Cabinet_Depth]) right_filler.z_loc('Toe_Kick_Height', [Toe_Kick_Height]) right_filler.x_rot(value=0) right_filler.y_rot(value=-90) right_filler.z_rot(value=-90) right_filler.x_dim('Product_Height-Toe_Kick_Height', [Product_Height, Toe_Kick_Height]) right_filler.y_dim('Right_Side_Wall_Filler', [Right_Side_Wall_Filler]) right_filler.z_dim(value=unit.inch(.75)) right_filler.set_material_pointers(EXPOSED_EXTERIOR_SURFACE) right_filler.prompt('Hide', 'IF(Right_Side_Wall_Filler==0,True,False)', [Right_Side_Wall_Filler])
def add_product_width_dimension(product): Product_Width = product.get_var('dim_x','Product_Width') vdim_x = fd_types.Dimension() vdim_x.parent(product.obj_bp) if product.mirror_z: vdim_x.start_z(value = unit.inch(5)) else: vdim_x.start_z(value = -unit.inch(5)) if product.carcass.carcass_type == 'Upper': vdim_x.start_y(value = unit.inch(8)) else: vdim_x.start_y(value = unit.inch(3)) vdim_x.end_x('Product_Width',[Product_Width])
def add_product_width_dimension(product): Product_Width = product.get_var('dim_x', 'Product_Width') vdim_x = fd_types.Dimension() vdim_x.parent(product.obj_bp) if product.mirror_z: vdim_x.start_z(value=unit.inch(5)) else: vdim_x.start_z(value=-unit.inch(5)) if product.carcass.carcass_type == 'Upper': vdim_x.start_y(value=unit.inch(8)) else: vdim_x.start_y(value=unit.inch(3)) vdim_x.end_x('Product_Width', [Product_Width])
def add_common_door_prompts(assembly): door_type = 0 #SET DEFAULT if assembly.door_type == 'BASE': door_type = 0 if assembly.door_type == 'TALL': door_type = 1 if assembly.door_type == 'UPPER': door_type = 2 assembly.add_prompt(name="Door Thickness",prompt_type='DISTANCE',value=unit.inch(.75),tab_index=1) assembly.add_prompt(name="Pull Location",prompt_type='COMBOBOX',items=['BASE','TALL','UPPER'],value=door_type,tab_index=1,columns=3) assembly.add_prompt(name="Pull From Edge",prompt_type='DISTANCE',value=unit.inch(1.5),tab_index=0) assembly.add_prompt(name="Pull From Top",prompt_type='DISTANCE',value=unit.inch(1.5),tab_index=0) assembly.add_prompt(name="Pull From Bottom",prompt_type='DISTANCE',value=unit.inch(1.5),tab_index=0) assembly.add_prompt(name="Pull From Floor",prompt_type='DISTANCE',value=unit.inch(40),tab_index=0)
def create_elv_view_scene(self, context, wall): bpy.ops.scene.new('INVOKE_DEFAULT', type='EMPTY') wall_group = bpy.data.groups.new(wall.obj_bp.mv.name_object) new_scene = context.scene new_scene.name = wall_group.name new_scene.mv.name_scene = wall.obj_bp.mv.name_object new_scene.mv.elevation_img_name = wall.obj_bp.name new_scene.mv.plan_view_scene = False new_scene.mv.elevation_scene = True self.group_children(wall_group, wall.obj_bp) wall_mesh = utils.create_cube_mesh( wall.obj_bp.mv.name_object, (wall.obj_x.location.x, wall.obj_y.location.y, wall.obj_z.location.z)) wall_mesh.parent = wall.obj_bp wall_group.objects.link(wall_mesh) instance = bpy.data.objects.new( wall.obj_bp.mv.name_object + " " + "Instance", None) new_scene.objects.link(instance) instance.dupli_type = 'GROUP' instance.dupli_group = wall_group new_scene.world = self.main_scene.world self.link_dims_to_scene(new_scene, wall.obj_bp) bpy.ops.object.text_add() text = context.active_object text.parent = wall.obj_bp text.location.x = unit.inch(-2) text.location.z = unit.inch(-10) text.rotation_euler.x = math.radians(90) text.data.size = .1 text.data.body = wall.obj_bp.mv.name_object text.data.align = 'RIGHT' text.data.font = self.font camera = self.create_camera(new_scene) camera.rotation_euler.x = math.radians(90.0) camera.rotation_euler.z = wall.obj_bp.rotation_euler.z bpy.ops.object.select_all(action='DESELECT') wall_mesh.select = True bpy.ops.view3d.camera_to_view_selected() camera.data.ortho_scale += self.pv_pad
def create_cabinet(product): product.create_assembly() product.obj_bp.lm_basic_cabinets.is_cabinet = True product.obj_bp.lm_basic_cabinets.cabinet_shape = 'RECTANGLE' product.add_tab(name='Carcass Options',tab_type='VISIBLE') product.add_tab(name='Formulas',tab_type='HIDDEN') product.add_prompt(name="Material_Thickness",prompt_type='DISTANCE',value= unit.inch(.75),lock=True,tab_index=1)
def sink_drop(self,context,event): selected_point, selected_obj = utils.get_selection_point(context,event) bpy.ops.object.select_all(action='DESELECT') sel_product_bp = utils.get_bp(selected_obj,'PRODUCT') sel_assembly_bp = utils.get_assembly_bp(selected_obj) if sel_product_bp and sel_assembly_bp: product = fd_types.Assembly(sel_product_bp) if product: product_depth = math.fabs(product.obj_y.location.y) assembly_depth = math.fabs(self.assembly.obj_y.location.y) self.assembly.obj_bp.parent = product.obj_bp self.assembly.obj_bp.location.z = product.obj_z.location.z + unit.inch(1.5) self.assembly.obj_bp.location.y = -math.fabs(product_depth-assembly_depth)/2 self.assembly.obj_bp.location.x = product.obj_x.location.x/2 - self.assembly.obj_x.location.x/2 if event.type == 'LEFTMOUSE' and event.value == 'PRESS': self.assign_boolean(selected_obj) utils.set_wireframe(self.assembly.obj_bp,False) bpy.context.window.cursor_set('DEFAULT') bpy.ops.object.select_all(action='DESELECT') context.scene.objects.active = self.assembly.obj_bp self.assembly.obj_bp.select = True return {'FINISHED'} return {'RUNNING_MODAL'}
def execute(self, context): obj_bp = utils.get_assembly_bp(context.active_object) #NOTE: Since Mesh hooks are maintained by object name # You cannot have two emptyhooks with the same name. for child in obj_bp.children: if child.type == 'EMPTY' and self.use_as_mesh_hook and child.mv.use_as_mesh_hook and child.mv.name_object == self.empty_name: bpy.ops.fd_general.error('INVOKE_DEFAULT',Message="A hook with that name already exists.") return {'CANCELLED'} #NOTE: Since Mesh hooks are maintained by object name # These names are reserved the the visible prompts of the group if self.use_as_mesh_hook: if self.empty_name in {'Dimension X','Dimension Y','Dimension Z'}: bpy.ops.fd_general.error('INVOKE_DEFAULT',Message="That hook name are reserved for visible prompts") return {'CANCELLED'} bpy.ops.object.empty_add() obj_empty = context.active_object if obj_empty: obj_empty.empty_draw_size = unit.inch(1) obj_empty.mv.name_object = self.empty_name obj_empty.mv.use_as_mesh_hook = self.use_as_mesh_hook if obj_bp: obj_empty.parent = obj_bp context.scene.objects.active = obj_empty update_vector_groups(obj_bp) bpy.ops.fd_assembly.load_active_assembly_objects(object_name=obj_bp.name) return {'FINISHED'}
def add_adj_shelf_machining(part,insert): Width = insert.get_var('dim_x','Width') Height = insert.get_var('dim_z','Height') Depth = insert.get_var('dim_y','Depth') Part_Width = part.get_var('dim_y','Part_Width') Part_Z_Loc = part.get_var('loc_z','Part_Z_Loc') Adj_Shelf_Setback = insert.get_var("Adj Shelf Setback") Space_From_Front = insert.get_var("Space From Front") Space_From_Rear = insert.get_var("Space From Rear") Space_From_Top = insert.get_var("Space From Top") Space_From_Bottom = insert.get_var("Space From Bottom") Shelf_Hole_Spacing = insert.get_var("Shelf Hole Spacing") Shelf_Clip_Gap = insert.get_var("Shelf Clip Gap") Adj_Shelf_Qty = insert.get_var("Adj Shelf Qty") tokens = [] tokens.append(part.add_machine_token('Left Shelf Drilling' ,'SHELF','3')) tokens.append(part.add_machine_token('Right Shelf Drilling' ,'SHELF','4')) for token in tokens: token[1].add_driver(token[0],'space_from_bottom','Part_Z_Loc-Space_From_Bottom',[Part_Z_Loc,Space_From_Bottom]) token[1].add_driver(token[0],'dim_to_first_row','Space_From_Front',[Space_From_Front]) token[1].face_bore_depth = unit.inch(.5) token[1].add_driver(token[0],'space_from_top','Height-Part_Z_Loc-Space_From_Top',[Height,Part_Z_Loc,Space_From_Top]) token[1].add_driver(token[0],'dim_to_second_row','fabs(Part_Width)-Space_From_Rear',[Part_Width,Space_From_Rear]) token[1].face_bore_dia = 5 token[1].shelf_hole_spacing = unit.millimeter(32) token[1].add_driver(token[0],'shelf_clip_gap','Shelf_Clip_Gap',[Shelf_Clip_Gap]) token[1].reverse_direction = False
def execute(self, context): largest_x = 0 largest_y = 0 smallest_x = 0 smallest_y = 0 wall_groups = [] for obj in context.visible_objects: if obj.mv.type == 'BPWALL': wall_groups.append(fd_types.Wall(obj)) for group in wall_groups: start_point = (group.obj_bp.matrix_world[0][3], group.obj_bp.matrix_world[1][3], 0) end_point = (group.obj_x.matrix_world[0][3], group.obj_x.matrix_world[1][3], 0) if start_point[0] > largest_x: largest_x = start_point[0] if start_point[1] > largest_y: largest_y = start_point[1] if start_point[0] < smallest_x: smallest_x = start_point[0] if start_point[1] < smallest_y: smallest_y = start_point[1] if end_point[0] > largest_x: largest_x = end_point[0] if end_point[1] > largest_y: largest_y = end_point[1] if end_point[0] < smallest_x: smallest_x = end_point[0] if end_point[1] < smallest_y: smallest_y = end_point[1] loc = (smallest_x, smallest_y, 0) width = math.fabs(smallest_y) + math.fabs(largest_y) length = math.fabs(largest_x) + math.fabs(smallest_x) if width == 0: width = unit.inch(-48) if length == 0: length = unit.inch(-48) obj_plane = utils.create_floor_mesh('Floor', (length, width, 0.0)) obj_plane.location = loc #SET CONTEXT context.scene.objects.active = obj_plane return {'FINISHED'}
def execute(self, context): bpy.ops.object.camera_add(view_align=False) camera = context.active_object bpy.ops.view3d.camera_to_view() camera.data.clip_start = unit.inch(1) camera.data.clip_end = 9999 camera.data.ortho_scale = 200.0 return {'FINISHED'}
def execute(self, context): largest_x = 0 largest_y = 0 smallest_x = 0 smallest_y = 0 wall_groups = [] for obj in context.visible_objects: if obj.mv.type == 'BPWALL': wall_groups.append(fd_types.Wall(obj)) for group in wall_groups: start_point = (group.obj_bp.matrix_world[0][3],group.obj_bp.matrix_world[1][3],0) end_point = (group.obj_x.matrix_world[0][3],group.obj_x.matrix_world[1][3],0) if start_point[0] > largest_x: largest_x = start_point[0] if start_point[1] > largest_y: largest_y = start_point[1] if start_point[0] < smallest_x: smallest_x = start_point[0] if start_point[1] < smallest_y: smallest_y = start_point[1] if end_point[0] > largest_x: largest_x = end_point[0] if end_point[1] > largest_y: largest_y = end_point[1] if end_point[0] < smallest_x: smallest_x = end_point[0] if end_point[1] < smallest_y: smallest_y = end_point[1] loc = (smallest_x , smallest_y,0) width = math.fabs(smallest_y) + math.fabs(largest_y) length = math.fabs(largest_x) + math.fabs(smallest_x) if width == 0: width = unit.inch(-48) if length == 0: length = unit.inch(-48) obj_plane = utils.create_floor_mesh('Floor',(length,width,0.0)) obj_plane.location = loc #SET CONTEXT context.scene.objects.active = obj_plane return {'FINISHED'}
def add_common_prompts(self): self.add_tab(name='Interior Options',tab_type='VISIBLE') self.add_tab(name='Formulas',tab_type='HIDDEN') self.add_prompt(name="Division Qty",prompt_type='QUANTITY',value=2,tab_index=0) self.add_prompt(name="Division Setback",prompt_type='DISTANCE',value=unit.inch(0.25),tab_index=0) self.add_prompt(name="Adj Shelf Rows",prompt_type='QUANTITY',value=2,tab_index=0) self.add_prompt(name="Fixed Shelf Rows",prompt_type='QUANTITY',value=0,tab_index=0) self.add_prompt(name="Division Thickness",prompt_type='DISTANCE',value=unit.inch(0.75),tab_index=1) self.add_prompt(name="Shelf Setback",prompt_type='DISTANCE',value=unit.inch(0.25),tab_index=1) self.add_prompt(name="Shelf Holes Space From Bottom",prompt_type='DISTANCE',value=unit.inch(2.5),tab_index=1) self.add_prompt(name="Shelf Holes Space From Top",prompt_type='DISTANCE',value=unit.inch(0),tab_index=1) self.add_prompt(name="Shelf Holes Front Setback",prompt_type='DISTANCE',value=unit.inch(0),tab_index=1) self.add_prompt(name="Shelf Holes Rear Setback",prompt_type='DISTANCE',value=unit.inch(0),tab_index=1) self.add_prompt(name="Adjustable Shelf Thickness",prompt_type='DISTANCE',value=unit.inch(0.75),tab_index=1) self.add_prompt(name="Fixed Shelf Thickness",prompt_type='DISTANCE',value=unit.inch(0.75),tab_index=1) self.add_prompt(name="Shelf Clip Gap",prompt_type='DISTANCE',value=unit.inch(0.125),tab_index=1) self.add_prompt(name="Shelf Hole Spacing",prompt_type='DISTANCE',value=unit.inch(1.25),tab_index=1) self.add_prompt(name="Shelf Pin Quantity",prompt_type='QUANTITY',value=0,tab_index=1) sgi = self.get_var('cabinetlib.spec_group_index','sgi') Adj_Shelf_Rows = self.get_var('Adj Shelf Rows') Division_Qty = self.get_var('Division Qty') self.prompt('Shelf Pin Quantity','(Adj_Shelf_Rows*Division_Qty)*4',[Adj_Shelf_Rows,Division_Qty]) self.prompt('Division Thickness','THICKNESS(sgi,"Cabinet_Division' + self.open_name +'")',[sgi]) self.prompt('Fixed Shelf Thickness','THICKNESS(sgi,"Cabinet_Shelf' + self.open_name +'")',[sgi]) self.prompt('Adjustable Shelf Thickness','THICKNESS(sgi,"Cabinet_Shelf' + self.open_name +'")',[sgi])
def __init__(self): self.category_name = "Windows" self.assembly_name = "Sliding Window Marginal Borders" self.width = unit.inch(64) self.height = DEFAULT_HEIGHT self.depth = DEFAULT_DEPTH self.height_above_floor = HEIGHT_ABOVE_FLOOR self.window_frame = "Window_Frame_Sliding.blend" self.window_divider = "Window_Divider_Border.blend" self.window_blinds = ""
def create_cabinet(product): product.create_assembly() product.obj_bp.lm_basic_cabinets.is_cabinet = True product.obj_bp.lm_basic_cabinets.cabinet_shape = 'RECTANGLE' product.add_tab(name='Carcass Options', tab_type='VISIBLE') product.add_tab(name='Formulas', tab_type='HIDDEN') product.add_prompt(name="Material_Thickness", prompt_type='DISTANCE', value=unit.inch(.75), lock=True, tab_index=1)
def __init__(self): self.category_name = "Windows" self.assembly_name = "Hung Window 4 Lites" self.width = DEFAULT_WIDTH self.height = unit.inch(48) self.depth = DEFAULT_DEPTH self.height_above_floor = HEIGHT_ABOVE_FLOOR self.window_frame = "Window_Frame_Hung.blend" self.window_divider = "Window_Divider_4_Lites.blend" self.window_blinds = ""
def add_corner_countertop(product,pie_cut=True): product.add_prompt(name="Countertop Overhang Front",prompt_type='DISTANCE',value=unit.inch(1),tab_index=0) product.add_prompt(name="Countertop Overhang Left Back",prompt_type='DISTANCE',value=unit.inch(0),tab_index=0) product.add_prompt(name="Countertop Overhang Right Back",prompt_type='DISTANCE',value=unit.inch(0),tab_index=0) product.add_prompt(name="Countertop Overhang Left",prompt_type='DISTANCE',value=unit.inch(0),tab_index=0) product.add_prompt(name="Countertop Overhang Right",prompt_type='DISTANCE',value=unit.inch(0),tab_index=0) Countertop_Overhang_Front = product.get_var('Countertop Overhang Front') Countertop_Overhang_Left = product.get_var('Countertop Overhang Left') Countertop_Overhang_Right = product.get_var('Countertop Overhang Right') Countertop_Overhang_Left_Back = product.get_var('Countertop Overhang Left Back') Countertop_Overhang_Right_Back = product.get_var('Countertop Overhang Right Back') Left_Side_Wall_Filler = product.get_var('Left Side Wall Filler') Right_Side_Wall_Filler = product.get_var('Right Side Wall Filler') Left_Cabinet_Depth = product.get_var('Left Cabinet Depth') Right_Cabinet_Depth = product.get_var('Right Cabinet Depth') Width = product.get_var("dim_x","Width") Height = product.get_var("dim_z","Height") Depth = product.get_var("dim_y","Depth") if pie_cut: ctop = cabinet_countertops.PRODUCT_Notched_Corner_Countertop() else: ctop = cabinet_countertops.PRODUCT_Diagonal_Corner_Countertop() ctop.draw() ctop.obj_bp.mv.type_group = 'INSERT' ctop.obj_bp.parent = product.obj_bp ctop.x_loc('-Countertop_Overhang_Left_Back',[Countertop_Overhang_Left_Back]) ctop.y_loc('Countertop_Overhang_Right_Back',[Countertop_Overhang_Right_Back]) ctop.z_loc('Height',[Height]) ctop.x_rot(value = 0) ctop.y_rot(value = 0) ctop.z_rot(value = 0) ctop.x_dim('Width+Countertop_Overhang_Left_Back+Countertop_Overhang_Right+Right_Side_Wall_Filler', [Width,Countertop_Overhang_Left_Back,Countertop_Overhang_Right,Right_Side_Wall_Filler]) ctop.y_dim('Depth-Countertop_Overhang_Right_Back-Countertop_Overhang_Left-Left_Side_Wall_Filler', [Depth,Countertop_Overhang_Right_Back,Countertop_Overhang_Left,Left_Side_Wall_Filler]) ctop.z_dim(value = unit.inch(4)) ctop.prompt('Left Side Depth',"Left_Cabinet_Depth+Countertop_Overhang_Front+Countertop_Overhang_Left_Back",[Left_Cabinet_Depth,Countertop_Overhang_Front,Countertop_Overhang_Left_Back]) ctop.prompt('Right Side Depth',"Right_Cabinet_Depth+Countertop_Overhang_Front+Countertop_Overhang_Right_Back",[Right_Cabinet_Depth,Countertop_Overhang_Front,Countertop_Overhang_Right_Back]) return ctop
def execute(self, context): sheets = context.scene.cabinetlib.sheets edgebanding = context.scene.cabinetlib.edgebanding # products = context.scene.cabinetlib.products for sheet in sheets: sheets.remove(0) for edgeband in edgebanding: edgebanding.remove(0) # for product in products: # products.remove(0) for obj in context.visible_objects: if obj.cabinetlib.type_mesh == 'CUTPART': mat_name = utils.get_material_name(obj) if mat_name not in sheets: mat = sheets.add() mat.thickness = utils.get_part_thickness(obj) mat.name = mat_name sheet = mat.sizes.add() sheet.width = unit.inch(48) #TODO: Make a way set defaults sheet.length = unit.inch(98) #TODO: Make a way set defaults if obj.cabinetlib.type_mesh == 'EDGEBANDING': pass #TODO: Setup edgebanding materials # edge_name = utils.get_edgebanding_name(obj) # if edge_name not in edgebanding: # mat = edgebanding.add() # mat.thickness = utils.get_part_thickness(obj) # mat.name= edge_name # if obj.mv.type == 'BPASSEMBLY' and obj.mv.type_group == 'PRODUCT': # product = products.add() # product.name = obj.mv.name_object # product.bp_name = obj.name return {'FINISHED'}
def add_corner_fillers(product): product.add_prompt(name="Left Side Wall Filler",prompt_type='DISTANCE',value= 0,tab_index=0,export=True) product.add_prompt(name="Right Side Wall Filler",prompt_type='DISTANCE',value= 0,tab_index=0,export=True) Product_Width = product.get_var('dim_x','Product_Width') Product_Height = product.get_var('dim_z','Product_Height') Product_Depth = product.get_var('dim_y','Product_Depth') Toe_Kick_Height = product.get_var('Toe Kick Height') Left_Side_Wall_Filler = product.get_var('Left Side Wall Filler') Right_Side_Wall_Filler = product.get_var('Right Side Wall Filler') Left_Cabinet_Depth = product.get_var('Left Cabinet Depth') Right_Cabinet_Depth = product.get_var('Right Cabinet Depth') left_filler = product.add_assembly(PART_WITH_EDGEBANDING) left_filler.set_name("Left Filler") left_filler.x_loc('Left_Cabinet_Depth',[Left_Cabinet_Depth]) left_filler.y_loc('Product_Depth-Left_Side_Wall_Filler',[Product_Depth,Left_Side_Wall_Filler]) left_filler.z_loc('Toe_Kick_Height',[Toe_Kick_Height]) left_filler.x_rot(value = 0) left_filler.y_rot(value = -90) left_filler.z_rot(value = 0) left_filler.x_dim('Product_Height-Toe_Kick_Height',[Product_Height,Toe_Kick_Height]) left_filler.y_dim('Left_Side_Wall_Filler',[Left_Side_Wall_Filler]) left_filler.z_dim(value = unit.inch(.75)) left_filler.set_material_pointers(EXPOSED_EXTERIOR_SURFACE) left_filler.prompt('Hide','IF(Left_Side_Wall_Filler==0,True,False)',[Left_Side_Wall_Filler]) right_filler = product.add_assembly(PART_WITH_EDGEBANDING) right_filler.set_name("Right Filler") right_filler.x_loc('Product_Width',[Product_Width]) right_filler.y_loc('-Right_Cabinet_Depth',[Right_Cabinet_Depth]) right_filler.z_loc('Toe_Kick_Height',[Toe_Kick_Height]) right_filler.x_rot(value = 0) right_filler.y_rot(value = -90) right_filler.z_rot(value = -90) right_filler.x_dim('Product_Height-Toe_Kick_Height',[Product_Height,Toe_Kick_Height]) right_filler.y_dim('Right_Side_Wall_Filler',[Right_Side_Wall_Filler]) right_filler.z_dim(value = unit.inch(.75)) right_filler.set_material_pointers(EXPOSED_EXTERIOR_SURFACE) right_filler.prompt('Hide','IF(Right_Side_Wall_Filler==0,True,False)',[Right_Side_Wall_Filler])
def add_blind_panel(product,side="Left",cabinet_type="Base"): product.add_prompt(name="Blind Panel Width",prompt_type='DISTANCE',value=unit.inch(23),tab_index=1) product.add_prompt(name="Blind Panel Reveal",prompt_type='DISTANCE',value=unit.inch(3),tab_index=1) product.add_prompt(name="Blind Panel Thickness",prompt_type='DISTANCE',value=unit.inch(.75),tab_index=2) Product_Width = product.get_var('dim_x','Product_Width') Product_Height = product.get_var('dim_z','Product_Height') Product_Depth = product.get_var('dim_y','Product_Depth') Toe_Kick_Height = product.get_var('Toe Kick Height') Material_Thickness = product.get_var('Material_Thickness') Blind_Panel_Width = product.get_var('Blind Panel Width') Blind_Panel_Reveal = product.get_var('Blind Panel Reveal') blind_panel = product.add_assembly(PART_WITH_EDGEBANDING) blind_panel.set_name("Right Filler") if side == "Left": blind_panel.x_loc('Material_Thickness',[Material_Thickness]) else: blind_panel.x_loc('Product_Width-Material_Thickness-Blind_Panel_Width-Blind_Panel_Reveal', [Product_Width,Material_Thickness,Blind_Panel_Width,Blind_Panel_Reveal]) blind_panel.y_loc('Product_Depth',[Product_Depth]) if cabinet_type == "Base": blind_panel.z_loc('Toe_Kick_Height+Material_Thickness',[Toe_Kick_Height,Material_Thickness]) if cabinet_type == "Upper": blind_panel.z_loc('Product_Height+Material_Thickness',[Product_Height,Material_Thickness]) blind_panel.x_rot(value = 0) blind_panel.y_rot(value = -90) blind_panel.z_rot(value = -90) if cabinet_type == "Base": blind_panel.x_dim('Product_Height-Toe_Kick_Height-Material_Thickness*2', [Product_Height,Toe_Kick_Height,Material_Thickness]) if cabinet_type == "Upper": blind_panel.x_dim('fabs(Product_Height)-Material_Thickness*2', [Product_Height,Material_Thickness]) blind_panel.y_dim('Blind_Panel_Width+Blind_Panel_Reveal',[Blind_Panel_Width,Blind_Panel_Reveal]) blind_panel.z_dim(value = unit.inch(.75)) blind_panel.set_material_pointers(EXPOSED_EXTERIOR_SURFACE)
def draw(self): self.create_assembly() assembly = self.add_assembly(file_path = self.appliance_path) assembly.set_name(get_file_name(self.appliance_path)) self.width = assembly.obj_x.location.x self.height = assembly.obj_z.location.z self.depth = assembly.obj_y.location.y assembly.assign_material("Chrome",MATERIAL_FILE,"Chrome") assembly.assign_material("Stainless Steel",MATERIAL_FILE,"Stainless Steel") assembly.assign_material("Black Anodized Metal",MATERIAL_FILE,"Black Anodized Metal") dim_x = self.get_var("dim_x") dim_z = self.get_var("dim_z") dim_y = self.get_var("dim_y") if self.add_countertop: self.add_tab(name="Counter Top Options",tab_type='VISIBLE') self.add_prompt(name="Countertop Overhang Front",prompt_type='DISTANCE',value=unit.inch(1),tab_index=0) self.add_prompt(name="Countertop Overhang Back",prompt_type='DISTANCE',value=unit.inch(0),tab_index=0) self.add_prompt(name="Countertop Overhang Left",prompt_type='DISTANCE',value=unit.inch(0),tab_index=0) self.add_prompt(name="Countertop Overhang Right",prompt_type='DISTANCE',value=unit.inch(0),tab_index=0) Countertop_Overhang_Front = self.get_var('Countertop Overhang Front') Countertop_Overhang_Left = self.get_var('Countertop Overhang Left') Countertop_Overhang_Right = self.get_var('Countertop Overhang Right') Countertop_Overhang_Back = self.get_var('Countertop Overhang Back') ctop = cabinet_countertops.PRODUCT_Straight_Countertop() ctop.draw() ctop.obj_bp.mv.type_group = 'INSERT' ctop.obj_bp.parent = self.obj_bp ctop.x_loc('-Countertop_Overhang_Left',[Countertop_Overhang_Left]) ctop.y_loc('Countertop_Overhang_Back',[Countertop_Overhang_Back]) ctop.z_loc('dim_z',[dim_z]) ctop.x_rot(value = 0) ctop.y_rot(value = 0) ctop.z_rot(value = 0) ctop.x_dim('dim_x+Countertop_Overhang_Left+Countertop_Overhang_Right',[dim_x,Countertop_Overhang_Left,Countertop_Overhang_Right]) ctop.y_dim('dim_y-Countertop_Overhang_Front-Countertop_Overhang_Back',[dim_y,Countertop_Overhang_Front,Countertop_Overhang_Back]) ctop.z_dim(value = unit.inch(4))
def add_countertop(product): product.add_prompt(name="Add Backsplash",prompt_type='CHECKBOX',value=True,tab_index=0) product.add_prompt(name="Add Left Backsplash",prompt_type='CHECKBOX',value=False,tab_index=0) product.add_prompt(name="Add Right Backsplash",prompt_type='CHECKBOX',value=False,tab_index=0) product.add_prompt(name="Side Splash Setback",prompt_type='DISTANCE',value=unit.inch(2.25),tab_index=0) product.add_prompt(name="Countertop Overhang Front",prompt_type='DISTANCE',value=unit.inch(1),tab_index=0) product.add_prompt(name="Countertop Overhang Back",prompt_type='DISTANCE',value=unit.inch(0),tab_index=0) product.add_prompt(name="Countertop Overhang Left",prompt_type='DISTANCE',value=unit.inch(0),tab_index=0) product.add_prompt(name="Countertop Overhang Right",prompt_type='DISTANCE',value=unit.inch(0),tab_index=0) Countertop_Overhang_Front = product.get_var('Countertop Overhang Front') Countertop_Overhang_Left = product.get_var('Countertop Overhang Left') Countertop_Overhang_Right = product.get_var('Countertop Overhang Right') Countertop_Overhang_Back = product.get_var('Countertop Overhang Back') Left_Side_Wall_Filler = product.get_var('Left Side Wall Filler') Right_Side_Wall_Filler = product.get_var('Right Side Wall Filler') Add_Backsplash = product.get_var('Add Backsplash') Add_Left_Backsplash = product.get_var('Add Left Backsplash') Add_Right_Backsplash = product.get_var('Add Right Backsplash') Side_Splash_Setback = product.get_var('Side Splash Setback') Width = product.get_var("dim_x","Width") Height = product.get_var("dim_z","Height") Depth = product.get_var("dim_y","Depth") ctop = cabinet_countertops.PRODUCT_Straight_Countertop() ctop.draw() ctop.obj_bp.mv.type_group = 'INSERT' ctop.obj_bp.parent = product.obj_bp ctop.x_loc('-Countertop_Overhang_Left-Left_Side_Wall_Filler',[Countertop_Overhang_Left,Left_Side_Wall_Filler]) ctop.y_loc('Countertop_Overhang_Back',[Countertop_Overhang_Back]) ctop.z_loc('Height',[Height]) ctop.x_rot(value = 0) ctop.y_rot(value = 0) ctop.z_rot(value = 0) ctop.x_dim('Width+Countertop_Overhang_Left+Countertop_Overhang_Right+Left_Side_Wall_Filler+Right_Side_Wall_Filler', [Width,Countertop_Overhang_Left,Countertop_Overhang_Right,Left_Side_Wall_Filler,Right_Side_Wall_Filler]) ctop.y_dim('Depth-Countertop_Overhang_Front-Countertop_Overhang_Back',[Depth,Countertop_Overhang_Front,Countertop_Overhang_Back]) ctop.z_dim(value = unit.inch(4)) ctop.prompt('Add Backsplash','Add_Backsplash',[Add_Backsplash]) ctop.prompt('Add Left Backsplash','Add_Left_Backsplash',[Add_Left_Backsplash]) ctop.prompt('Add Right Backsplash','Add_Right_Backsplash',[Add_Right_Backsplash]) ctop.prompt('Side Splash Setback','Side_Splash_Setback',[Side_Splash_Setback]) return ctop
def draw(self): self.create_assembly() self.obj_bp["ISENTRYDOOR"] = True self.obj_bp.mv.dont_export = True if self.door_panel != "": self.add_tab(name='Main Options', tab_type='VISIBLE') self.add_tab(name='Formulas', tab_type='HIDDEN') self.add_prompt(name="Reverse Swing", prompt_type='CHECKBOX', value=False, tab_index=0) self.add_prompt(name="Door Rotation", prompt_type='ANGLE', value=0.0, tab_index=0) self.add_prompt(name="Hinge Placement", prompt_type='DISTANCE', value=unit.inch(18.0), tab_index=1) if self.double_door != True: self.add_prompt(name="Door Swing", prompt_type='COMBOBOX', items=["Left Swing", "Right Swing"], value=0, tab_index=0) Width = self.get_var('dim_x', 'Width') Height = self.get_var('dim_z', 'Height') Depth = self.get_var('dim_y', 'Depth') Door_Rotation = self.get_var('Door Rotation') Reverse_Swing = self.get_var("Reverse Swing") if self.double_door != True: Swing = self.get_var('Door Swing') door_frame = self.add_assembly(os.path.join(DOOR_FRAME_PATH,self.door_frame)) door_frame.set_name("Door Frame") door_frame.x_dim('Width', [Width]) door_frame.y_dim('Depth', [Depth]) door_frame.z_dim('Height', [Height]) door_frame.assign_material("Frame", MATERIAL_FILE, "White") door_frame.draw_as_hidden_line() if self.door_panel != "": door_panel = self.add_assembly(os.path.join(DOOR_PANEL,self.door_panel)) door_panel.set_name("Door Panel") if self.double_door != True: door_panel.x_loc('IF(Door_Swing==1,Width-INCH(3),INCH(3))',[Width, Swing]) door_panel.y_loc('IF(Reverse_Swing,IF(Door_Swing==0,INCH(1.75),0),IF(Door_Swing==0,Depth,Depth-INCH(1.75)))',[Swing, Reverse_Swing, Depth]) door_panel.z_rot('IF(Door_Swing==1,radians(180)+IF(Reverse_Swing,Door_Rotation,-Door_Rotation),IF(Reverse_Swing,-Door_Rotation,Door_Rotation))', [Door_Rotation, Swing, Reverse_Swing]) else: door_panel.x_loc(value = unit.inch(3)) door_panel.y_loc('Depth-IF(Reverse_Swing,INCH(4.25),INCH(0))',[Reverse_Swing, Depth]) door_panel.z_rot('IF(Reverse_Swing,-Door_Rotation,Door_Rotation)',[Door_Rotation, Reverse_Swing]) door_panel.x_dim('Width-INCH(6)',[Width]) door_panel.z_dim('Height-INCH(3.25)',[Height]) door_panel.assign_material("Door", MATERIAL_FILE, "White") door_panel.assign_material("Glass", MATERIAL_FILE, "Glass") self.add_hardware(door_panel) door_handle = self.add_object(DOOR_HANDLE) door_handle.obj.parent = door_panel.obj_bp door_handle.set_name("Door Handle") door_handle.x_loc('Width-INCH(9)',[Width]) door_handle.y_loc(value = unit.inch(-0.875)) door_handle.z_loc(value = HANDLE_HEIGHT) door_handle.assign_material("Handle Color", MATERIAL_FILE, "Chrome") if self.double_door == True: door_panel.x_dim('(Width-INCH(6))*0.5',[Width]) door_handle.x_loc('(Width*0.5)-INCH(6)',[Width]) door_panel_right = self.add_assembly(os.path.join(DOOR_PANEL,self.door_panel)) door_panel_right.set_name("Door Panel Right") door_panel_right.x_loc('Width-INCH(3)',[Width]) door_panel_right.y_loc('Depth-INCH(1.75)-IF(Reverse_Swing,INCH(4.25),INCH(0))',[Reverse_Swing, Depth]) door_panel_right.z_rot('radians(180)+IF(Reverse_Swing,Door_Rotation,-Door_Rotation)',[Door_Rotation, Reverse_Swing]) door_panel_right.x_dim('(Width-INCH(6))*0.5',[Width]) door_panel_right.z_dim('Height-INCH(3.25)',[Height]) door_panel_right.assign_material("Door", MATERIAL_FILE, "White") door_panel_right.assign_material("Glass", MATERIAL_FILE, "Glass") self.add_hardware(door_panel_right, no_latch=True) Dpr_Width = door_panel_right.get_var('dim_x','Dpr_Width') door_handle_right = self.add_object(DOOR_HANDLE) door_handle_right.set_name("Door Handle Right") door_handle_right.obj.parent = door_panel_right.obj_bp door_handle_right.x_loc('Dpr_Width-INCH(3)', [Dpr_Width]) door_handle_right.y_loc(value = unit.inch(-0.875)) door_handle_right.z_loc(value = HANDLE_HEIGHT) door_handle_right.assign_material("Handle Color", MATERIAL_FILE, "Chrome") self.update()