New script: parallel offset

While playing with AutoCad a while back, I discovered the offset tool and how it works with polygons. Since then, I’ve wanted a “scale” tool in blender that does something similar. The normal scale keeps angles and relative edge proportions, but the distance between edges is not constant. The shrink/flatten tool, while working with vertex normals, can destroy both. So, I came up with this cumbersome precision tool that does what I want it to: offset each edge a specified distance, preserving angles and edge parallellity (is that even a word?).

It is much more complicated than it needs to be. Oh well, it was a nice coding exercise, and will be easier to expand later.

The script:
http://members.isp.com/[email protected]/redfox/files/offset_01.py

An example .blend:
http://members.isp.com/[email protected]/redfox/files/offset_01_example.zip
[edit: the above link was incorrect, it should work now]

Feel free to post or e-mail me any questions or suggestions.

Have fun!
Levi

Excellent script man! I hope this will continue to be refined, and make its way into CVS!

There’s already some code to do that in Blender for the Bevel function. If you plan on having this builtin, you could use that.
IIRC, the function name is somewhat criptic (my fault) so I could look it up for you if you want.

Martin

There’s already some code to do that in Blender for the Bevel function. If you plan on having this builtin, you could use that.
IIRC, the function name is somewhat criptic (my fault) so I could look it up for you if you want.

Well, I haven’t even touched the blender source code yet, so it may be a while before I can create any builtin tools. Also, the bevel function uses a per-face algorithm (at least I assume it does). In other words, all the edges are offset twice along a predefined plane. I wanted something that could offset once along any plane (because an arbitrary “wire frame” mesh doesn’t necessarily have a well defined plane). This isn’t always possible, as I found out, and its applications to an arbitrary 3d mesh (with faces) are somewhat complex.

Also, the bevel tool doesn’t always retain parallel edges. Try it with a non-planer quad to see what I mean.

Thanks!
Levi

The bevel tool uses a generic function that offset vertice (you feed it three sets of coordinates defining two edges joined at a corner and it returns the coordinates of the new corner equidistant from both edges). It uses that function to calculate the new faces, with added code for wrapping edges and all other funkyness,

Yeah, I know what you mean. I those case, we had to do a comprimise between edge paralelism and keeping the new faces as close to possible on the original place of the face.

Anyhow, if you ever feel like transfering your code to the source, just drop me an e-mail.

Martin