Jump to content

script: Clean Obj (error)


postite
 Share

Recommended Posts

Hi. I want to use a simple maxscript because I import a lot of *.obj and I need to clean them.

 

I used maxscript Listener because it usually works like a charm and I'm not a maxscript guru :)

 

I want to:

 

1-Transform to poly edit

2-Be in poly

3-Select all poly

4-Clear all smoothing groups

5-Deselect all poly

6-Hide selection

 

 

Here is what I have:

 

macroScript Clean-obj

category:"DragAndDrop"

toolTip:"Clean Obj"

(

macros.run "Modifier Stack" "Convert_to_Poly"

subobjectLevel = 4

actionMan.executeAction 0 "40021"

$.EditablePoly.SetSelection #Face #{1..988}

$.EditablePoly.autosmooth ()

$.EditablePoly.setSmoothingGroups 0

subobjectLevel = 0

actionMan.executeAction 0 "223"

hide $

)

 

 

But I get an error message...

I would also like to apply a random color before hiding the object.

 

If somebody could help me :) ?

Thx

Link to comment
Share on other sites

Hello mate

 

I see when you're selecting the faces, does that not assume that the object has between 0-998 faces? I don't know if that's always the most faces you'll have, but the line...

 

polyop.setFaceSelection $ #all

 

will give you ALL the faces. Infact, this way, you also don't need to be in sub-object mode I believe, so you could probably delete some other lines but maybe it'd be best not to mess around with it!

 

With regards to the error, it suggests that it needs 3 arguments, whereas you've given it 1 ("3"). What might be easier is, instead of clearing them (which seems surprisingly tricky to do in maxscript), just assigning the auto-smooth an amount of 0 and then autosmoothing it.

 

For the colour, it's as simple as adding:

 

$.wirecolor = [(random 0 255),(random 0 255),(random 0 255)]

 

Anywhere in there.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...