Notifications
Clear all

[Closed] How to get some face which have two Smoothing Groups at least?

Hi ,

I want to find some face which have two Smoothing Groups at least, how to find them use script :
like this…

7 Replies

I have wrote this script 4 years ago, when I was learning maxscript. I think it could help, but it work only in max 6,7,8 and maybe 9. But not working in max 10 and +, because it was depending of a plugin for buttons coloration when we where in visual smoothing edition. I was planning to rewrite all the script to make it work in newer version of max and stop to need the powerbutton plugin. Well, wich it could help. at least, their is a fonction in the ms file that select all faces with more than 1 smoothing group and also on to get all faces with no smoothing groups assigne.

The tool
POLYSHARP
The plugin needed.
PowerButton

1 Reply
(@perfectboy)
Joined: 11 months ago

Posts: 0

Hi Myanko,i’m very glad with your replay,and i’m learning script now.

I’ll learn your script carefully.

Thank you very much, and hopping your new version script…


fn collectMultiSmoothGroupFaces node:selection[1] sel:on = if iskindof node Editable_Poly do
(
 faces = #{}
 for f in (node.faces as bitarray) do
 (
  sg = polyop.getFaceSmoothGroup node f
  bits = 0
  for k=1 to 32 while bits < 2 where (bit.get sg k) do bits += 1
  if bits > 1 do append faces f 
 )
 if sel do node.selectedfaces = faces
 faces
)

Hi Tina,
here is a code to collect faces in an Editable Poly object which have more than one smoothing group assigned.

(
    function intToBitArray iNum =
    (
        if ((classOf iNum) == Integer) then
        (
            local baBits = #{}

            for i = 1 to 32 do
            (
                if (mod iNum 2 != 0) do
                (
                    baBits[i] = true
                    iNum -= 1
                )
                iNum /= 2
            )
            return baBits
        )
        else
        (
            return false
        )
    )

    if ( (selection.count == 1) and ((classOf selection[1]) == Editable_Poly) ) do
    (
        local oPoly = selection[1]

        local iSmoothingGroups = 0
        local baFaces = #{}

        for iFace = 1 to (polyOp.getNumFaces oPoly) do
        (
            iSmoothingGroups = polyOp.getFaceSmoothGroup oPoly iFace
            baSmoothingGroups = intToBitArray iSmoothingGroups

            if (baSmoothingGroups.numberSet > 1) do
            (
                baFaces[iFace] = true
            )
        )

        print baFaces
    )
)
  • Enrico

A bit late, a slightly different solution.

1 Reply
(@perfectboy)
Joined: 11 months ago

Posts: 0

Hi guys…What intelligent you are…
Thank you very much ‘myanko’,‘denisT’,and ‘Enrico’… and i received them.

With your help, i solved my problem.
:applause:

Great, I’m glad that it was helping.

I finished updating my script. You can see a video showing how it work.

http://www.myanko.com/downlaods/maxscripts/polysharp.html

You can also get the .net version for 3dsmax 9 and more by downloading the version 0.4
http://www.myanko.com/assets/files/ScriptDownloads/polysharpdotnet//POLYSHARPDOTNET_0.4.rar