Can Python Automate This Scenario?

Can blender python automate steps 2 - 3:
Goal: loop through each flat mesh object in scene, extrude the edges to some length. End result is a hollow 3D shape (like a fence or cylinder) with faces on edges not top or bottom.

  1. Import DXF resulting in 100’s of flat mesh objects
  2. Select object, extrude, choose Edges, loc to z, drag 10 blender units.
  3. Select next shape
  4. Repeat steps 2 - 3 for all objects in blender scene

Nils Wallerstedt
[email protected]

Yes, but there’s probably an easier way.
If the objects are all the same then use dupliverts or duplifaces or an array modifier (say for a fence)
if they’re different join all the objects, then select all (a key) extrude ten units. select top or bottom face on the object then press shift-g to select faces with a similar direction and delete the tops/bottoms. Of course this is assuming a lot… but I hope it helps a little.

Interesting challenge, I took a go at it. Here’s what i came up with, only first draft. Would something like this be what you need, nilserikw? If so, I can make it into a script that is accessible from the menu, and that has a popup where you can set the extrude height.

Make sure to apply scale/rot to all objects first (select your objects, ctrl+a -> “Scale and Rotation to Obdata”)

import Blender

limit = 0.001   # limit for remove doubles
ex = 10         # extrude length

scn = Blender.Scene.GetCurrent()
obs = [ob for ob in scn.objects.selected if ob.type == "Mesh"]
exvec = Blender.Mathutils.Vector([0, 0, ex])

editmode = Blender.Window.EditMode()
if editmode:

for ob in obs:
    me = ob.getData(mesh=True)
    edges = me.edges
    faces_ext = []
    for edge in edges:
        me.verts.extend([ + exvec, + exvec])
        faces_ext.append([edge.key[0], edge.key[1], me.verts[-1].index, me.verts[-2].index])


hi Nils, hi gentlemen,
i dont know what DXF entities should be imported, but if they LINEs or POLYLINEs, then you need only the first step:

Start DXF-importer script (current version 1.12 - 2008.08.03),
go to Advanced Configuration dialog
set output to “mesh”
set [thick: off], [F: on], [value=10.0]
and fire.
The result should be exactly what you wish.

Short explanation: [F] forces element’s hight to chosen value (10 units). More details on Manual Page

let me know if it works for you.

Hehe migius, I didn’t know your dxf exporter already does this, that’s great. Well, my little script was a nice exercise anyway.

hi Nils, hi gentlemen

Just for the record, I’m neither, but I’m sure you included me as well in spirit. :slight_smile:

Sanne, to add this functionality was not my invention, but a part of DXF specification that should be supported. Well, i have programed some extensions here and there, hehe

Wow, Looks pretty neat. Is this a Python script? How is it called?
[email protected]
Everybody wants to Rule the World