ScriptSpot home

Forum topic · Scripts Wanted

Weld large complicated meshes

By jininjin · 2012-11-10

Description

I need a script that can incrementally weld through large complicated meshes without crashing. Is this possible?

Comments (8)
Panayot Karabakalov

try this too

fn WeldMesh obj split: thresh: = (
	if thresh == unsupplied or thresh <= 0 do thresh = .01
	if split  == unsupplied or split < 1 do split = 1
	
	if not isKindOf obj Editable_Mesh do
		if canConvertTo obj Editable_Mesh do
			convertToMesh obj
		
	if isKindOf obj Editable_Mesh do (
		local _openEdges = meshop.getOpenEdges
		local _EdgeVerts = meshop.getVertsUsingEdge
		local _weldVerts = meshop.weldVertsByThreshold
		
		local vList = _EdgeVerts obj (_openEdges obj)

		if split == 1 then _weldVerts obj vList thresh
		else (
			-- your own implementation does here...
		)
	)
)
Reply to Panayot Karabakalov
Branko Živković

Hi Anubis,
Maybe i'm wrong but converting hires objects to mesh in this case can slow down the process.What do you think?

Reply to Branko Živković
Panayot Karabakalov

Yes, sure

But as the question was about meshes,
I just make the function user friendly.

Branko Živković

Do you mean attach hi-res meshes?

no not attaching meshes. I need to weld one large triangulated mesh. Welding as it is takes forever or crashes since there is a lot of vertices to weld.

Reply to jininjin
Branko Živković

weldByThreshold

This is the simple function that works on editable poly and mesh objects. Maybe this can help but not sure.

fn weldByThreshold thresh: = if selection.count != 0 do
(
local polyWeld = polyop.weldVertsByThreshold
local meshWeld = meshop.weldVertsByThreshold
for i = 1 to selection.count where isKindOf selection[i] Editable_Poly or isKindOf selection[i] Editable_Mesh do
(
vertslist = #{1..(selection[i].Verts.count)}
if not isKindOf selection[i] Editable_Poly then meshWeld selection[i] vertslist thresh else
(
selection[i].weldThreshold = thresh
polyWeld selection[i] vertslist
)
)
)
weldByThreshold thresh:0.01

Reply to Branko Živković
Branko Živković

Another recommended method is to detach your mesh in several parts, use this function on individual parts, then attach piece by piece select open edges and convert selection to vertex and then use weld operation from command panel. This is better then do it all at once.

Thanks I think this is what I will have to do. Make selections by a grid and weld small groups at a time. Although this may still take a long time....