uv = curves[int(ih / 2)].uv[:, 0:2] else: uv = curves[int((ih - 1) / 2)].uv[::-1, 2:4] # Vuv.append(uv[0]) # ih = halfedges[ih].prev ih = halfedges[ih].twin if ih == 2 * V.edge[0] + V.edge[1]: break ################################################################ ################################################################ # LOAD FACES color_face = numpy.loadtxt( '/d/bandrieu/GitHub/These/memoire/figures/data/BRep/face_color.dat') color_face = lco.cc_hsv(color_face, fs=1.2, fv=1.0) bpy.ops.import_scene.obj(filepath=pthin + 'mesh/mesh.obj', axis_forward='Y', axis_up='Z') obj = bpy.data.objects['mesh'] lbe.set_smooth(obj) bpy.ops.object.select_all(action='DESELECT') obj.select = True bpy.ops.view3d.camera_to_view_selected() cam.data.angle += numpy.radians(1.) for mat in obj.data.materials: mat.diffuse_color = color_face[int(mat.name[3:]) - 1] mat.diffuse_intensity = 1 mat.specular_intensity = 0
################################################# ################################################# bpy.ops.import_scene.obj(filepath=pthin + 'mesh/mesh.obj', axis_forward='Y', axis_up='Z') obj = bpy.data.objects['mesh'] bpy.ops.object.select_all(action='DESELECT') obj.select = True bpy.ops.view3d.camera_to_view_selected() # set camera to fit surf in screen cam.data.angle += numpy.pi / 180.0 # increase FOV angle by 1 degree bpy.ops.object.delete() ################################################# clf = numpy.loadtxt(pthout + 'face_color.dat') clf = lco.cc_hsv(clf, fs=1.2, fv=1.0) tri = numpy.loadtxt(pthin + 'brepmesh/tri_' + strf + '.dat', dtype=int) - 1 xyz = numpy.loadtxt(pthin + 'brepmesh/xyz_' + strf + '.dat', dtype=float) verts = [[x for x in p] for p in xyz] faces = [[int(v) for v in t] for t in tri] obj = lbu.pydata_to_mesh(verts, faces, name='face') lbe.set_smooth(obj) # material mat = bpy.data.materials.new('mat_face') mat.diffuse_color = clf[iface] mat.diffuse_intensity = 1
cam.data.angle = numpy.radians(37.72) ################################################################ ################################################################ # COLOR PALETTE """ color_faces = numpy.loadtxt('/d/bandrieu/GitHub/These/memoire/figures/data/BRep/face_color.dat') color_faces = lco.cc_hsv(color_faces, fs=1.2, fv=1.0) ncolors = len(color_faces) """ colorR = numpy.array([250, 117, 102]) / 255. #color_faces[ifaceRL[1]-1] colorL = numpy.array([152, 212, 91]) / 255. #color_faces[ifaceRL[0]-1] colors = numpy.vstack([colorR, colorL]) cc_colors = lco.cc_hsv(colors, fs=0.9, fv=1.1) colorR = cc_colors[0] colorL = cc_colors[1] ################################################################ ################################################################ # LOAD CURRENT INTERFACE'S MESH bpy.ops.import_scene.obj(filepath=pthin + 'mesh/mesh.obj', axis_forward='Y', axis_up='Z') surf = bpy.data.objects['mesh'] surf.name = 'surface' # set smooth shading lbe.set_smooth(surf) # set materials