Announcement

Collapse
No announcement yet.

Is there a way (script) to select objects with similar amount of vertices...

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

  • Is there a way (script) to select objects with similar amount of vertices...

    ...as the selected object ?
    Regards

    Steve

    My Portfolio

  • #2
    Code:
    select (for o in objects where (getPolygonCount o)[2] == (getPolygonCount $)[2] collect o)
    try this quick and dirty one
    www.hofer-krol.de
    Visualization | Animation | Compositing

    Comment


    • #3
      How similar?
      Colin Senner

      Comment


      • #4
        Should be pretty self explainatory. Change "thresholdPercent" to be how similar you need the objects to be, 0 = no deviation in vert count, 0.03 = 3% deviation in vert count.


        Code:
        (
            local thresholdPercent = 0.01 -- Anything similar within 1% of the same vertices count will be selected
            
            local obj = GetCurrentSelection()
            
            if obj.count != 1 then (
                MessageBox "Please select one object."
                return false
            )
            
            obj = obj[1]
            
            local numverts = (GetPolygonCount obj)[2]
            local lowNum, highNum
            local selectArray = #()
            
            format "numverts: %\n" numverts
            
            max create mode
            
            for o in objects do (
                lowNum = ceil (numVerts - (numverts * thresholdPercent))
                highNum = floor (numVerts + (numverts * thresholdPercent))
                if ((GetPolygonCount o)[2] >= lowNum) and ((GetPolygonCount o)[2] <= highNum) then 
                    append selectArray o
            )
            
            select selectArray
        
        
        )
        Colin Senner

        Comment


        • #5
          Thanks a lot guys !
          Regards

          Steve

          My Portfolio

          Comment


          • #6
            Thanks again for these scripts. Is saving me a lot of time with this project
            Regards

            Steve

            My Portfolio

            Comment


            • #7
              no problem.
              Colin Senner

              Comment

              Working...
              X