Notifications
Clear all

[Closed] Detach polygon

Hey guys,

a total maxscript newbie here.
I have a problem which I am sure is dirt simple, but I can’t seem to figure it out.

I am trying to write a simple script that would make some basic windows for objects, basedon an edit poly object – basically I want to define the dimensions of the windows with a single edit poly face for a single window, and then have the script do the basic frames and windows.

I got stuck, ironically, at detaching all of the selected faces into a new object.

Here is what I have come up with so far:

[quote=] Obj = $         –Variable no.1
Obj.name = “Window_Object” –Renames the object

(
addmodifier _Windows (Edit_Poly ()) –Add Edit Poly modifier
convertTo _Windows PolyMeshObject –Colalpse to edit poly modifier

)
subobjectLevel = 4 –Goes into Polygon selection
actionMan.executeAction 0 “40021” –Selects ALL polygons

–Inset outer edge

macros.run “Ribbon – Modeling” “EPoly_InsetOptions”
Obj.insetAmount = 6
Obj.EditablePoly.buttonOp #Inset
subobjectLevel = 0

–Detach object inner faces

subobjectLevel = 4

detachFaces()

I have trouble with the last command, that basically sais it wants an argument. I have no idea what I am supposed to write in there. I tried doing it manually with the macro recorder, but the
$.EditablePoly.detachToElement #Face keepOriginal:off
$Object001.name = “Window_inner_object”
command only detaches the polygons to an element, even though had the “detach to element” turned off.

Basically, I am certain that the solution is really simple, but I could not figure this out, find it in the help file or google it out.

Any help would be much appreciated.

Thank you!

2 Replies

(
    selObj = selection[1]
    selObj.name = "Window_Object"

    convertToPoly selObj
    max modify mode
    subobjectLevel = 4
    max select all

    selObj.insetAmount = 6
    selObj.insetType = 0
    selObj.EditablePoly.buttonOp #Inset
    
    polyop.detachFaces selObj (polyop.getFaceSelection selObj) delete:true asNode:true name:"Object01" node:selObj
)

Thank you so very much! Works like a charm.