Home Technical Talk

[3DS Max/MAXScript] Select faces with no smooth group

polycounter lvl 8
Offline / Send Message
mickeyvpn polycounter lvl 8
Hello guys!

I want to make a script that select faces with no SG on selected Editable poly objects and and then perform auto smooth for those faces.
For the start I tried to get an array of faces with polyop.getFaceSmoothGroup but it gives me a bunch of errors in Listener.

Hope you can give me advise how to accomplish that!


Replies

  • Swordslayer
    Offline / Send Message
    Swordslayer interpolator
    For not showing your code nor the errormessages you're getting, you could pretty much get a 'you're doing something wrong'-type answer. Anyway, since it's a straightforward piece of code...

    for obj in selection where isKindOf obj Editable_Poly do<br>(<br>&nbsp;&nbsp;&nbsp; local numFaces = polyop.getNumFaces obj<br>&nbsp;&nbsp;&nbsp; local unsmoothedFaces = for face = 1 to numFaces where polyop.getFaceSmoothGroup obj face == 0 collect face<br>&nbsp;&nbsp;&nbsp; polyop.setFaceSelection obj (unsmoothedFaces as bitArray)<br>&nbsp;&nbsp;&nbsp; polyop.autosmooth obj<br>)

  • mickeyvpn
    Offline / Send Message
    mickeyvpn polycounter lvl 8
    Hey @Swordslayer

    Your code works like a charm! It's nothing but a magic!
    Actually I didn't had any code written at the start of the topic, just a bunch of separate commands that I tried to stitch together.
    Stumbled on this place(showing on your code):
    local unsmoothedFaces = for face = 1 to numFaces where polyop.getFaceSmoothGroup obj face == 0<span> collect face</span>
    Didn't know how to collect those faces that haven't SG. But now I know, thanks to you! :)
    I'll study this code closely, thank you very much!

Sign In or Register to comment.