Forum Groups
  All forums
    Help & Feedback
      Questions
      Work in progress
      Finished Art
      Non-Max related
    Community
      Offtopic
      News
    Hardware
    Photography


Featured Threads
  inspiration alert!!!
(36 replies)
  Indespensible MaxScripts, Plugins and 3rd Party Tools
(37 replies)
  The allmighty FREE Resources Thread !
(17 replies)
  spam alert!!!
(4886 replies)
  Maxforums member photo gallery index
(114 replies)
  Maxforums Member Tutorials
(89 replies)
  three cheers to maxforums...
(240 replies)
  101 Things you didnt know in Max...
(198 replies)
  A Face tutorial from MDB101 :D
(95 replies)
  Maxforums.org Members Gallery
(516 replies)
  SON OF POST YOURSELF
(637 replies)
  Dub's Maxscript Tutorial Index
(119 replies)

Maxunderground news unavailable

Detach Poly sub elements
show user profile  FJMSoft
Hi there, I need to detach many sub elements from a edit poly modifier, but, if I select them all it detaches to a single object, if I select one by one It will take hours of working. How can I detach them all to single objects without losing much time?

Thanks.
read 1157 times
4/28/2008 9:47:19 PM (last edit: 4/28/2008 9:47:19 PM)
show user profile  mrgrotey
Convert it to an editable mesh, go into element mode, select everything, scroll down the modify panel to 'Explode', enter a value of 180 in the spinner box, adn click the Explode button, et voila!




read 1132 times
4/29/2008 2:38:06 AM (last edit: 4/29/2008 2:38:06 AM)
show user profile  Toen
If you have an Editable Poly object selected and run this script, it should remove all of the elements out as separate objects. The original poly containing them will be destroyed in the process.
To run the script open a new script window and copy/paste the code below into it and press Ctrl-e

polyObj=$ -- Editable poly to break apart
polyop.setFaceSelection polyObj #all -- set all of it's faces to selected

--Max functions stored to variables for faster lookup later
polysetFaceSelection=polyop.setFaceSelection
polygetNumFaces=polyop.getNumFaces
polygetElementsUsingFace=polyop.getElementsUsingFace
polygetFaceSelection=polyop.getFaceSelection
polygetVertsUsingFace=polyop.getVertsUsingFace
polydetachVerts=polyop.detachVerts
polySetFaceFlags=polyop.setFaceFlags

-- Give each new element object name of original poly appended with "_Element" and number from NameIncr
polyObjName=polyObj.name+"_Element"
nameIncr=0

while (polygetNumFaces polyObj)>0 do (--While there are still faces left in original poly
polyFaces=polygetFaceSelection polyObj -- get faces left in poly as bit array
loopFlag=true -- set loop flag to true
nameIncr+=1 -- increment naming number for new element object
newObjName=polyObjName+ nameIncr as string -- create name for new element object
for face in polyFaces while loopFlag do (--get face index in bit array (will only use the first one retrieved for each loop)
elementFaces=polygetElementsUsingFace polyObj face -- get faces associated with element in poly containing the retrieved face
elementVertices=polygetVertsUsingFace polyObj elementFaces -- get vertices associated with the stored faces
polydetachVerts polyObj elementVertices name:newObjName asNode: true -- detach/name element as seperate object containing the vertices
loopFlag=false -- break out of for loop, only needed first face index in bit array
)
newObj=getNodeByName newObjName ignoreCase:false -- get the newly created object from poly element
newObj.pivot=newObj.center -- center it's pivot point
polySetFaceFlags newObj #all 0 mask: 1 -- clear face selection flags from it
)

delete polyObj -- delete the original poly object (is now an empty poly object after all of it's elements have been removed)
read 1119 times
4/29/2008 4:29:34 AM (last edit: 4/29/2008 4:36:47 AM)
show user profile  mrgrotey
Nice script, Id just like to add that the object needs to be an editable poly object at base level, i.e. not an edit poly modifier, as then it just deletes everything. Nice ;)

(does seem a lot of work to have made for what edit mesh can do already though :p plus you can do it with an edit mesh modifier, but both ways work well)




read 1111 times
4/29/2008 5:02:01 AM (last edit: 4/29/2008 5:03:52 AM)
show user profile  reeves1984
Using edit mesh is not cool though, not cool.

--
Simon Reeves


www.simonreeves.com - VFX Artist & Blog
twitter


www.analogstudio.co.uk <-- I work here

read 1101 times
4/29/2008 5:43:08 AM (last edit: 4/29/2008 5:43:08 AM)
show user profile  Toen
Yeah it only works on editable poly objects so if you want to break all of elements out should collapse the mesh to an editable poly object if it's not before doing it.

Hallowed are the Ori!
read 1086 times
4/29/2008 1:25:04 PM (last edit: 4/29/2008 1:25:04 PM)
#Maxforums IRC
Open chat window


Support Maxforums.org