Friday, July 29, 2011
GMP_model_July
The models of July, movie from selected 113 generated objects.
Tuesday, July 19, 2011
I got some 3D printed objects, from the models of June.
The objects reached today, it's fantastic.
All babies are cute. I'm so satisfied.
All babies are cute. I'm so satisfied.
I'll select next objects to print, from June models. Of course, I'm making July's object now. I'll select from them next month.
Friday, July 15, 2011
Fixed the code, run on Blender 2.58.
I found the hint for solving the 'pivot_point' problem on the forum of BlenderArtists.org.
<CODE>
bpy.context.space_data.pivot_point = 'INDIVIDUAL_ORIGINS'
</CODE>
Now I could run the code on Blender 2.58 (^_^).
The code is here.
<CODE>
bpy.context.space_data.pivot_point = 'INDIVIDUAL_ORIGINS'
</CODE>
Now I could run the code on Blender 2.58 (^_^).
The code is here.
Almost good progress.
With Dolf's help, the code were written. I think it's a good result for now. But another problem came out.
From Blender 2.58, there are no option of 'active_space' attribute. This code uses the 'active_area' for changing the pivot_point to 'INDIVIDUALS' and 'BOUNDINGBOX_CENTER'. So, this code get 'ERROR' on Blender 2.58.
From Blender 2.58, there are no option of 'active_space' attribute. This code uses the 'active_area' for changing the pivot_point to 'INDIVIDUALS' and 'BOUNDINGBOX_CENTER'. So, this code get 'ERROR' on Blender 2.58.
The code is here.
Thursday, July 14, 2011
Start from here.
Well, let's start to try.
The image of use is,
1. Run this code - add 'Cube' at center automatically
2. Push 'Generate' button
3. Generate eight objects around the center cube
4. Select one from them
5. Do step (2.)
inside the code
1. Add one cube at center (0, 0, 0)
2. Set eight operations as function
3. Duplicate 'Cube', and do each operation
4. Select one object from new eight objects
5. If push 'Generate' button, delete unselected objects
6. Set the pos of selected object to center(0, 0, 0)
7. Set the name of this object to 'Cube'
8. Do step (3.) again
There are two problems now.
1. How to set the pos of selected object to center
The line 64,
<CODE>
bpy.ops.transform.translate(value=(0, 0, 0), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
</CODE>
is, translate the object relatively. So this value=(0, 0, 0) means [no move].
I need to set the pos absolutely (0, 0, 0).
2. How to set the name of the selected object arbitrary.
I have to select the object named 'Cube', but duplicated next generation object has 'Cube.00x'.
How about it?
The all code is here.
<CODE>
# First import bpy to get access to well... everything in blender
from bpy import *
import bpy
#import math, mathutils, random
class GMP_Panel(bpy.types.Panel):
bl_label = "Generative Modeling"
bl_space_type = "VIEW_3D"
bl_region_type = "TOOLS"
def draw(self, context):
layout = self.layout
scn = bpy.context.scene
row = layout.row()
row.operator( "bpt.generate_op" )
class GMP_Operator(bpy.types.Operator):
bl_idname = "bpt.generate_op"
bl_label = "Generate"
def execute(self, context):
# Do 8 operations
clearAndSetNewObj()
operation1()
operation2()
operation3()
operation4()
operation5()
operation6()
operation7()
operation8()
return {'FINISHED'}
def register():
bpy.utils.register_class( GMP_Operator )
bpy.utils.register_class( GMP_Panel )
def unregister():
bpy.utils.register_class( GMP_Operator )
bpy.utils.register_class( GMP_Panel )
# Add first cube
bpy.ops.mesh.primitive_cube_add(view_align=False, enter_editmode=False, location=(0, 0, 0), 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.add_named(linked=False, name="NewOrigin")
# SubSurf and Apply
bpy.ops.object.modifier_add(type='SUBSURF')
bpy.ops.object.modifier_apply(apply_as='DATA', modifier="Subsurf")
# clearAndSetNewObj
def clearAndSetNewObj():
bpy.ops.object.select_inverse()
bpy.ops.object.delete()
bpy.ops.object.select_all(action='TOGGLE')
# Move Selected Object to Center(0, 0, 0) ------------------
bpy.ops.transform.translate(value=(0, 0, 0), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
# op.1
def operation1():
bpy.ops.object.select_name(name="Cube", extend=False)
bpy.ops.object.duplicate_move(OBJECT_OT_duplicate={"linked":False, "mode":'TRANSLATION'}, TRANSFORM_OT_translate={"value":(-5, 5, 0), "constraint_axis":(False, False, False), "constraint_orientation":'GLOBAL', "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "texture_space":False, "release_confirm":False})
ob = bpy.context.active_object
newGroup = ob.vertex_groups.new('vGroup')
bpy.ops.object.mode_set(mode='OBJECT')
# Lets loop through all the faces in the mesh
for f in ob.data.faces:
# See if the current face's centre is above 0.0 on the Z axis
if f.center[2] < -0.5:
# Set select to true
f.select = True
else:
f.select = False
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.object.vertex_group_set_active(group='vGroup')
bpy.ops.object.vertex_group_assign(new=False)
bpy.ops.object.mode_set(mode='OBJECT')
# op.2
def operation2():
bpy.ops.object.select_name(name="Cube", extend=False)
bpy.ops.object.duplicate_move(OBJECT_OT_duplicate={"linked":False, "mode":'TRANSLATION'}, TRANSFORM_OT_translate={"value":(0, 5, 0), "constraint_axis":(False, False, False), "constraint_orientation":'GLOBAL', "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "texture_space":False, "release_confirm":False})
ob = bpy.context.active_object
newGroup = ob.vertex_groups.new('vGroup')
bpy.ops.object.mode_set(mode='OBJECT')
# Lets loop through all the faces in the mesh
for f in ob.data.faces:
# See if the current face's centre is above 0.0 on the Z axis
if (f.center[0] > 0.5 or f.center[0] < -0.5):
# Set select to true
f.select = True
else:
f.select = False
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.object.vertex_group_set_active(group='vGroup')
bpy.ops.object.vertex_group_assign(new=False)
bpy.ops.object.mode_set(mode='OBJECT')
# op.3
def operation3():
bpy.ops.object.select_name(name="Cube", extend=False)
bpy.ops.object.duplicate_move(OBJECT_OT_duplicate={"linked":False, "mode":'TRANSLATION'}, TRANSFORM_OT_translate={"value":(5, 5, 0), "constraint_axis":(False, False, False), "constraint_orientation":'GLOBAL', "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "texture_space":False, "release_confirm":False})
# op.4
def operation4():
bpy.ops.object.select_name(name="Cube", extend=False)
bpy.ops.object.duplicate_move(OBJECT_OT_duplicate={"linked":False, "mode":'TRANSLATION'}, TRANSFORM_OT_translate={"value":(-5, 0, 0), "constraint_axis":(False, False, False), "constraint_orientation":'GLOBAL', "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "texture_space":False, "release_confirm":False})
# op.5
def operation5():
bpy.ops.object.select_name(name="Cube", extend=False)
bpy.ops.object.duplicate_move(OBJECT_OT_duplicate={"linked":False, "mode":'TRANSLATION'}, TRANSFORM_OT_translate={"value":(5, 0, 0), "constraint_axis":(False, False, False), "constraint_orientation":'GLOBAL', "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "texture_space":False, "release_confirm":False})
# op.6
def operation6():
bpy.ops.object.select_name(name="Cube", extend=False)
bpy.ops.object.duplicate_move(OBJECT_OT_duplicate={"linked":False, "mode":'TRANSLATION'}, TRANSFORM_OT_translate={"value":(-5, -5, 0), "constraint_axis":(False, False, False), "constraint_orientation":'GLOBAL', "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "texture_space":False, "release_confirm":False})
# op.7
def operation7():
bpy.ops.object.select_name(name="Cube", extend=False)
bpy.ops.object.duplicate_move(OBJECT_OT_duplicate={"linked":False, "mode":'TRANSLATION'}, TRANSFORM_OT_translate={"value":(0, -5, 0), "constraint_axis":(False, False, False), "constraint_orientation":'GLOBAL', "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "texture_space":False, "release_confirm":False})
# op.8
def operation8():
bpy.ops.object.select_name(name="Cube", extend=False)
bpy.ops.object.duplicate_move(OBJECT_OT_duplicate={"linked":False, "mode":'TRANSLATION'}, TRANSFORM_OT_translate={"value":(5, -5, 0), "constraint_axis":(False, False, False), "constraint_orientation":'GLOBAL', "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "texture_space":False, "release_confirm":False})
bpy.ops.object.modifier_add(type='SUBSURF')
bpy.ops.object.modifier_apply(apply_as='DATA', modifier="Subsurf")
if __name__ == '__main__':
register()
</CODE>
The image of use is,
1. Run this code - add 'Cube' at center automatically
2. Push 'Generate' button
3. Generate eight objects around the center cube
4. Select one from them
5. Do step (2.)
inside the code
1. Add one cube at center (0, 0, 0)
2. Set eight operations as function
3. Duplicate 'Cube', and do each operation
4. Select one object from new eight objects
5. If push 'Generate' button, delete unselected objects
6. Set the pos of selected object to center(0, 0, 0)
7. Set the name of this object to 'Cube'
8. Do step (3.) again
There are two problems now.
1. How to set the pos of selected object to center
The line 64,
<CODE>
bpy.ops.transform.translate(value=(0, 0, 0), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
</CODE>
is, translate the object relatively. So this value=(0, 0, 0) means [no move].
I need to set the pos absolutely (0, 0, 0).
2. How to set the name of the selected object arbitrary.
I have to select the object named 'Cube', but duplicated next generation object has 'Cube.00x'.
How about it?
The all code is here.
<CODE>
# First import bpy to get access to well... everything in blender
from bpy import *
import bpy
#import math, mathutils, random
class GMP_Panel(bpy.types.Panel):
bl_label = "Generative Modeling"
bl_space_type = "VIEW_3D"
bl_region_type = "TOOLS"
def draw(self, context):
layout = self.layout
scn = bpy.context.scene
row = layout.row()
row.operator( "bpt.generate_op" )
class GMP_Operator(bpy.types.Operator):
bl_idname = "bpt.generate_op"
bl_label = "Generate"
def execute(self, context):
# Do 8 operations
clearAndSetNewObj()
operation1()
operation2()
operation3()
operation4()
operation5()
operation6()
operation7()
operation8()
return {'FINISHED'}
def register():
bpy.utils.register_class( GMP_Operator )
bpy.utils.register_class( GMP_Panel )
def unregister():
bpy.utils.register_class( GMP_Operator )
bpy.utils.register_class( GMP_Panel )
# Add first cube
bpy.ops.mesh.primitive_cube_add(view_align=False, enter_editmode=False, location=(0, 0, 0), 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.add_named(linked=False, name="NewOrigin")
# SubSurf and Apply
bpy.ops.object.modifier_add(type='SUBSURF')
bpy.ops.object.modifier_apply(apply_as='DATA', modifier="Subsurf")
# clearAndSetNewObj
def clearAndSetNewObj():
bpy.ops.object.select_inverse()
bpy.ops.object.delete()
bpy.ops.object.select_all(action='TOGGLE')
# Move Selected Object to Center(0, 0, 0) ------------------
bpy.ops.transform.translate(value=(0, 0, 0), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
# op.1
def operation1():
bpy.ops.object.select_name(name="Cube", extend=False)
bpy.ops.object.duplicate_move(OBJECT_OT_duplicate={"linked":False, "mode":'TRANSLATION'}, TRANSFORM_OT_translate={"value":(-5, 5, 0), "constraint_axis":(False, False, False), "constraint_orientation":'GLOBAL', "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "texture_space":False, "release_confirm":False})
ob = bpy.context.active_object
newGroup = ob.vertex_groups.new('vGroup')
bpy.ops.object.mode_set(mode='OBJECT')
# Lets loop through all the faces in the mesh
for f in ob.data.faces:
# See if the current face's centre is above 0.0 on the Z axis
if f.center[2] < -0.5:
# Set select to true
f.select = True
else:
f.select = False
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.object.vertex_group_set_active(group='vGroup')
bpy.ops.object.vertex_group_assign(new=False)
bpy.ops.object.mode_set(mode='OBJECT')
# op.2
def operation2():
bpy.ops.object.select_name(name="Cube", extend=False)
bpy.ops.object.duplicate_move(OBJECT_OT_duplicate={"linked":False, "mode":'TRANSLATION'}, TRANSFORM_OT_translate={"value":(0, 5, 0), "constraint_axis":(False, False, False), "constraint_orientation":'GLOBAL', "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "texture_space":False, "release_confirm":False})
ob = bpy.context.active_object
newGroup = ob.vertex_groups.new('vGroup')
bpy.ops.object.mode_set(mode='OBJECT')
# Lets loop through all the faces in the mesh
for f in ob.data.faces:
# See if the current face's centre is above 0.0 on the Z axis
if (f.center[0] > 0.5 or f.center[0] < -0.5):
# Set select to true
f.select = True
else:
f.select = False
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.object.vertex_group_set_active(group='vGroup')
bpy.ops.object.vertex_group_assign(new=False)
bpy.ops.object.mode_set(mode='OBJECT')
# op.3
def operation3():
bpy.ops.object.select_name(name="Cube", extend=False)
bpy.ops.object.duplicate_move(OBJECT_OT_duplicate={"linked":False, "mode":'TRANSLATION'}, TRANSFORM_OT_translate={"value":(5, 5, 0), "constraint_axis":(False, False, False), "constraint_orientation":'GLOBAL', "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "texture_space":False, "release_confirm":False})
# op.4
def operation4():
bpy.ops.object.select_name(name="Cube", extend=False)
bpy.ops.object.duplicate_move(OBJECT_OT_duplicate={"linked":False, "mode":'TRANSLATION'}, TRANSFORM_OT_translate={"value":(-5, 0, 0), "constraint_axis":(False, False, False), "constraint_orientation":'GLOBAL', "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "texture_space":False, "release_confirm":False})
# op.5
def operation5():
bpy.ops.object.select_name(name="Cube", extend=False)
bpy.ops.object.duplicate_move(OBJECT_OT_duplicate={"linked":False, "mode":'TRANSLATION'}, TRANSFORM_OT_translate={"value":(5, 0, 0), "constraint_axis":(False, False, False), "constraint_orientation":'GLOBAL', "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "texture_space":False, "release_confirm":False})
# op.6
def operation6():
bpy.ops.object.select_name(name="Cube", extend=False)
bpy.ops.object.duplicate_move(OBJECT_OT_duplicate={"linked":False, "mode":'TRANSLATION'}, TRANSFORM_OT_translate={"value":(-5, -5, 0), "constraint_axis":(False, False, False), "constraint_orientation":'GLOBAL', "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "texture_space":False, "release_confirm":False})
# op.7
def operation7():
bpy.ops.object.select_name(name="Cube", extend=False)
bpy.ops.object.duplicate_move(OBJECT_OT_duplicate={"linked":False, "mode":'TRANSLATION'}, TRANSFORM_OT_translate={"value":(0, -5, 0), "constraint_axis":(False, False, False), "constraint_orientation":'GLOBAL', "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "texture_space":False, "release_confirm":False})
# op.8
def operation8():
bpy.ops.object.select_name(name="Cube", extend=False)
bpy.ops.object.duplicate_move(OBJECT_OT_duplicate={"linked":False, "mode":'TRANSLATION'}, TRANSFORM_OT_translate={"value":(5, -5, 0), "constraint_axis":(False, False, False), "constraint_orientation":'GLOBAL', "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "texture_space":False, "release_confirm":False})
bpy.ops.object.modifier_add(type='SUBSURF')
bpy.ops.object.modifier_apply(apply_as='DATA', modifier="Subsurf")
if __name__ == '__main__':
register()
</CODE>
Tuesday, July 12, 2011
New concept of GMP.
Until now, I feel the great ability of generative modeling, but also I know this code has one problem. That is, this code doesn't have 'Gene succession' system. This code could generate tons of shape variation by using many parameters, but each object has no relation each other. And now, I got an idea for new system.
As you know, 'image variation' on ADOBE Photoshop is easy color manipulation system.
As you know, 'image variation' on ADOBE Photoshop is easy color manipulation system.
The center is origin(now), and six color variations are around it. If any color variation are selected, this will be center=next origin(now). If GMP accept the system like this, the new concept is below.
The eight simple operations are around the origin (Of cource, this is conceptual figure).
The center is simple object at first. Next, apply each operation for copied object. I'll get eight new shapes. Select no.'2' shape, this will be next original shape.
Next, apply each operation again. I'll get another new shape. The operation number that I selected is 'Gene' data. [2, 6, 5, 5, 8, 7, 1...]
So, I could trace the line of operations perfectly by this numbers.
This is next concept of GMP.
Thursday, July 7, 2011
Insect Form
This object is short body type, for making an insect type form. For making the short body, re-written the numeric formula of a part of body.
Selected 96 objects in June.
This movie is the selected 96 objects that was made in June. I'll make some real objects in these, maybe 10 or some. Already, I ordered 4 pieces of objects to 3D print factory.
Subscribe to:
Posts (Atom)