Detaching faces and deleting doubled ones if exist
I'm looking for a way to programmatically delete certain piece of geometry based on another object or selection. It's hard for me to explain, so please, consider having a following situation.
Consider having complex object, let's say 'Object001' -> a Teapot.
Then cloning the object to -> 'Object002' and attaching the object to back to the 'Object001', so basically, the original 'Object001' will have each face doubled.
Now selecting some faces and detaching them to 'Object003' will result, that there is still one layer of faces present in the area of selection and I want to delete it on detach or explicitly using 'Object003' geometry.
How can I do so using maxscript?
The only solution I think of is to iterate all vertices of 'Object003' and 'Object001' but that's not a good solution for complex geometries. Boolean does not work as excepted.
Please, see the figures in attachments.
Attachment | Size |
---|---|
fig1.png | 118.11 KB |
fig2.png | 28 KB |
fig3.png | 109.55 KB |
Comments
.
Maybe the best aproach is to iterate all faces and to find overlaping faces using the center of the faces. This way you will have less iteration(compared to iterating vertices).
This works with selected polygons. I don't knwo how it will work with complex meshes that you have.
Tools and Scripts for Autodesk 3dsMax
Thanks for your answer, but
Thanks for your answer, but the code deletes the whole geometry not just overlapping faces.
.
Please, watch this video:
https://drive.google.com/open?id=1t-YyxRo8bRpMxswz2z_xF_mi-QzuGuzj
The script works with selected polygons and deletes the selected polygons.
Tools and Scripts for Autodesk 3dsMax
Thanks
Oh, yes it actually works exactly as expected, thank you very much. But it's very slow on ~30k + polygons. Is there a way to detach the whole teapot (not just selection) off the object? Just remove all duplicate faces?
.
This code will show you where the slower part of the script is:
The code works faster then the previous one. Teapot(cloned and attached) with 78400 polys and 342 polys selected - ~56 seconds to find, detach and delete. As you can see the slowest part is where the script tries to find the overlapped faces of the selected faces. So you can try to optimize this part(right now each one of the selected faces are "compared" with all of the other faces).
You can check if the STL modifier can helps you.
Tools and Scripts for Autodesk 3dsMax