Announcement

Collapse
No announcement yet.

Script to remove double faces

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Script to remove double faces

    Looking for a script that will check the object for duplicated geometry and remove it.
    I did a search on www.scriptspot.com but only script came out from there was for max 4 and it doesnt work in 9.
    Any one has a clue?
    Dmitry Vinnik
    Silhouette Images Inc.
    ShowReel:
    https://www.youtube.com/watch?v=qxSJlvSwAhA
    https://www.linkedin.com/in/dmitry-v...-identity-name

  • #2
    I'm planning on writing one soon, do you mean it on a singular object with coinstanced faces or a duplicated object that is on top of each other?
    Colin Senner

    Comment


    • #3
      its basically a copy of the object which is attached on the component level and is in the same space. It can be cleaned out by selecting each shell and deleting it, but it has way too many pieces to do it by hand.
      Dmitry Vinnik
      Silhouette Images Inc.
      ShowReel:
      https://www.youtube.com/watch?v=qxSJlvSwAhA
      https://www.linkedin.com/in/dmitry-v...-identity-name

      Comment


      • #4
        It's not a trivial task by any stretch of imagination, Morbid.
        Max only passes vertex/face numbers.
        You can have it select an element which is attached to a face, or vertex, or edge.
        But in no case there's a direct way to know what that element is.
        What would need to be done would be to iterate through all the faces of an element and see which face has its points lying on the exact same coordinates.
        But then, who's to say the iteration doesn't delete a face for one element, and the next coincident one from the next element?
        Sure, in theory vertex/face numbers are progressive, but it's not always so, particularly for meshes imported from other softwares.
        It's probably a lot quicker to do it by hand.
        Then again, my algorithmic skills are close to zero, so someone with a bit more insight might have better luck.
        Lele
        Trouble Stirrer in RnD @ Chaos
        ----------------------
        emanuele.lecchi@chaos.com

        Disclaimer:
        The views and opinions expressed here are my own and do not represent those of Chaos Group, unless otherwise stated.

        Comment


        • #5
          My take would be to store each face (if morbid wanted to do it on a sub-object level) in an array and compare between members of the array for coinstanced faces. I think that would work, but then again if it's that easy why hasn't someone done it...
          Colin Senner

          Comment


          • #6
            Morbid,

            Here is Bobo's script form max3, I think, but I slightly modified it and it works in max 9 (32). Be carefull if you use it on high-vertex-count objects. Break up into smaller chunks if necessary.
            Appart from that, works great.

            All credit goes to the genius of Bobo. He is a great guy. Once I asked him to modify one of his scripts for me and he did it the very next day!!
            I think he is from Bulgaria too, so it looks like there is some serious software breeding going on in there, he he.

            Hope this might help.

            Zoran


            Edit:


            I uploaded script. Please rename txt to ms and put into Scripts folder
            Attached Files
            Last edited by zoranm; 19-03-2008, 09:18 PM.

            Comment


            • #7
              Thanks!
              But when I try to run it, I get error:

              >> MAXScript FileIn Exception: -- Syntax error: at [, expected name
              -- In line: checkbutton extract_faces "EXTRACT DoubleFaces" width:140 checked:false highlightcolor[1 <<
              Dmitry Vinnik
              Silhouette Images Inc.
              ShowReel:
              https://www.youtube.com/watch?v=qxSJlvSwAhA
              https://www.linkedin.com/in/dmitry-v...-identity-name

              Comment


              • #8
                Did you copy and paste the smiley face
                LunarStudio Architectural Renderings
                HDRSource HDR & sIBL Libraries
                Lunarlog - LunarStudio and HDRSource Blog

                Comment


                • #9
                  haha...I just grabbed the whole thing without looking!
                  thanks. However the script does not work. It checks double mesh and reports there are no redundant faces. Though there are.
                  Dmitry Vinnik
                  Silhouette Images Inc.
                  ShowReel:
                  https://www.youtube.com/watch?v=qxSJlvSwAhA
                  https://www.linkedin.com/in/dmitry-v...-identity-name

                  Comment


                  • #10
                    Originally posted by Morbid Angel View Post
                    haha...I just grabbed the whole thing without looking!
                    thanks. However the script does not work. It checks double mesh and reports there are no redundant faces. Though there are.
                    Script can only check verteces within an object where duplicate verteces are welded and share the same co-ords, on a face by face level.
                    For example: if you have 2 same cubes, with welded verteces the face count = 24. After running the script it'll change to 12 faces.

                    It'd be nice, though, if someone could expand script and include some sort of tolerance between verteces.

                    I edited the first post and uploaded the original script. Funny thing is that whenever there was an ": (" combination, editor replaced it with the ! He he

                    Good luck

                    Zoran

                    Comment


                    • #11
                      In order to post code you need to use the code bb tags :

                      Code:
                      This is some serious code : (
                      Regards,
                      Thorsten

                      Comment

                      Working...
                      X