1
# ##### BEGIN GPL LICENSE BLOCK #####
3
# This program is free software; you can redistribute it and/or
4
# modify it under the terms of the GNU General Public License
5
# as published by the Free Software Foundation; either version 2
6
# of the License, or (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software Foundation,
15
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
# ##### END GPL LICENSE BLOCK #####
20
InnerWeld. This addon welds parallel connected selected edges together.
24
First go to User Preferences->Addons and enable the InnerWeld addon in the Mesh category.
25
Go to EditMode, select some parallel edge(loop)(slices). Handles ALL edges parallel next to each other.
26
These edges will be welded together when invoking addon (button in Mesh Tools panel).
27
Innerweld will only work when in Edge select component mode!
29
If you wish to hotkey InnerWeld:
30
In the Input section of User Preferences at the bottom of the 3D View > Mesh section click 'Add New' button.
31
In the Operator Identifier box put 'mesh.innerweld'.
33
Save as Default (Optional).
39
"author": "Gert De Roost",
41
"blender": (2, 63, 0),
42
"location": "View3D > Tools",
43
"description": "Welding parallel edges together.",
57
class InnerWeld(bpy.types.Operator):
58
bl_idname = "mesh.innerweld"
59
bl_label = "InnerWeld"
60
bl_description = "Welding parallel edges together"
61
bl_options = {'REGISTER', 'UNDO'}
65
def poll(cls, context):
66
obj = context.active_object
67
return (obj and obj.type == 'MESH' and context.mode == 'EDIT_MESH' and list(context.tool_settings.mesh_select_mode) == [False, True, False])
69
def invoke(self, context, event):
71
bpy.ops.object.editmode_toggle()
72
bpy.ops.object.editmode_toggle()
74
self.do_innerweld(context)
76
bpy.ops.object.editmode_toggle()
77
bpy.ops.object.editmode_toggle()
82
def do_innerweld(self, context):
84
selobj = context.active_object
86
bm = bmesh.from_edit_mesh(mesh)
91
self.sellist.append(edge)
94
def addstart(vert, posn):
96
# recursive: adds to initial edgelist at start
97
for e in vert.link_edges:
99
self.sellist.pop(self.sellist.index(e))
100
v = e.other_vert(vert)
101
self.vertlist[posn].insert(0, v)
104
def addend(vert, posn):
106
# recursive: adds to initial edgelist at end
107
for e in vert.link_edges:
108
if e in self.sellist:
109
self.sellist.pop(self.sellist.index(e))
110
v = e.other_vert(vert)
111
self.vertlist[posn].append(v)
116
while len(self.sellist) > 0:
117
# initialize next edgesnake
118
self.vertlist.append([])
119
vert = self.sellist[0].verts[0]
120
self.vertlist[posn].append(vert)
121
# add to start and end of arbitrary start vert
132
for idx in range(len(self.vertlist)):
133
if len(self.vertlist[idx]) > 0:
136
vset.add(self.vertlist[idx].pop())
137
mergesets.append(vset.copy())
140
for edge in vert.link_edges:
143
v1 = edge.other_vert(vert)
144
for vlist in self.vertlist:
145
if v1 in vlist and not(v1 in mergesets[posn]):
146
mergesets[posn].add(v1)
148
self.vertlist[self.vertlist.index(vlist)].pop(vlist.index(v1))
153
bpy.ops.mesh.select_all(action = 'DESELECT')
156
mergeverts.append(vert)
157
bpy.ops.mesh.merge(type='CENTER', uvs=True)
172
def panel_func(self, context):
173
self.layout.label(text="InnerWeld:")
174
self.layout.operator("mesh.innerweld", text="Weld Edges")
178
bpy.utils.register_module(__name__)
179
bpy.types.VIEW3D_PT_tools_meshedit.append(panel_func)
182
bpy.utils.unregister_module(__name__)
183
bpy.types.VIEW3D_PT_tools_meshedit.remove(panel_func)
185
if __name__ == "__main__":