how to select every other vertice

is there a way to loop select a bunch of vertices, but select every other one, or does that have to be done manually?

I’m fairly certain you have to do that manually.

If you’re going to be selecting them a lot, you could always create a new vertex group.

You mean like pressing Alt, then right-clicking a vertex to select a vertices loop, or what?

i’v seen a script that does that last year

anybody remember the names of this script ?

Salutations

yes, like alt+rmb will loop select, but how to select every other vertice.

for example, on this lighter i made http://blenderartists.org/forum/showpost.php?p=1416720&postcount=1

to make the ridges on the small circular piece, i had to manually select every other vertice, then resize it to make the jagged edge effect

Ok, I think I get it now.

Make sure “Occlude background geometry” button is off (it’s the cube at the far-right on the 3D View header), then simply use border selection (b, then select vertices with LMB).

Is that it?

no, like an easy way to make this type of selection rather than individually clicking the vertices, so i can bring them in, like you see in the 2nd picture

Attachments



but there might be a way to do this with subsruf or may be multire
where you can select the different level ?

but in ordinary blender don’t remember anything like that ?

it’s unusal to select like that !

Thanks

Probably one Python God, could make a script from this procedure:
Select a vertex.
New vertex group.
Assign
Select More [Ctrl NumPad +]
Deselect
New
Assign
Select More Ctrl NumPad +
Deselect
New … and so on :slight_smile:

Note! Making the sellection manually probably is faster, just to point at methods in Blender that can be accessed via Python

Edit: Here is the script that makes various “skipping vertices” selections
http://distroid.wordpress.com/2007/12/22/python-script-for-blender-select-every-nth-vertex-of-a-mesh/

is there a working copy of this script normaly formated so that it can work properly?

when you copy this into a py file you get so many errors !

Thanks

Try this one (I tried to format the source from the blog):


#!BPY
"""
Name: 'Select Every Nth Vert'
Blender: 244
Group: 'Mesh'
Tooltip: 'Selects every nth vertex of active mesh'
"""
#12/21/07 [email protected]

import Blender

from Blender.BGL import *
from Blender.Draw import *
from Blender.Window import *
from Blender.Mesh import *
import BPyMessages
import bpy

# Events
EVENT_NOEVENT = 1
EVENT_DRAW = 2
EVENT_EXIT = 3
global ator
global initator
initator=2
######################################################
# GUI drawing
######################################################
def draw():
	global ator, initator

	global EVENT_NOEVENT,EVENT_DRAW,EVENT_EXIT
	
	########## Titles
	glClear(GL_COLOR_BUFFER_BIT)
	glRasterPos2d(8, 103)
	Text("selection iterator")
	
	######### Parameters GUI Buttons
	glRasterPos2d(8, 83)
	Text("Parameters:")
	ator = Number("ator: ", EVENT_NOEVENT, 10, 55, 210, 18, initator, 2, 99, "Number to iterate by ");

	######### Draw and Exit Buttons
	Button("Draw",EVENT_DRAW , 10, 10, 80, 18)
	Button("Exit",EVENT_EXIT , 140, 10, 80, 18)

def event(evt, val):
	if (evt == QKEY and not val):
		Exit()

def bevent(evt):
	global ator,initator
	global EVENT_NOEVENT,EVENT_DRAW,EVENT_EXIT
	######### Manages GUI events
	if (evt == EVENT_EXIT):
		Exit()
	elif (evt== EVENT_DRAW):
		initator=ator.val
		theIteration()

Register(draw, event, bevent)

######################################################
# Main Body
######################################################
def theIteration():
	global ator
	iter=0
	t = Blender.sys.time()
	sce = bpy.data.scenes.active
	ob_act = sce.objects.active
	if not ob_act or ob_act.type != 'Mesh':
		BPyMessages.Error_NoMeshActive()
		return
	is_editmode = Blender.Window.EditMode()
	if is_editmode:
		Blender.Window.EditMode(0)
	Blender.Window.WaitCursor(1)
	theMesh = ob_act.getData(mesh=1)
	for v in theMesh.verts:
		iterator=iterator.val
		iter+=1
		if iterator==1:
			v.sel=1
		if iterator==0:
			v.sel=0

	if is_editmode:
		Blender.Window.EditMode(1)
	print 'My Script finished in %.2f seconds' % (Blender.sys.time()-t)
	Blender.Window.WaitCursor(0)
	Redraw()

I tried your script Jonathan, it crashes when I click the Draw button. I tried running it with the mesh in object mode and in edit mode, the same thing, crash.

Here is a related script I wrote for deleting every nth vertex. Maybe these two scripts can be merged together? I like your GUI approach, Jonathan, it makes it more of a tool.
http://blenderartists.org/forum/showthread.php?t=138346&highlight=nth+vertex

What does the console say when it crashes? BTW, this is not my script, I simply reformatted it from the blog posting Syziph mentioned above:)

A small correction (I was too eager cleaning up the code; sorry about that):


#!BPY
"""
Name: 'Select Every Nth Vert'
Blender: 244
Group: 'Mesh'
Tooltip: 'Selects every nth vertex of active mesh'
"""
#12/21/07 [email protected]

import Blender

from Blender.BGL import *
from Blender.Draw import *
from Blender.Window import *
from Blender.Mesh import *
import BPyMessages
import bpy

# Events
EVENT_NOEVENT = 1
EVENT_DRAW = 2
EVENT_EXIT = 3
global ator
global initator
initator=2
######################################################
# GUI drawing
######################################################
def draw():
	global ator, initator

	global EVENT_NOEVENT,EVENT_DRAW,EVENT_EXIT
	
	########## Titles
	glClear(GL_COLOR_BUFFER_BIT)
	glRasterPos2d(8, 103)
	Text("selection iterator")
	
	######### Parameters GUI Buttons
	glRasterPos2d(8, 83)
	Text("Parameters:")
	ator = Number("ator: ", EVENT_NOEVENT, 10, 55, 210, 18, initator, 2, 99, "Number to iterate by ");

	######### Draw and Exit Buttons
	Button("Draw",EVENT_DRAW , 10, 10, 80, 18)
	Button("Exit",EVENT_EXIT , 140, 10, 80, 18)

def event(evt, val):
	if (evt == QKEY and not val):
		Exit()

def bevent(evt):
	global ator,initator
	global EVENT_NOEVENT,EVENT_DRAW,EVENT_EXIT
	######### Manages GUI events
	if (evt == EVENT_EXIT):
		Exit()
	elif (evt== EVENT_DRAW):
		initator=ator.val
		theIteration()

Register(draw, event, bevent)

######################################################
# Main Body
######################################################
def theIteration():
	global ator
	iter=0
	t = Blender.sys.time()
	sce = bpy.data.scenes.active
	ob_act = sce.objects.active
	if not ob_act or ob_act.type != 'Mesh':
		BPyMessages.Error_NoMeshActive()
		return
	is_editmode = Blender.Window.EditMode()
	if is_editmode:
		Blender.Window.EditMode(0)
	Blender.Window.WaitCursor(1)
	theMesh = ob_act.getData(mesh=1)
	for v in theMesh.verts:
		iterator=iter % ator.val
		iter+=1
		if iterator==1:
			v.sel=1
		if iterator==0:
			v.sel=0

	if is_editmode:
		Blender.Window.EditMode(1)
	print 'My Script finished in %.2f seconds' % (Blender.sys.time()-t)
	Blender.Window.WaitCursor(0)
	Redraw()

there was no formating

and was not certain how to do it

too many levels of if ect…

don’t know why people bother to show unformated code

it’s so easy to set it up with the proper formating!

thansk i’ll test the code and see what heppenn

now i;v seen another script to select like that for line of vertices

but don’t remember name

now i’m uisng the note2 text editor with include py files type

and i got many error transfering it inside
don’t know why i’v done that very often and never had any problems before!

error on text characters ect…

i’v correctd most of it

but

i did a test and get an error on line88

saying that themsh is not define?

any idea how to corect that ?

Happy blendering

As the comment below the script says:

The weblayout is totally wrong
The indentation of Python has vanished
The quotes and dubbelqotes behave wrong, if copied (in FF) and pasted into an editor.

The corrected code works like charm.

The attachment below is the python file of the script, just replace .blend with .py extension and paste the file in your scripts folder.

Attachments

mesh_select_Nth_verices.blend (2.11 KB)

i tried to download twice and still get errors when opening file !

the file is not recognised as a normal blend file
there are errors in it !

try to upload again

appreciate your efforts

Thanks

You don’t read carefully :slight_smile:

working fine now

it is a fun script wish we had this as a modifier tool may be
would be great for modelling !

i hope Meta Androco has this one ?

would be nice to add up to the wiki list of scripts!

Thanks

I reworked the script over the weekend; the GUI is now a popup. I also cleaned up the code somewhat.


#!BPY
"""
Name: 'Select Every Nth Vert'
Blender: 249
Group: 'Mesh'
Tooltip: 'Selects every nth vertex of active mesh'
"""
#12/21/07 [email protected]

import Blender
import bpy
import BPyMessages


atorInput = Blender.Draw.Create(1)
if Blender.Draw.PupBlock(
	"Select every n-th vertex",
	[("Ator", atorInput, 2, 99, "Number to iterate by")]
):
	ator = atorInput.val
	obj = bpy.data.scenes.active.objects.active
	if not obj or obj.type != 'Mesh':
		BPyMessages.Error_NoMeshActive()
	else:
		is_editmode = Blender.Window.EditMode()
		if is_editmode:
			Blender.Window.EditMode(0)
		
		Blender.Window.WaitCursor(1)
		iter = 0
		for v in obj.getData(mesh=1).verts:
			iterator=iter % ator
			iter+=1
			if iterator==1:
				v.sel=1
			if iterator==0:
				v.sel=0
	
		if is_editmode:
			Blender.Window.EditMode(1)
		Blender.Window.WaitCursor(0)
		Blender.Draw.Redraw()

The problem is that the code (still) selects every n-th vertex without considering the mesh’s topology. So it only works reliably for simple meshes.

i think i wold suggest to sent a message to Meta Androco so that he can add this to the list of scripts in wiki pages

it’ an interesting one and might be usefull to other people too

Thanks