a lot of questions

I got an object with thousands of points,I have selected some points (assume 1000 random points)

what I want is:
1-make a selection for the first connected vertices to my old selection (so if each vertex got some edges,pick first edge for each vertex and select the other vertex of that edge,and deselect old selection)

2-make an armature with thousands of bones (equals to the number of selected vertices),position each bone to each selected vertex,assign a bone weight to each vertex in selection (so I can control each vertex with it is corresponding bone)

  1. BMEdge.other_vert(vert) ? Real bmesh walkers are not available to python, but you may wanna check the C-code how it’s done.

  2. What is your question? Seems simple to do, Object.matrix_world * Vert.co for global space coord, move edit bone tails there and add vertex groups to the mesh and assign weight: VGroup.add((Vertex.index,), 1.0, ‘REPLACE’)

You could also parent individual bones to the vertices, then do another armature with bone constraints to copy transforms.

1- we can neglect this for now
2- I want to know just (the add bone function,I will loop and get data I want after that,and about the VGroup;should I assign the bone name to it?and how)

:slight_smile:

import bpy

ob = bpy.context.object
me = ob.data

bpy.ops.object.armature_add(enter_editmode=True)
arma = bpy.context.object
arma.location = (0,0,0)
arma.data.draw_type = 'STICK'
edit_bones = arma.data.edit_bones
root_bone = edit_bones[0]
bones = []

for v in me.vertices:
    bone = edit_bones.new("")
    bone.parent = root_bone
    bone.use_connect = True
    bone.tail = ob.matrix_world * v.co
    bones.append(bone)
    
bpy.ops.object.mode_set(mode='POSE')

for b, v in zip(bones, me.vertices):
    vgroup = ob.vertex_groups.new(b.name)
    vgroup.add((v.index,), 1.0, 'REPLACE')
    
mod = ob.modifiers.new("", "ARMATURE")
mod.object = arma

thanks a lot for your help and time :slight_smile:

I have just tested it :D,worked like a charm,amazing :slight_smile: