ScriptSpot

Forum topic · Scripts Wanted

weld vertex just in elements - not elements together

By tomastnt · 2010-10-23

Description

Hi
Are there any script for velding vertex just in elements? For example... I modeled a big plant, but I have made a leaves with small gape (my mistake) And now, i would like just weld vertex in many elements, because leaves are editable poly elements, but i don't want to weld leaves with trunk together or leaves together. Leaves are very close together :(
I have tried ZORB script, but welding seems like doesn't work...welder modifier as well...:(
Are there any ideas ? Thx buddies.

Comments (5)

Graph · 2010-10-24

if you use the listener select the whole script and hit shift+enter

tomastnt · 2010-10-24

owesome :) works! THX

detaching elements will help

Anubis · 2010-10-23

Hi Tomas,
as you say the leaves are very close together, I think detaching elements will help. You can detach quickly all elements using my Detach Elements script. You can process all leaves of the entire forest with it assistance. (btw I have a good reports by Xfrog about this script)

The next step would be to weld detached objects by loop through them. Here is a weld code snippets for poly and mesh objects:

-- for editable poly
for obj in selection do ( -- loop through selected objects
	obj.weldThreshold = 8.0 -- set weld threshold value
	allVerts = #{1..(polyop.getNumVerts obj)} -- get all verts list
	polyop.weldVertsByThreshold obj allVerts -- Weld
)

-- for editable mesh
for obj in selection do ( -- loop through selected objects
	thresh = 4.5 -- weld threshold
	allVerts = #{1..(obj.numVerts)} -- get all verts list
	meshop.weldVertsByThreshold obj allVerts thresh -- Weld
)

tomastnt · 2010-10-24

Maybe call me a stupid, but script witch you sent doesn't work. I have just puted the part of script for editable poly to the max listener,then selected 5 object in editable poly format and then ENTER in max script listener. Script writed this:

-- Syntax error: at ), expected
-- In line: )

so...I am sure, I am doing something wrong. But what?
THX Tomas

not afaik

Graph · 2010-10-23

but doing it by hand for 1 plant wont be a problem

-go into element subObjectLevel
-select an element
-hold ctrl
-go into vertex subObjectLevel (not per keyboard, use the mouse & keep holding ctrl)
-now weld the verts by threshold
-next element