0
$\begingroup$

Have a object (10 disks with 5 round holes in them). enter image description here

After selecting a cluster of vertex (total 4) the script need to: Move selected cluster down by 1mm Select next cluster (to the left) and move them down by 1 mm Select next cluster (to the left) and move them down by 2 mm Select next cluster (to the left) and move them down by 3 mm There are 30 cluster that must be moved down with each cluster down movement incremented by 1 mm enter image description here

Have selected cluster 1 manually and this script move them down. Need advice how to select cluster 2 to 14 with script.

import bpy
import bmesh

obj=bpy.context.object
if obj.mode == 'EDIT':
    bm=bmesh.from_edit_mesh(obj.data)
    for v in bm.verts:
        if v.select:
            print(v.co)
            bpy.ops.transform.translate(value=(-0, -0, -0.000100000), orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(False, False, True), mirror=True, use_proportional_edit=False, proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False, use_proportional_projected=False, release_confirm=True)
else:
    print("Object is not in edit mode.")

Script result
<Vector (-0.0707, -0.8295, 0.3396)>
{'FINISHED'}
<Vector (0.1693, -0.8295, 0.3395)>
{'FINISHED'}
<Vector (-0.1707, -0.8294, 0.3394)>
{'FINISHED'}
<Vector (0.0693, -0.8294, 0.3393)>
{'FINISHED'}
$\endgroup$
1
  • $\begingroup$ first glance: Don't use operators. Especially not ones that include "release confirms", there is no release in script. I haven't tested, otherwise I'd post as answer: v.co -= Vector((0,0,-0.001))<br> v.co.z -= 0.001 might also work you're moving 1/10mm in your script. $\endgroup$ Nov 10, 2023 at 17:04

0

You must log in to answer this question.

Browse other questions tagged .