#!BPY
“”" Registration info for Blender menus:
Name: ‘Merge Verticies within XY Plane’
Blender: 237
Group: ‘Mesh’
Tooltip: ‘Merge Verticies within X-Y Plane’
“”"
author = “Michael Tiemann”
url = (“blender”, “elysiun”)
version = “1.0 2006-10-30”
bpydoc = “”"
This script merges all selected points to the X-Y coordinates of the
first point selected. Z values are unaffected.
“”"
***** BEGIN GPL LICENSE BLOCK *****
Copyright © 2006 Michael Tiemann
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
***** END GPL LICENCE BLOCK *****
--------------------------------------------------------------------------
from Blender import *
def main():
scn = Scene.GetCurrent()
ob = scn.getActiveObject() # Gets the current active object (If Any)
if ob == None or ob.getType() != 'Mesh': # Checks the active objects a mesh
Draw.PupMenu('ERROR%t|Select a mesh object.')
return
Window.WaitCursor(1) # So the user knowns the script is buisy.
is_editmode = Window.EditMode() # Store edit mode state
if is_editmode: Window.EditMode(0) # Python must get a mesh in object mode.
me = ob.getData()
#================#
# EDIT MESH HERE #
#================#
v0 = 0
for v in me.verts:
if v.sel: # Operating on selected verts is what the user expects.
if v0 == 0:
v0 = 1
x = v.co.x
y = v.co.y
else:
v.co.x = x
v.co.y = y
#================#
# FINISH EDITING #
#================#
me.update() # Writes the mesh back into Blender.
# Go back into editmode if we started in edit mode.
if is_editmode: Window.EditMode(1)
Window.WaitCursor(0)
if name == ‘main’: # Dont run the script if its imported by another script.
main()