Home Technical Talk

3d max : How to detach for elements

I've got about 20 objects, and they are attached (but not welded). Is it possible to detach them all to separate objects (by one clik or some easy way, not one by one)?

Replies

  • BradMyers82
    Options
    Offline / Send Message
    BradMyers82 interpolator
    Just select what you want and press detach. I would make detach a hotkey to save you time, and use the select by element (red cube) mode so you select whole islands. If they are not welded it should be as simple as 20 clicks and a press of the hot key each time.
  • Gerbeiter
    Options
    Offline / Send Message
    Sorry? I can't undestand.. all the time I have to detach all elements one by one separately:/
  • SyncViewS
    Options
    Offline / Send Message
    SyncViewS polycounter lvl 13
    Hi Gerbeiter,
    here is a little script to do the trick.
    rollout rolTest "Detach Elems"
    (
        button btRun "Detach!" width:90 align:#center offset:[0, -2]
    
        function detachToNodes oPoly =
        (
            if (classOf oPoly != Editable_Poly) then
                throw "Wrong input in function: detachToNodes()"
            
            local iNumFacesLastElem = 0
            local baElemFaces = #{}
            local sName = ""
        
            while (true) do
            (
                baElemFaces = polyOp.getElementsUsingFace oPoly 1
                sName = uniqueName oPoly.name
                polyOp.detachFaces oPoly baElemFaces delete:true asNode:true name:sName
                
                if ((polyOp.getNumFaces oPoly) == 0) then
                (
                    delete oPoly
                    exit
                )
        
                if (keyboard.escPressed == true) do
                    throw "** escape key pressed **"
            )
        )
    
        on btRun pressed do
        (
            local currSel = selection as Array
            
            for obj in currSel do
                if ((classOf obj) == Editable_Poly) then
                    detachToNodes obj
        )
    ) -- End Rollout
    
    createDialog rolTest 96 27 style:#(#style_toolwindow, #style_border, #style_sysmenu)
    
  • Gerbeiter
    Options
    Offline / Send Message
    Oh yeah, it works, thanks a lot.
    and.. maybe there is some script that allows me to attach all selected objects? I mean.. I select some objects from scene by e.g 'Rectangular selection region' and now.. to attach them, I have to choose 'hide unselected' , then choose attach option and select all objects from the list, and click 'Attach'. That's a bit irritating to do it every time.
  • kio
    Options
    Offline / Send Message
    kio polycounter lvl 16
    in the tools tab there is a collapse function which collapses the current selection to a editable mesh.
  • SyncViewS
    Options
    Offline / Send Message
    SyncViewS polycounter lvl 13
    And here is a script to attach selected objects to the first Editable Poly
    rollout rolTest "Attach Objs"
    (
        button btRun "Attach!" width:90 align:#center offset:[0, -2]
    
        function attachNodes aObjs =
        (
            if (classOf aObjs[1] != Editable_Poly) then
                throw "Wrong input in function: attachNodes()"
    
            local iNumObj = aObjs.count
            
            if (iNumObj > 1) then
                for i = iNumObj to 2 by -1 do
                    polyOp.attach aObjs[1] aObjs[i]
        )
    
        on btRun pressed do
        (
            local currSel = selection as Array
            
            if ((classOf currSel[1]) == Editable_Poly) then
                attachNodes currSel
        )
    ) -- End Rollout
    
    createDialog rolTest 96 27 style:#(#style_toolwindow, #style_border, #style_sysmenu)
    
  • Gerbeiter
    Options
    Offline / Send Message
    Cool.
    SyncViewS - is it necessary to showing the button 'Detach' or 'Attach' ? I put the scripts on my menu bar and I think these additional buttons 'Dettach' 'Attach' are unnecessary :) ?
  • Ott
    Options
    Offline / Send Message
    Ott polycounter lvl 13
    Sync, your detaching script is going to save me a boatload of time. I've been wanting that for awhile. Thanks!
  • deohboeh
    Options
    Offline / Send Message
    deohboeh polycounter lvl 5
    SyncViewS wrote: »
    Hi, here is a little script to do the trick.

    It's 2015 Sync is still the man! :D
  • ZombieWells
    Options
    Offline / Send Message
    ZombieWells polycounter lvl 12
    real quick, when I want to detach, or select a group of faces from an object to detach, it always props the- clone to object- clone to element- dialog box. Is there a way to detach to object, a "quick detach" if you will, with out that stupid thing popping up all the time?
  • Thane-
    Options
    Offline / Send Message
    Thane- polycounter lvl 3
    I haven't used this yet, but it also looks helpful.

    [ame]https://www.youtube.com/watch?v=bgYoXF6QmWw[/ame]
  • labulashi
    Options
    Offline / Send Message
    SyncViewS said:
    Hi Gerbeiter,
    here is a little script to do the trick.
    rollout rolTest "Detach Elems"
    (
        button btRun "Detach!" width:90 align:#center offset:[0, -2]
    
        function detachToNodes oPoly =
        (
            if (classOf oPoly != Editable_Poly) then
                throw "Wrong input in function: detachToNodes()"
            
            local iNumFacesLastElem = 0
            local baElemFaces = #{}
            local sName = ""
        
            while (true) do
            (
                baElemFaces = polyOp.getElementsUsingFace oPoly 1
                sName = uniqueName oPoly.name
                polyOp.detachFaces oPoly baElemFaces delete:true asNode:true name:sName
                
                if ((polyOp.getNumFaces oPoly) == 0) then
                (
                    delete oPoly
                    exit
                )
        
                if (keyboard.escPressed == true) do
                    throw "** escape key pressed **"
            )
        )
    
        on btRun pressed do
        (
            local currSel = selection as Array
            
            for obj in currSel do
                if ((classOf obj) == Editable_Poly) then
                    detachToNodes obj
        )
    ) -- End Rollout
    
    createDialog rolTest 96 27 style:#(#style_toolwindow, #style_border, #style_sysmenu)
    
    salute! from malaysia.
    OCT2017
Sign In or Register to comment.