ScriptSpot home

Forum topic · General Scripting

Weld Script for 3DS Max

By Eric · 2012-10-22

Description

Hello,

I have a script to clean up imported objects from AutoCAD. I wanted to add an addition to weld the vertices and add an auto smooth of 30 after it removes the isolated vertices in the scripts below.

any assistance would be appreciated!

Thanks,

Eric

sel = getCurrentSelection()
for obj in objects do
(
if iskindof obj Editable_Mesh do (
select obj
meshOps.removeIsolatedVerts(obj)
)
)
clearSelection()
selectmore sel

Comments (4)
Branko Živković

try this one


sel = getCurrentSelection()
if getCommandPanelTaskMode() != #create do max create mode
with redraw off
(
for obj in objects where iskindof obj Editable_Mesh do
(
meshOps.removeIsolatedVerts(obj)
meshop.weldVertsByThreshold obj #{1..(obj.Verts.count)} 0.01
)
)
clearSelection()
select sel

Thanks!

Thanks for the script!

would it be possible to add an autosmooth of 30 after the weld?

I really appreciate the help.

-Eric

Reply to Eric
Branko Živković

with autosmooth


sel = getCurrentSelection()
if getCommandPanelTaskMode() != #create do max create mode
with redraw off
(
for obj in objects where iskindof obj Editable_Mesh do
(
meshOps.removeIsolatedVerts(obj)
meshop.weldVertsByThreshold obj #{1..(obj.Verts.count)} 0.01
meshop.autoSmooth obj #{1..(obj.Faces.count)} 30.0
)
)
clearSelection()
select sel

Thanks...

I am getting this error when running the script.

"-- Runtime error: Mesh vertex index out of range: < 1 or > 84: 85 <<"