选择边缘上的任意一点,select>select all by trait>non manifold可以将物体所有的边缘边选中,q键extract curve可以批量将所有curb的引导曲线提取出来,curbmesh添加array、curve modifier,此时选取这个复合曲线只会随机生成一个内接curb,选中状态下配合multiple_curves_array这个script,可以批量对所有的内侧包围曲线添加curb,curb的方向会根据曲线方向,这里只能手动对Y scale -1和1做调整来协调curb的方向。这些curb无法apply互相间存在instance关系,q键object data清除instance关联即可。
n_splines = len(curve.data.splines) next = curve for i inrange(n_splines): new_crv = next.copy() new_crv.data = next.data.copy() if i > 0: new_crv.data.splines.remove(new_crv.data.splines[0]) next = new_crv.copy() next.data = new_crv.data.copy() curves.append(new_crv) delete = False for s in new_crv.data.splines: if delete: new_crv.data.splines.remove(s) delete = True scn.collection.objects.link(new_crv)
bpy.ops.object.mode_set(mode = 'OBJECT')
bpy.ops.object.select_all(action='DESELECT')
print("copy objects")
for c in curves: new_ob = ob.copy() if merge: new_ob.data = ob.data.copy() objects.append(new_ob) scn.collection.objects.link(new_ob) for m in new_ob.modifiers: if m.type == 'CURVE': m.object = c if m.type == 'ARRAY': m.curve = c
bpy.context.scene.update()
if merge: print("merge objects") for o in objects: o.data = o.to_mesh(scn, apply_modifiers=True, settings = 'PREVIEW') o.modifiers.clear() o.select = True scn.objects.active = o bpy.ops.object.join() for c in curves: bpy.data.objects.remove(c)
评论