Notifications
Clear all

[Closed] How to detach polygon in SDK?

i want to detach every polygons in a editable mesh with “detach to ” option,

how can i do in SDK ?

3 Replies

anybody know?

1 Reply
(@f97ao)
Joined: 11 months ago

Posts: 0

I assume you mean MaxScript and not the SDK (that is in c++).

Look in the help for Editable_Mesh and detach

Here is an example of something similar to what you want from the maxScript help:

[left][color=green][/color]
[/left]

[left]
[/left]

[left]--Let's detach faces as element inside the original mesh:
[/left]
 [left]obj  = geosphere pos:[100,0,0] --create a GeoSphere
[/left]
 [left]convertToMesh obj --collapse to EditableMesh
[/left]
 [left]--Detach half of the faces as element, delete the original  faces
[/left]
 [left]meshop.detachFaces obj #{1..obj.numfaces/2} delete:true 
[/left]
 [left]update obj --update the mesh
[/left]
 [left]--In this example, the same mesh will be detached as a separate  object
[/left]
 [left]obj  = geosphere pos:[0,0,0] --create another GeoSphere
[/left]
 [left]convertToMesh obj --collapse to EditableMesh
[/left]
 [left]-- Detach the faces as Mesh and get the resulting TriMesh in a  variable
[/left]
 [left]newMesh = meshop.detachFaces obj #{1..obj.numfaces/2} delete:true  asMesh:true
[/left]
 [left]update obj --update the mesh
[/left]
 [left]emesh = Editable_mesh() --create an empty Editable_mesh
[/left]
 [left]emesh.mesh = newMesh --assign the detached faces to the new mesh
[/left]
 [left]update emesh --update the mesh
[/left]

[left]
[/left]
/Andreas

Thank you very much!

but i want to do it in SDK, i mean in C++, not in script.

now i can transform a box (or other geo obj) to editmesh,

but i can not select one of its polygon sublevel and apply detach operation,

who can tell me how to do