예제 #1
0
    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 invoke(self,context,event):
     # This gets called first and is used as an init call
     obj = context.scene.objects[self.object_name]
     obj_product_bp = utils.get_bp(obj,'PRODUCT')
     self.product = fd_types.Assembly(obj_product_bp)
     wm = context.window_manager
     return wm.invoke_props_dialog(self, width=utils.get_prop_dialog_width(480))
    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'}
예제 #4
0
 def execute(self, context):
     obj_bp = utils.get_bp(context.object,'PRODUCT')
     bool_list = []
     self.get_boolean_objects(obj_bp, bool_list)
     for bool_obj in bool_list:
         self.remove_referenced_modifiers(context, bool_obj)
     obj_list = []
     obj_list = utils.get_child_objects(obj_bp,obj_list)
     utils.delete_obj_list(obj_list)
     self.object_name = ""
     return {'FINISHED'}
예제 #5
0
 def invoke(self, context, event):
     wm = context.window_manager
     self.products.clear()
     
     #For now only products are selected, could include walls or other objects
     for obj in context.selected_objects:
         product_bp = utils.get_bp(obj,'PRODUCT')
         
         if product_bp and product_bp not in self.products:
             self.products.append(product_bp)
     
     return wm.invoke_props_dialog(self)
예제 #6
0
    def invoke(self, context, event):
        wm = context.window_manager
        self.products.clear()

        #For now only products are selected, could include walls or other objects
        for obj in context.selected_objects:
            product_bp = utils.get_bp(obj, 'PRODUCT')

            if product_bp and product_bp not in self.products:
                self.products.append(product_bp)

        return wm.invoke_props_dialog(self)
 def draw(self, context):
     spec_groups = context.scene.mv.spec_groups
     layout = self.layout
     product_bp = utils.get_bp(context.object,'PRODUCT')
     for spec_group in spec_groups:
         if product_bp.cabinetlib.spec_group_name == spec_group.name:
             props = layout.operator('fd_material.change_product_spec_group',text=spec_group.name,icon='FILE_TICK')
             props.spec_group_name = spec_group.name
             props.object_name = product_bp.name
         else:
             props = layout.operator('fd_material.change_product_spec_group',text=spec_group.name,icon='LINK')
             props.spec_group_name = spec_group.name
             props.object_name = product_bp.name
 def draw(self, context):
     layout = self.layout
     product_bp = utils.get_bp(context.object,'PRODUCT')
     if product_bp:
         layout.menu('MENU_Change_Cabinet_Spec_Group',icon='SOLO_ON')
         layout.separator()
         if product_bp.parent:
             if product_bp.parent.mv.type == 'BPWALL':
                 props = layout.operator('fd_general.place_product',text="Place Product",icon='LATTICE_DATA')
                 props.object_name = product_bp.name
         props = layout.operator('cabinetlib.make_static_product',text="Make Static",icon='MOD_DISPLACE')
         props.object_name = product_bp.name
         layout.operator('cabinetlib.select_product',text="Select All",icon='MAN_TRANS').object_name = product_bp.name
예제 #9
0
 def write_hardware_for_assembly(self,elm_hardware,obj_bp,recursive=False):
     for child in obj_bp.children:
         if child.cabinetlib.type_mesh == 'HARDWARE':
             if not child.hide:
                 hardware_name = child.mv.name_object if child.mv.name_object != "" else child.name
                 elm_item = self.xml.add_element(elm_hardware,'Hardware',hardware_name)
                 
                 if child.mv.hardware_x_dim != 0:
                     self.xml.add_element_with_text(elm_item,'XDimension',self.distance(child.mv.hardware_x_dim))
                 else:
                     self.xml.add_element_with_text(elm_item,'XDimension',self.distance(child.dimensions.x))
                     
                 if child.mv.hardware_y_dim != 0:
                     self.xml.add_element_with_text(elm_item,'YDimension',self.distance(child.mv.hardware_y_dim))
                 else:
                     self.xml.add_element_with_text(elm_item,'YDimension',self.distance(child.dimensions.y))
                     
                 if child.mv.hardware_z_dim != 0:
                     self.xml.add_element_with_text(elm_item,'ZDimension',self.distance(child.mv.hardware_z_dim))
                 else:
                     self.xml.add_element_with_text(elm_item,'ZDimension',self.distance(child.dimensions.z))
                     
                 if recursive:
                     product_bp = utils.get_bp(child,'PRODUCT')
                     loc_pos = product_bp.matrix_world.inverted() * child.matrix_world
                     x_loc = self.location(loc_pos[0][3])
                     y_loc = self.location(loc_pos[1][3])
                     z_loc = self.location(loc_pos[2][3])                                     
                     self.xml.add_element_with_text(elm_item,'XOrigin',x_loc)
                     self.xml.add_element_with_text(elm_item,'YOrigin',y_loc)
                     self.xml.add_element_with_text(elm_item,'ZOrigin',z_loc)   
                 else:
                     loc_pos = child.parent.matrix_world.inverted() * child.matrix_world
                     x_loc = self.location(loc_pos[0][3])
                     y_loc = self.location(loc_pos[1][3])
                     z_loc = self.location(loc_pos[2][3])
                     self.xml.add_element_with_text(elm_item,'XOrigin',x_loc)
                     self.xml.add_element_with_text(elm_item,'YOrigin',y_loc)
                     self.xml.add_element_with_text(elm_item,'ZOrigin',z_loc)
                     
                 self.xml.add_element_with_text(elm_item,'Comment',child.mv.comment)
                 self.write_machine_tokens(elm_item,child)
                 
                 self.xml.add_element_with_text(elm_item,'AssociativeHardwareRotation',str(child.mv.associative_rotation))
                 
         if recursive:
             self.write_hardware_for_assembly(elm_hardware, child, recursive=recursive)
예제 #10
0
 def draw(self, context):
     spec_groups = context.scene.mv.spec_groups
     layout = self.layout
     product_bp = utils.get_bp(context.object, 'PRODUCT')
     for spec_group in spec_groups:
         if product_bp.cabinetlib.spec_group_name == spec_group.name:
             props = layout.operator(
                 'fd_material.change_product_spec_group',
                 text=spec_group.name,
                 icon='FILE_TICK')
             props.spec_group_name = spec_group.name
             props.object_name = product_bp.name
         else:
             props = layout.operator(
                 'fd_material.change_product_spec_group',
                 text=spec_group.name,
                 icon='LINK')
             props.spec_group_name = spec_group.name
             props.object_name = product_bp.name
예제 #11
0
 def draw(self, context):
     layout = self.layout
     product_bp = utils.get_bp(context.object, 'PRODUCT')
     if product_bp:
         layout.menu('MENU_Change_Cabinet_Spec_Group', icon='SOLO_ON')
         layout.separator()
         if product_bp.parent:
             if product_bp.parent.mv.type == 'BPWALL':
                 props = layout.operator('fd_general.place_product',
                                         text="Place Product",
                                         icon='LATTICE_DATA')
                 props.object_name = product_bp.name
         props = layout.operator('cabinetlib.make_static_product',
                                 text="Make Static",
                                 icon='MOD_DISPLACE')
         props.object_name = product_bp.name
         layout.operator('cabinetlib.select_product',
                         text="Select All",
                         icon='MAN_TRANS').object_name = product_bp.name
예제 #12
0
 def invoke(self,context,event):
     obj = bpy.data.objects[self.object_name]
     obj_product_bp = utils.get_bp(obj,'PRODUCT')
     self.product = fd_types.Assembly(obj_product_bp)
     if self.product.obj_bp:
         self.depth = math.fabs(self.product.obj_y.location.y)
         self.height = math.fabs(self.product.obj_z.location.z)
         self.width = math.fabs(self.product.obj_x.location.x)
         
         self.start_x = self.product.obj_bp.location.x
         self.x_loc = self.product.obj_bp.location.x
         self.start_width = math.fabs(self.product.obj_x.location.x)
         
         self.array_x_prompt = self.product.get_prompt("Array X")
         self.array_x = self.array_x_prompt.value()
         
         self.array_x_offset_prompt = self.product.get_prompt("Array X Offset")
         self.array_x_offset = self.array_x_offset_prompt.value()          
             
     wm = context.window_manager
     return wm.invoke_props_dialog(self, width=480)
예제 #13
0
    def invoke(self, context, event):
        obj = bpy.data.objects[self.object_name]
        obj_product_bp = utils.get_bp(obj, 'PRODUCT')
        self.product = fd_types.Assembly(obj_product_bp)
        if self.product.obj_bp:
            self.depth = math.fabs(self.product.obj_y.location.y)
            self.height = math.fabs(self.product.obj_z.location.z)
            self.width = math.fabs(self.product.obj_x.location.x)

            self.start_x = self.product.obj_bp.location.x
            self.x_loc = self.product.obj_bp.location.x
            self.start_width = math.fabs(self.product.obj_x.location.x)

            self.array_x_prompt = self.product.get_prompt("Array X")
            self.array_x = self.array_x_prompt.value()

            self.array_x_offset_prompt = self.product.get_prompt(
                "Array X Offset")
            self.array_x_offset = self.array_x_offset_prompt.value()

        wm = context.window_manager
        return wm.invoke_props_dialog(self, width=480)
예제 #14
0
 def invoke(self,context,event):
     obj = bpy.data.objects[self.object_name]
     obj_product_bp = utils.get_bp(obj,'PRODUCT')
     self.product = fd_types.Assembly(obj_product_bp)
     if self.product.obj_bp:
         self.depth = math.fabs(self.product.obj_y.location.y)
         self.height = math.fabs(self.product.obj_z.location.z)
         self.width = math.fabs(self.product.obj_x.location.x)
         
         try:
             self.open_door_prompt = self.product.get_prompt("Door Rotation")
             self.door_rotation = self.open_door_prompt.value() 
         except:
             pass
         
         try:
             self.door_swing_prompt = self.product.get_prompt("Door Swing")  
             self.door_swing = self.door_swing_prompt.value()         
         except:
             pass
             
     wm = context.window_manager
     return wm.invoke_props_dialog(self, width=480)
예제 #15
0
    def invoke(self, context, event):
        wm = context.window_manager
        self.products.clear()
        self.objects.clear()
        
        for i in self.scenes:
            self.scenes.remove(0)
        
        for scene in bpy.data.scenes:
            scene_col = self.scenes.add()
            scene_col.name = scene.name

        for obj in context.selected_objects:
            product_bp = utils.get_bp(obj,'PRODUCT')
            
            if product_bp and product_bp not in self.products:
                self.products.append(product_bp)
        
        if len(self.products) == 0:
            for obj in context.selected_objects:
                self.objects.append(obj)
        
        return wm.invoke_props_dialog(self)
예제 #16
0
    def invoke(self, context, event):
        wm = context.window_manager
        self.products.clear()
        self.objects.clear()

        for i in self.scenes:
            self.scenes.remove(0)

        for scene in bpy.data.scenes:
            scene_col = self.scenes.add()
            scene_col.name = scene.name

        for obj in context.selected_objects:
            product_bp = utils.get_bp(obj, 'PRODUCT')

            if product_bp and product_bp not in self.products:
                self.products.append(product_bp)

        if len(self.products) == 0:
            for obj in context.selected_objects:
                self.objects.append(obj)

        return wm.invoke_props_dialog(self)
예제 #17
0
    def invoke(self, context, event):
        obj = bpy.data.objects[self.object_name]
        obj_product_bp = utils.get_bp(obj, 'PRODUCT')
        self.product = fd_types.Assembly(obj_product_bp)
        if self.product.obj_bp:
            self.depth = math.fabs(self.product.obj_y.location.y)
            self.height = math.fabs(self.product.obj_z.location.z)
            self.width = math.fabs(self.product.obj_x.location.x)

            try:
                self.open_door_prompt = self.product.get_prompt(
                    "Door Rotation")
                self.door_rotation = self.open_door_prompt.value()
            except:
                pass

            try:
                self.door_swing_prompt = self.product.get_prompt("Door Swing")
                self.door_swing = self.door_swing_prompt.value()
            except:
                pass

        wm = context.window_manager
        return wm.invoke_props_dialog(self, width=480)
예제 #18
0
 def draw(self, context):
     obj_bp = utils.get_bp(context.object,'PRODUCT')
     layout = self.layout
     layout.label("Assembly Name: " + obj_bp.mv.name_object)
예제 #19
0
    def write_part_node(self,node,obj,spec_group,recursive=False):
        if obj.mv.type == 'BPASSEMBLY':
            assembly = fd_types.Assembly(obj)
        else:
            assembly = fd_types.Assembly(obj.parent)
        if assembly.obj_bp.mv.type_group != "PRODUCT":
            if obj.type == 'CURVE':
                curve_name = obj.mv.name_object if obj.mv.name_object != "" else obj.name
                elm_part = self.xml.add_element(node,'Part',curve_name)
            else:
                obj_name = assembly.obj_bp.mv.name_object if assembly.obj_bp.mv.name_object != "" else assembly.obj_bp.name
                elm_part = self.xml.add_element(node,'Part',obj_name)
            
            if obj.cabinetlib.type_mesh == 'CUTPART':
                self.xml.add_element_with_text(elm_part,'PartType',"2")
    
            if obj.cabinetlib.type_mesh == 'BUYOUT':
                self.xml.add_element_with_text(elm_part,'PartType',"4")
                if utils.get_material_name(obj) not in self.buyout_materials:
                    self.buyout_materials.append(utils.get_material_name(obj))
                    
            if obj.cabinetlib.type_mesh == 'SOLIDSTOCK':
                self.xml.add_element_with_text(elm_part,'PartType',"3")
                if utils.get_material_name(obj) not in self.solid_stock_materials:
                    self.solid_stock_materials[utils.get_material_name(obj)] = utils.get_part_thickness(obj)

            self.xml.add_element_with_text(elm_part,'LinkID',assembly.obj_bp.name)
            self.xml.add_element_with_text(elm_part,'Qty',self.get_part_qty(assembly))
            self.xml.add_element_with_text(elm_part,'MaterialName',utils.get_material_name(obj))
            self.xml.add_element_with_text(elm_part,'Thickness',self.distance(utils.get_part_thickness(obj)))
            self.xml.add_element_with_text(elm_part,'UseSMA','True' if obj.mv.use_sma else 'False')
            self.xml.add_element_with_text(elm_part,'LinkIDProduct',utils.get_bp(obj,'PRODUCT').name)
            self.xml.add_element_with_text(elm_part,'LinkIDParent',assembly.obj_bp.parent.name)
            self.xml.add_element_with_text(elm_part,'PartLength',self.get_part_length(assembly))
            self.xml.add_element_with_text(elm_part,'PartWidth',self.get_part_width(assembly))
            self.xml.add_element_with_text(elm_part,'Comment',self.get_part_comment(assembly.obj_bp))
            if recursive:
                self.xml.add_element_with_text(elm_part,'XOrigin',self.get_part_x_location(assembly.obj_bp,assembly.obj_bp.location.x))
                self.xml.add_element_with_text(elm_part,'YOrigin',self.get_part_y_location(assembly.obj_bp,assembly.obj_bp.location.y))
                self.xml.add_element_with_text(elm_part,'ZOrigin',self.get_part_z_location(assembly.obj_bp,assembly.obj_bp.location.z))
            else:
                loc_pos = assembly.obj_bp.parent.matrix_world.inverted() * assembly.obj_bp.matrix_world
                x_loc = self.location(loc_pos[0][3])
                y_loc = self.location(loc_pos[1][3])
                z_loc = self.location(loc_pos[2][3])
                self.xml.add_element_with_text(elm_part,'XOrigin',x_loc)
                self.xml.add_element_with_text(elm_part,'YOrigin',y_loc)
                self.xml.add_element_with_text(elm_part,'ZOrigin',z_loc)
            self.xml.add_element_with_text(elm_part,'XRotation',self.angle(assembly.obj_bp.rotation_euler.x))
            self.xml.add_element_with_text(elm_part,'YRotation',self.angle(assembly.obj_bp.rotation_euler.y))
            self.xml.add_element_with_text(elm_part,'ZRotation',self.angle(assembly.obj_bp.rotation_euler.z))
            
            self.xml.add_element_with_text(elm_part,'EdgeWidth1',self.get_edgebanding_name(obj, obj.mv.edge_w1, spec_group))
            self.xml.add_element_with_text(elm_part,'EdgeWidth2',self.get_edgebanding_name(obj, obj.mv.edge_w2, spec_group))
            self.xml.add_element_with_text(elm_part,'EdgeLength1',self.get_edgebanding_name(obj, obj.mv.edge_l1, spec_group))
            self.xml.add_element_with_text(elm_part,'EdgeLength2',self.get_edgebanding_name(obj, obj.mv.edge_l2, spec_group))
            
            self.xml.add_element_with_text(elm_part,'DrawToken3D',"DRAW3DBOX CABINET")
            self.xml.add_element_with_text(elm_part,'ElvToken2D',"DRAW2DBOX CABINET")
            self.xml.add_element_with_text(elm_part,'BasePoint',self.get_part_base_point(assembly))
            self.xml.add_element_with_text(elm_part,'MachinePoint',"1")
            self.xml.add_element_with_text(elm_part,'Par1',"")
            self.xml.add_element_with_text(elm_part,'Par2',"")
            self.xml.add_element_with_text(elm_part,'Par3',"")
            
            self.write_machine_tokens(elm_part, obj)
예제 #20
0
 def poll(cls, context):
     obj_bp = utils.get_bp(context.object,'PRODUCT')
     if obj_bp:
         return True
     else:
         return False