With the mesh of the active object, I want to adjust a few edges selected randomly. For that I choose edges, split them in 3 parts and move the related vertices. I'm a beginner in Blender and Python, and would like to use the regular modules, not BMesh. I imagined that:

# Get edges and edge count
edges = mesh.edges
count = len(edges)

# Set EDIT/EDGE mode

# Pick a few random edges
picked = []
while (count > 0 and len(picked) < 6):
    # Get another random edge
    edge = random.choice(edges)
    if not edge in picked:
        # New edge, use it
        count -= 1

# Process picked edges
for edge in picked:
    # Select this edge only
    edge.select = True # Is this correct             <--- ?

    # Split edge in 3 parts

    # Get vertices of the 3 parts
    vertices = # how to do that?                     <--- ?

    # Process each vertex
    for vertex in vertices:
        # Do something with the vertex

# Return to object mode

Could you help me filling the 2 marked lines?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.