Announcement

Collapse
No announcement yet.

Maxscript help - weld vertices

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

  • Maxscript help - weld vertices

    Hello maxscript genuises!

    looking for a script that will do the following nice and quickly:

    - take 1 or several editable meshes
    - weld vertices (with a low threshold of 0.01 or 0.001 - doesnt need to have a UI)
    - auto smooth the geometry with a value of 30

    thats it!

    it can convert them to editable poly if thats easier/quicker, the main thing is that all scripts I have found take ages on heavy geometry
    www.peterguthrie.net
    www.peterguthrie.net/blog/
    www.pg-skies.net/

  • #2
    The welding is what takes ages! Especially on heavy geometry. I deal with a lot of engineering data and some of the more complex pieces can take upwards of two (2) hours to weld with a threshold of 0.001. So I usually end of having about 4-5 copies of max running on my computer welding different pieces and then merging them all together.

    I would be interested in a similar script as well. So I'm interested in how this turns out.
    Troy Buckley | Technical Art Director
    Midwest Studios

    Comment


    • #3
      Code:
      -- TYPE IN YOUR WELD VALUE HERE
      
      theWeldThresh = 0.1
      
      -- TYPE IN YOUR SMOOTH ANGLE HERE
      
      theSmoothAngle = 30
      
      
      theMeshes = selection as array
      
      for i = 1 to theMeshes.count do
      (
      	
      	theWeldMod = Welder threshold:theWeldThresh weldMethod:0
      	
      	--theWeldMod.threshold = theWeldThresh
      	--theWeldMod.weldMethod = 0
      	
      	addModifier theMeshes[i] theWeldMod
      	
      	theSmoothmod = smooth autosmooth:on threshold:theSmoothAngle
      		
      	addModifier theMeshes[i] theSmoothmod
      	
      )
      That'll do it, but you can also use the welder modifier - it's for welding cloth that's to be ripped in a cloth sim later but it's the same command as weld in edit poly or mesh. Then the smooth modifier. You can select all your objects and just apply these two modifiers and get them as instances if one value will work for the lot!

      Comment


      • #4
        thanks John, very useful!

        for some reason, having 'don't weld sel edges' unticked seems to work better (in that it doesnt make otherwise invisible edges visible) how would we add that in to the magical recipe?

        and at the end, could it collapse to editable poly?
        www.peterguthrie.net
        www.peterguthrie.net/blog/
        www.pg-skies.net/

        Comment


        • #5
          actually the bit about 'don't weld sel edges' might not be accurate. < EDIT: It is

          Man, I wish 3dsmax didnt insist on only using 2% of the available processor power for things like this!!!!!!!
          Last edited by peterguthrie; 23-04-2015, 07:48 AM.
          www.peterguthrie.net
          www.peterguthrie.net/blog/
          www.pg-skies.net/

          Comment


          • #6
            what I have done in the past, is convert an editable mesh to editable poly, and then weld vertices in the editable poly options, it seems to be MUCH faster.

            Would converting to editable poly in the script speed things up?
            www.peterguthrie.net
            www.peterguthrie.net/blog/
            www.pg-skies.net/

            Comment


            • #7
              Yeah, maxscript operations aren't multithreaded. ;/

              What usually speeds up the calculation is to switch off undo and switch to the create panel, also disable viewport updates.
              Code:
              max create mode
              with redraw off(
              undo off (
              --code here
              )
              )
              Rens Heeren
              Generalist
              WEBSITE - IMDB - LINKEDIN - OSL SHADERS

              Comment


              • #8
                Code:
                -- TYPE IN YOUR WELD VALUE HERE
                
                theWeldThresh = 5.0
                
                -- TYPE IN YOUR SMOOTH ANGLE HERE
                
                theSmoothAngle = 30
                
                
                theMeshes = selection as array
                
                max create mode
                
                with redraw off
                (
                undo off 
                (
                
                for i = 1 to theMeshes.count do
                (
                	
                	theWeldMod = Welder threshold:theWeldThresh weldMethod:0 dontWeldSelectedEdges:off
                	
                	--theWeldMod.threshold = theWeldThresh
                	--theWeldMod.weldMethod = 0
                	
                	addModifier theMeshes[i] theWeldMod
                	
                	
                	theSmoothmod = smooth autosmooth:on threshold:theSmoothAngle
                		
                	addModifier theMeshes[i] theSmoothmod
                	
                	convertTo theMeshes[i] Editable_Poly
                	
                )
                )
                )
                Those bits and Rens' speed bits added.

                Comment


                • #9
                  Good geekery John!
                  Maxscript made easy....
                  davewortley.wordpress.com
                  Follow me here:
                  facebook.com/MaxMadeEasy

                  If you don't MaxScript, then have a look at my blog and learn how easy and powerful it can be.

                  Comment


                  • #10
                    What's the main advantage to using the welder modifier or the Weld Vertex modifier in this situation?

                    Just curious.
                    Troy Buckley | Technical Art Director
                    Midwest Studios

                    Comment

                    Working...
                    X