Skip to content
Snippets Groups Projects
createMesh.py 61.3 KiB
Newer Older
  • Learn to ignore specific revisions
  • Brendon Murphy's avatar
    Brendon Murphy committed
            verts, faces = Bolt_Mesh(props, context)
            sMeshName = 'Bolt'
            sObjName = 'Bolt'
        
        if props.bf_Model_Type == 'bf_Model_Nut':
            #print('Create Nut')
            verts, faces = Nut_Mesh(props, context)
            sMeshName = 'Nut'
            sObjName = 'Nut'
    
        
        verts, faces = RemoveDoubles(verts, faces)
        
        verts = Scale_Mesh_Verts(verts,GLOBAL_SCALE)
        
        
        mesh = bpy.data.meshes.new(sMeshName)
        
        mesh.add_geometry((len(verts)), 0, int(len(faces)))
        mesh.verts.foreach_set("co", unpack_list(verts))
        mesh.faces.foreach_set("verts_raw", unpack_face_list(faces))
    
    
        scene = context.scene
    
        bpy.ops.object.select_all(action='DESELECT')
    
        mesh.update()
        ob_new = bpy.data.objects.new(sObjName, mesh)
        scene.objects.link(ob_new)
        ob_new.select = True
        scene.objects.active = ob_new
    
        #ob_new.location = scene.cursor_location
        ob_new.matrix_world = align_matrix
    
        #print("Created_Object")
        return