Thanks for having a look! My aim is to extrude an x number of planes (selected_objects) along the z-axis through a for loop. The planes will be imported and variable in number.
Here are two pictures, the before and after. The second picture is the desired outcome. The amount of Planes are 500+ that must undergo this procedure. It would be great if this can be controlled through a for loop.
However, I’ve been at it for some time now, but it doesn’t want to work the way I wish to. I broke everything down into functions, look at the order of executing the extrusion…anyways, thanks for your time.
well the extrude operator you use is actually a macro, which needs to be called differently.
Here’s my approach:
import bpy
bpy.ops.mesh.primitive_plane_add()
ob = bpy.context.object
scene = bpy.context.scene
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.extrude_region_move(MESH_OT_extrude_region={}, TRANSFORM_OT_translate={"value":(0, 0, 0.1)})
bpy.ops.object.mode_set(mode='OBJECT')
obs = []
for i in range(1, 21):
ob_new = ob.copy()
obs.append(ob_new)
ob.location.z = i * 0.5
for ob in obs:
scene.objects.link(ob)
scene.update()
Ah, so macro operations don’t run in for loops. The pictures I uploaded were made quickly are not the actual work, sorry if I was unclear. The planes are actually images planes and are already imported on the scene. So a generic plane add and copy is not really working in this situation. I tried to convert to mesh to curve and do a curve extrude (o.extrude). This kinda of worked, but the object loses the images. I was also looking into Bmesh and extrude with Vector, but that hasn’t paid of yet. Any idea how to tackle this? Thanks for any help.