JCochran Posted May 23, 2007 Share Posted May 23, 2007 In 3ds max, I'm looking for a way to detach every single element from an object and make each element its own object. This way I can use vray proxy and replace every new object with a proxy (using clone and align). I want to do this on some tile roofs, but moreso on forests created with Itoo's Forest plugin. ANY ideas would be great! Thanks Link to comment Share on other sites More sharing options...
batteryoperatedlettuce Posted May 24, 2007 Share Posted May 24, 2007 SCRIPT to use these scripts once you can paste it into a new script and evaluate or you can select and drag the text onto the toolbar if you want to create a permanent button. If you've been searching the help on this subject, you might be familiar with the snippet in the maxScript refference, which explains how to explode every face in an object into a new object. for p = polyop.getNumFaces $ to 1 by -1 do ( polyOp.detachFaces $ #{p} asNode:true name:"explodedObject" ) This is achieved by using the "polyOp.detachFaces" operation. This operation requires a bitArray P, in this case reffers to an integer in a bitArray "#{p}", which is redefined each time by the "for loop". a bitArray is used to define a selection range in maxScript. it can be an integer "1","2","3" etc or a range "1..12", "x..y" etc. In order to detatch an entire element you have to define a bitArray as a range associated with one of the faces in an element. You can do this with "polyOp.getElementsUsingFace". The resulting bitArray can then be used in the detach operation. --detatch all elements to objects o = $ while polyOp.getNumFaces $ > 1 do ( p = PolyOp.getElementsUsingFace $ 1 polyOp.detachFaces $ p asNode:true name:"detachedObject01" ) delete o -Stores the currently selected object in variable "O" -Tests selection and performs the loop while number of faces in selection is greater than 1 -uses getElementsUsingFace to select "element" associated with the first face in object bitArray and stores resulting bitArray as variable "P" -Detatches faces within the range "p" as a new object named "detatchedObject01...02...03 etc -Deletes empty object "O" Link to comment Share on other sites More sharing options...
JCochran Posted May 24, 2007 Author Share Posted May 24, 2007 Brilliant! Thanks batteryoperatedlettuce, that works perfectly for both applications. I haven't been doing this long, but devoting more time to maxscript looks very worthwhile. Link to comment Share on other sites More sharing options...
batteryoperatedlettuce Posted May 25, 2007 Share Posted May 25, 2007 It is worth it, when you are working on projects you will often find yourself facing tiring repetitious tasks, which are either very boring, or too time consuming to even contemplate - like detatching every tile element from a roof, for example Scripts can handle many tasks of this nature and because maxScript is pretty simple, little automated tasks like this one can normally be done in a few lines of code. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now