Weld Script for 3DS Max

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

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
barigazy's picture

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

bga

eyepiz's picture

Thanks!

Thanks for the script!

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

I really appreciate the help.

-Eric

barigazy's picture

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

bga

eyepiz's picture

Thanks...

I am getting this error when running the script.

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

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.