Advertisement
Guest User

Untitled

a guest
Sep 16th, 2011
694
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. -- Vertex Killer v1.0
  2. -- By Mauricio B. G.
  3. -- (10/03)
  4. --
  5. -- This tool will remove any SELECTED vertices that are shared by ONLY and EXACTLY 2 edges.
  6. -- Use: couldn't be more easy. Select a poly object, select some vertices and run the script.
  7. -- Installation: copy to max/ui/macrosript and put anywhere you want in max with the customize UI option.
  8. --
  9.  
  10.  
  11.  
  12. macroScript Vertex_Killer category:"MBG Tools" tooltip:"Vertex Killer 1.0 by MBG"
  13. (
  14.  
  15.  
  16.  
  17.  
  18. counter = 0
  19.  
  20.  
  21. if classof $ == Editable_poly then
  22. (
  23. if subobjectlevel == 1 then
  24. ( -- start the action
  25.  
  26. undo on(
  27. sel = polyop.getVertSelection $ -- get the selected vertices
  28. selcount = sel as array
  29.  
  30. for x = 1 to selcount.count do (
  31.  
  32. vi = selcount[x]
  33.  
  34. edg = polyOp.getEdgesUsingVert $ vi -- get the edges that use the vertice
  35.  
  36. quantos = edg as array
  37.  
  38. if quantos.count == 2 then (
  39.  
  40. polyop.setvertselection $ vi
  41.  
  42. counter = counter + 1
  43.  
  44. $.EditablePoly.Remove ()
  45.  
  46. for y = 1 to selcount.count do (
  47. -- we removed a vertice, so we need this
  48. selcount[y] = selcount[y] - 1
  49. )
  50.  
  51. ) -- end if
  52. ) -- end for
  53.  
  54. ) -- end undo
  55.  
  56. str = "Done. Vertices removed: " + counter as string
  57. messagebox str title:"MBG Vertex Killer"
  58.  
  59. )
  60. else messagebox "You should select vertices first." title: "MBG Vertex Killer"
  61. )
  62. else messagebox "The object selected isn't a editable poly or nothing is selected." title: "MBG Vertex Killer"
  63.  
  64. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement