extruded circle from vertex a to vertex b

hi

how can i draw a an extruded circle from vertex a ( x1, y1, z1 ) to vertex b ( x2, y2 , z2 ) ?

so i draw the circle at vertex a:
bpy.ops.mesh.primitive_circle_add(vertices=16, radius=0.02, fill=True, view_align=False, enter_editmode=False, location=( x1, y1, z1 ), rotation=(0.0, 0.0, 0.0))

but how do i extrude to vertex b ?

thanks for any help
sc3*2


import bpy
from mathutils import Vector

# exectute while in object mode with nothing selected.
# no rotation
myVec1 = Vector((0,0,0))
myVec2 = Vector((0,2,1))
bpy.ops.mesh.primitive_circle_add(vertices=16, radius=0.42, fill=True, view_align=False, enter_editmode=False, location=myVec1, rotation=(0.0, 0.0, 0.0))
bpy.ops.object.editmode_toggle()
bpy.ops.mesh.extrude_region_move(MESH_OT_extrude={"type":'REGION'}, TRANSFORM_OT_translate={"value":myVec2})

thanks zeffii
that works

but there is still something i don’t understand

when i create for example a cube

and run the following code
the extruded circles don’t ‘follow’ the edges


 ob = bpy.context.object
    me = ob.data
    verts = me.vertices
    for e in me.edges:
        vs = e.vertices
        start = vs[0]
        end = vs[1]
        meshVertexStart = verts[start]
        meshVertexEnd = verts[end]
        
        startco = meshVertexStart.co
        endco = meshVertexEnd.co
        
        bpy.ops.mesh.primitive_circle_add(vertices=8, radius=0.03, fill=True, view_align=False, enter_editmode=False, location=startco, rotation=(0.0, 0.0, 0.0))
        
        bpy.ops.object.editmode_toggle()
        bpy.ops.mesh.extrude_region_move(MESH_OT_extrude={"type":'REGION'}, TRANSFORM_OT_translate={"value":endco})
        bpy.ops.object.editmode_toggle()

thanks for any help
sc3*2

I think you need a vector from the edge to make your extrusion… and also rotate the circle before doing that… Try this change to your code, it even worked on a monkey :wink: -there may be better ways I completly ignore, it would be nice to know some math- edit: it should work now


import bpy, mathutils
ob = bpy.context.object
me = ob.data
verts = me.vertices
for e in me.edges:
    vs = e.vertices
    start = vs[0]
    end = vs[1]
    meshVertexStart = verts[start]
    meshVertexEnd = verts[end]
    startco = meshVertexStart.co
    endco = meshVertexEnd.co
    victor = endco - startco
    r = victor.angle((0,0,1))
    a = victor.cross((0,0,1))
    bpy.ops.mesh.primitive_circle_add(vertices=8, radius=0.03, fill=True, view_align=False, enter_editmode=False, location=startco)
    bpy.ops.object.editmode_toggle()
    bpy.ops.transform.rotate(value=[r], axis=a)
    bpy.ops.mesh.extrude_region_move(MESH_OT_extrude={"type":'REGION'}, TRANSFORM_OT_translate={"value":victor})
    bpy.ops.object.editmode_toggle()

thanks liero
works almost perfectly :slight_smile:

but how did you find this ?

    vector = endco - startco
    v = vector.angle((0,1,1))

and what does it actually do ?

thanks
sc3sc3

look like solidify edges
but it does only the top and bottom part not the edges on the sides!
and new top and bottom is disconnected !
so need to remove doulbe also i think!

is that what your trying to do ?

happy 2.5

yes indeed
looks and sounds like a solidified duck :slight_smile:

but why are the sides not done ?
are you going to add it ?

thanks

yes doubles can be removed
and the ‘joints’ where the extruded circles meet are a little messy

but other than that i don’t really know what you are talking about
what sides ?

regards
sc3*2

[ATTACH=CONFIG]141211[/ATTACH]do you see it

thanks

ok
that’s because of the angle of the circle where the extrusion starts
the angle between the direction of the extrusion and the surface of that circle is not 90 °
probably not that very hard to fix
but i don’t know how to do that right now

regards

Hi, I updated the code above so that it really rotates the circle before extruding… a simple way of geting similar results would be deleting faces and converting edges to curve, then adding bevel. But again, it is good to learn something new.

nice :slight_smile:
thanks