Paste Code
Paste Blends
Paste Images
#--------------------------- DUAL MESH -------------------------#
#-------------------------- version 1.0 ------------------------#
# #
# Alessandro Zomparelli #
# (2013) #
# #
# http://sketchesofcode.wordpress.com/ #
# #
# Creative Commons #
# CC BY-SA 3.0 #
# http://creativecommons.org/licenses/by-sa/3.0/ #

import bpy

ob = bpy.context.active_object
bpy.ops.object.mode_set(mode = 'EDIT')
bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT', action='TOGGLE')
bpy.ops.mesh.select_all(action = 'SELECT')
bpy.ops.mesh.quads_convert_to_tris(use_beauty=True)
bpy.ops.mesh.select_all(action = 'DESELECT')
bpy.ops.object.mode_set(mode = 'OBJECT')
bpy.ops.object.modifier_add(type='SUBSURF')
bpy.ops.object.modifier_apply(apply_as='DATA', modifier='Subsurf')

bpy.ops.object.mode_set(mode = 'EDIT')
bpy.ops.mesh.select_all(action = 'DESELECT')

verts = ob.data.vertices

bpy.ops.object.mode_set(mode = 'OBJECT')
verts[0].select = True
bpy.ops.object.mode_set(mode = 'EDIT')
bpy.ops.mesh.select_more()
bpy.ops.mesh.select_similar(type='FACE', compare='EQUAL', threshold=0.01)
bpy.ops.mesh.select_all(action='INVERT')
bpy.ops.mesh.dissolve(use_verts=False)
bpy.ops.mesh.select_all(action = 'DESELECT')

bpy.ops.mesh.primitive_grid_add(x_subdivisions=3, y_subdivisions=3, size=1, view_align=False, enter_editmode=False, location=(666, 666, 666), rotation=(0, 0, 0), layers=(True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False))
bpy.ops.object.mode_set(mode = 'OBJECT')
for v in verts:
if v.co[0] == 666:
v.select = True
break
bpy.ops.object.mode_set(mode = 'EDIT')
bpy.ops.mesh.select_similar(type='FACE', compare='EQUAL', threshold=0.01)
bpy.ops.mesh.dissolve(use_verts=False)
bpy.ops.mesh.select_all(action = 'DESELECT')



bpy.ops.mesh.primitive_plane_add(view_align=False, enter_editmode=False, location=(666, 666, 666), rotation=(0, 0, 0), layers=(True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False))
bpy.ops.object.mode_set(mode = 'OBJECT')
for v in verts:
if v.co[0] == 667:
v.select = True
break
bpy.ops.object.mode_set(mode = 'EDIT')
bpy.ops.mesh.select_similar(type='EDGE', compare='EQUAL', threshold=0.01)
bpy.ops.mesh.dissolve(use_verts=False)
bpy.ops.mesh.select_all(action = 'DESELECT')
bpy.ops.object.mode_set(mode = 'OBJECT')
  1. #--------------------------- DUAL MESH -------------------------#
  2. #-------------------------- version 1.0 ------------------------#
  3. #                                                               #
  4. #                      Alessandro Zomparelli                    #
  5. #                             (2013)                            #
  6. #                                                               #
  7. # http://sketchesofcode.wordpress.com/                          #
  8. #                                                               #
  9. # Creative Commons                                              #
  10. # CC BY-SA 3.0                                                  #
  11. # http://creativecommons.org/licenses/by-sa/3.0/                #
  12.  
  13. import bpy
  14.  
  15. ob = bpy.context.active_object
  16. bpy.ops.object.mode_set(mode = 'EDIT')
  17. bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT', action='TOGGLE')
  18. bpy.ops.mesh.select_all(action = 'SELECT')
  19. bpy.ops.mesh.quads_convert_to_tris(use_beauty=True)
  20. bpy.ops.mesh.select_all(action = 'DESELECT')
  21. bpy.ops.object.mode_set(mode = 'OBJECT')
  22. bpy.ops.object.modifier_add(type='SUBSURF')
  23. bpy.ops.object.modifier_apply(apply_as='DATA', modifier='Subsurf')
  24.  
  25. bpy.ops.object.mode_set(mode = 'EDIT')
  26. bpy.ops.mesh.select_all(action = 'DESELECT')
  27.  
  28. verts = ob.data.vertices
  29.  
  30. bpy.ops.object.mode_set(mode = 'OBJECT')
  31. verts[0].select = True
  32. bpy.ops.object.mode_set(mode = 'EDIT')
  33. bpy.ops.mesh.select_more()
  34. bpy.ops.mesh.select_similar(type='FACE', compare='EQUAL', threshold=0.01)
  35. bpy.ops.mesh.select_all(action='INVERT')
  36. bpy.ops.mesh.dissolve(use_verts=False)
  37. bpy.ops.mesh.select_all(action = 'DESELECT')
  38.  
  39. bpy.ops.mesh.primitive_grid_add(x_subdivisions=3, y_subdivisions=3, size=1, view_align=False, enter_editmode=False, location=(666, 666, 666), rotation=(0, 0, 0), layers=(True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False))
  40. bpy.ops.object.mode_set(mode = 'OBJECT')
  41. for v in verts:
  42.     if v.co[0] == 666:
  43.         v.select = True
  44.         break
  45. bpy.ops.object.mode_set(mode = 'EDIT')
  46. bpy.ops.mesh.select_similar(type='FACE', compare='EQUAL', threshold=0.01)
  47. bpy.ops.mesh.dissolve(use_verts=False)
  48. bpy.ops.mesh.select_all(action = 'DESELECT')
  49.  
  50.  
  51.  
  52. bpy.ops.mesh.primitive_plane_add(view_align=False, enter_editmode=False, location=(666, 666, 666), rotation=(0, 0, 0), layers=(True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False))
  53. bpy.ops.object.mode_set(mode = 'OBJECT')
  54. for v in verts:
  55.     if v.co[0] == 667:
  56.         v.select = True
  57.         break
  58. bpy.ops.object.mode_set(mode = 'EDIT')
  59. bpy.ops.mesh.select_similar(type='EDGE', compare='EQUAL', threshold=0.01)
  60. bpy.ops.mesh.dissolve(use_verts=False)
  61. bpy.ops.mesh.select_all(action = 'DESELECT')
  62. bpy.ops.object.mode_set(mode = 'OBJECT')
go to heaven