how do I add a vert at origin to an existing mesh
im using
scn = bpy.data.scenes.active
obj = scn.objects.active
me = obj.getData(False, True)
me.verts.extend(0,0,0)
but nothing is added- where am i going wrong
how do I add a vert at origin to an existing mesh
im using
scn = bpy.data.scenes.active
obj = scn.objects.active
me = obj.getData(False, True)
me.verts.extend(0,0,0)
but nothing is added- where am i going wrong
Hi,
To get the mesh of an object I use me = ob.getData(mesh=1) rather than me = obj.getData(False, True). Sooo this:
scn = bpy.data.scenes.active
ob = scn.objects.active
me = ob.getData(mesh=1)
me.verts.extend(0,0,0)
adds a vertex at (0,0,0) to the mesh of selected object BUT if the point with coordinates (0,0,0) is inside your object => you will NEVER see the new vertex! Also… even (0,0,0) is outside your body, you’d able to see the new vertex only in edit mode with ALL verts selected
Regards,
just select one vert and Shift-D to duplicate to it, then you can use some deleting and F to get what you need
Brados… the idea is to do THIS by a script.
It’s clear what to do with 1-2 verts… But what about 1000 verts??? :rolleyes:
Regards,
thats correct, I am trying to figure out how to add one point for simplicity sake, at the origin so I know where to look for it… and then write more complex scripts after that…
I tried the code you added,
scn = bpy.data.scenes.active
ob = scn.objects.active
me = ob.getData(mesh=1)
me.verts.extend(0,0,0)
but im still not getting a vertice added- and even if I select all verts, the top right side of the screen is only counting the existing verts- is there no posting back to blender that needs to happen, or something like that perhaps
ok iv noticed something odd- this script works if you run it in object mode, and then switch to edit mode??
Yes, that’s right. So you’d need the following:
from Blender import *
import bpy
editmode = Window.EditMode()
if editmode:
Window.EditMode(0)
else:
Window.EditMode(1)
scn = bpy.data.scenes.active
ob = scn.objects.active
me = ob.getData(mesh=1)
me.verts.extend(0,0,3)
if editmode:
Window.EditMode(1)
else
Window.EditMode(0)
Entering and going out (or vise versa) of EDIT mode updates the mesh so changes are displayable. Pls note that the above works with object’s local coordinates and normally (0,0,0) is either inside the body or used by a vertex already. So I used (0,0,3) for the new vertex => if you use the default cube it will be a vertex 2 blender units ABOVE the cube’s top face
thats it!! thanks for the help I appreciate it!