Пример #1
0
 def execute(self,context):
     settings = get_settings()
     dbg  = settings.debug
     odcutils.scene_verification(context.scene, debug = dbg)
     spaces = odcutils.implant_selection(context)
     layers_copy = [layer for layer in context.scene.layers]
     context.scene.layers[0] = True
     
     if context.mode != 'OBJECT':
         bpy.ops.object.mode_set(mode='OBJECT')
         
     for space in spaces: 
         if not space.implant:
             self.report({'WARNING'}, "It seems you have not yet placed an implant for %s" % space.name)
     
         else:
             if self.use_thickness:
                 thickness = self.thickness
             else:
                 thickness = None
             
             implant_utils.implant_inner_cylinder(context, space, thickness = thickness, debug = dbg)
     
     
     odcutils.material_management(context, context.scene.odc_implants) 
     odcutils.layer_management(context.scene.odc_implants, debug = dbg)
     for i, layer in enumerate(layers_copy):
         context.scene.layers[i] = layer
     context.scene.layers[9] = True
     return {'FINISHED'}   
Пример #2
0
    def execute(self, context):
        settings = get_settings()
        dbg = settings.debug
        odcutils.scene_verification(context.scene, debug=dbg)
        spaces = odcutils.implant_selection(context)
        layers_copy = [layer for layer in context.scene.layers]
        context.scene.layers[0] = True

        if context.mode != 'OBJECT':
            bpy.ops.object.mode_set(mode='OBJECT')

        for space in spaces:
            if not space.implant:
                self.report(
                    {'WARNING'},
                    "It seems you have not yet placed an implant for %s" %
                    space.name)

            else:
                if self.use_thickness:
                    thickness = self.thickness
                else:
                    thickness = None

                implant_utils.implant_inner_cylinder(context,
                                                     space,
                                                     thickness=thickness,
                                                     debug=dbg)

        odcutils.material_management(context, context.scene.odc_implants)
        odcutils.layer_management(context.scene.odc_implants, debug=dbg)
        for i, layer in enumerate(layers_copy):
            context.scene.layers[i] = layer
        context.scene.layers[9] = True
        return {'FINISHED'}
Пример #3
0
    def execute(self, context):
        
            
        settings = get_settings()
        dbg = settings.debug
        
        #first, ensure all models are present and not deleted etc
        odcutils.scene_verification(context.scene, debug = dbg)      
        b = settings.behavior
        behave_mode = settings.behavior_modes[int(b)]
        
        settings = get_settings()
        dbg = settings.debug    
        [ob_sets, tool_sets, space_sets] = odcutils.scene_preserv(context, debug=dbg)
        
        #this is sneaky way of letting me test different things
        if behave_mode in {'ACTIVE','ACTIVE_SELECTED'} and dbg > 2:
            obs = context.selected_objects
            if obs[0].type == 'CURVE':
                model = obs[1]
                margin = obs[0]
            else:
                model = obs[0]
                margin = obs[1]
        
                exclude = ['name','teeth','implants','tooth_string','implant_string']
                splint = odcutils.active_odc_item_candidate(context.scene.odc_splints, obs[0], exclude)
        
        else:
            j = context.scene.odc_splint_index
            splint =context.scene.odc_splints[j]
            if splint.model in bpy.data.objects and splint.margin in bpy.data.objects:
                model = bpy.data.objects[splint.model]
                margin = bpy.data.objects[splint.margin]
            else:
                print('whoopsie...margin and model not defined or something is wrong')
                return {'CANCELLED'}
        
        
        layers_copy = [layer for layer in context.scene.layers]
        context.scene.layers[0] = True
        
        z = Vector((0,0,1))
        vrot= context.space_data.region_3d.view_rotation
        Z = vrot*z
        
        [Splint, Falloff, Refractory] = full_arch_methods.splint_bezier_step_1(context, model, margin, Z, self.thickness, debug=dbg)

        splint.splint = Splint.name #that's a pretty funny statement.
        
        if splint.bone and splint.bone in bpy.data.objects:
            mod = Splint.modifiers['Bone']
            mod.target = bpy.data.objects[splint.bone]
        
        if self.cleanup:
            context.scene.objects.active = Splint
            Splint.select = True
            
            for mod in Splint.modifiers:
                
                if mod.name != 'Bone':
                    if mod.type in {'BOOLEAN', 'SHRINKWRAP'}:
                        if mod.type == 'BOOLEAN' and mod.object:
                            bpy.ops.object.modifier_apply(modifier=mod.name)
                        elif mod.type == 'SHRINKWRAP' and mod.target:
                            bpy.ops.object.modifier_apply(modifier=mod.name)
                    else:
                        bpy.ops.object.modifier_apply(modifier=mod.name)

            context.scene.objects.unlink(Falloff)    
            Falloff.user_clear()
            bpy.data.objects.remove(Falloff)
            
            context.scene.objects.unlink(Refractory)
            Refractory.user_clear()
            bpy.data.objects.remove(Refractory)
            odcutils.scene_reconstruct(context, ob_sets, tool_sets, space_sets, debug=dbg)  
            
        else:
            odcutils.scene_reconstruct(context, ob_sets, tool_sets, space_sets, debug=dbg)  
            Falloff.hide = True
            Refractory.hide = True
                
        for i, layer in enumerate(layers_copy):
            context.scene.layers[i] = layer
        context.scene.layers[10] = True
          
        odcutils.material_management(context, context.scene.odc_splints, debug = dbg)
        odcutils.layer_management(context.scene.odc_splints, debug = dbg)   
        return {'FINISHED'}