I'm trying to create a script for automatic handrails. For extruding my edges I have tried converting them to curve and applying bevel, however I'm not satisfied with results, I wish the top rail wasn't rotated 45 degrees, and all beams were equal sizes (first and last are thinner at the top). I struggle with changing that, and I am not sure if thats the best approach to my problem. As pictured I would like to have something more square. I have also tried applying skin on edges, however the results were somehow worse than this.
Convert to curve + bevel:
Here's what I would like to achieve:
My script for reference, Maybe someone will find it useful, It just automates part of the work
# Creates vertical bars (edges) on selected vertices in edit mode
import bpy
import bmesh
from mathutils import Vector
beam_height = 1
obj = bpy.context.object
bpy.ops.object.mode_set(mode = 'OBJECT')
verts_ind = [i.index for i in obj.data.vertices if i.select]
bpy.ops.object.mode_set(mode = 'EDIT')
for index, i in enumerate(verts_ind):
local_co = obj.data.vertices[i].co
transformed_co = Vector((local_co.x, local_co.y, local_co.z + beam_height))
bpy.ops.object.mode_set(mode = 'OBJECT')
Verts = [local_co, transformed_co]
Edges = [[0, 1]]
profile_mesh = bpy.data.meshes.new("Edge")
profile_mesh.from_pydata(Verts, Edges, [])
profile_mesh.update()
bpy.ops.object.mode_set(mode = 'OBJECT')
profile_object = bpy.data.objects.new("Base_Profile", profile_mesh)
bpy.context.collection.objects.link(profile_object)
bpy.ops.object.mode_set(mode = 'OBJECT')