ScriptSpot is a diverse online community of artists and developers who come together to find and share scripts that empower their creativity with 3ds Max. Our users come from all parts of the world and work in everything from visual effects to gaming, architecture, students or hobbyists.
Do anybody know way to do this, How to remove from object faces which are not connected with base mesh - floating faces.
I need it for tool I'm working on but I'm running out of ideas.
Can anybody advice something?
Would be great to hear from You.
I checked and it work. Thank You a lot. I have last one question about this.
Could you write this operation as 2 scripts:
1) for objects in selection with extra faces(number of extra faces
Thanks, second script don't work( polyop.deleteFaces curO facesToDellBA) so I used $.modifiers[#Edit_Poly].ButtonOp #DeleteFace and work
command to delete mesh but my question is:
How can use it not only for one object but in object in selection(multiple objects)?
My script works only with editable_poly objects. Edit_Poly modifier is not supported. So, if your object is with Edit_poly mod on top of the stack, then you have to change the code, as you did it.
Also, my second script works with selection of objects. I can show you a video with the scene that is attached above. Do you want to see it?
The script deletes all floating faces that are made by only one polygon(face). Load the attached scene, select the Cylinder, uncomment the
polyop.deleteFaces curO facesToDellBA
and execute the script. The top cap of the cylinder and the single face away from it will be deleted. The teapot and the torus have floating faces, which are separate elements. The script will not delete those elements, because they are made by 2 or more faces.
Now, the question is - how many faces have to have the floating element, that will be considered as "faces to delete", but not as "base mesh"?
You can have "base mesh" with 100 faces and floating element with 50 faces. How the script can know which one is "base mesh" and which one is "faces to delete"?
In the code above you can change how much faces must have the "floating faces" by changing the if(selFacesBA = poGetFaceSelection curO).numberset == 1 then
to, for example: if(selFacesBA = poGetFaceSelection curO).numberset <= 10 then
which will delete all floating elemnts, that have 10 or less faces.
Exucly I would need one script which remove deatched faces - so there is hole in base mash and secund script for faces which are extra, outsdte base mesh.
Can you explain in more detalis how these two scripts have to works? Detached faces are detached as elements or...?? How the script must find them?
The code above deletes all elements, that have 10 or less faces, no matter if those elements are created by detaching faces from the base mesh or by deleting the faces, that connects the elements with the base mesh.
The faces, that are outside from the base mesh are also separate elements? Or they are not? If they are separate elements, then the script above will delete them. You need to set the proper value for the face count in those detached, floating, extra faces.
Thank You, work nice and fast but it delete only one last face.
What I'm trying acheive is to remove multiple(one or many faces I don't know, I have to deal with many different geometry) So script should detect all faces which are not connected to base mesh. Script should work on object selection - multiple object so it should work like this:
1 Check meshes in selected geometrys(objects)for any floating faces and delete it if exist.
Exucly I would need one script which remove deatched faces - so there is hole in base mash and secund script for faces which are extra, outsdte base mesh.
I would be gratefull if You could help mi with this.
I can't come up with anything to menage this.
Max file in attachment and there is two kinds of this objects.
If you wants to delete single faces(elements, formed by single polygons)
(ifselection.count == 1 and classof(curO = selection[1]) == Editable_Poly do(
curOfacesBA = #{1..curO.getnumfaces()}
poSetFaceSelection = polyop.setFaceSelection
poGetFaceSelection = polyop.getFaceSelection
facesToDellBA = #{}while curOfacesBA.numberset != 0 do(-- select the last face by its index
poSetFaceSelection curO (curOfacesBA as array)[1]
curO.selectElement()if(selFacesBA = poGetFaceSelection curO).numberset == 1 then
(
curOfacesBA = curOfacesBA - selFacesBA
join facesToDellBA selFacesBA
)else(
curOfacesBA = curOfacesBA - selFacesBA
))-- if you want to see which faces will be deleted. -- Remove from your code, because this is not needed if you wants only to delete dhe faces
poSetFaceSelection curO facesToDellBA
-- uncomment to delete the faces-- polyop.deleteFaces curO facesToDellBA))
Comments
.
The code below works with editable poly objects and edit poly modifier.
But you have to explain what is "extra faces" in the attached scene.
Tools and Scripts for Autodesk 3dsMax
I forgot attachment.:)
I forgot attachment.:)
it work
I checked and it work. Thank You a lot. I have last one question about this.
Could you write this operation as 2 scripts:
1) for objects in selection with extra faces(number of extra faces
.
What is "extra faces"?
In the attached scene the "extra faces" are the faces that are separate from the teqpots?
Tools and Scripts for Autodesk 3dsMax
almost work
Thanks, second script don't work( polyop.deleteFaces curO facesToDellBA) so I used $.modifiers[#Edit_Poly].ButtonOp #DeleteFace and work
command to delete mesh but my question is:
How can use it not only for one object but in object in selection(multiple objects)?
.
My script works only with editable_poly objects. Edit_Poly modifier is not supported. So, if your object is with Edit_poly mod on top of the stack, then you have to change the code, as you did it.
Also, my second script works with selection of objects. I can show you a video with the scene that is attached above. Do you want to see it?
Tools and Scripts for Autodesk 3dsMax
.
The code below works with selection of objects:
Tools and Scripts for Autodesk 3dsMax
.
The script deletes all floating faces that are made by only one polygon(face). Load the attached scene, select the Cylinder, uncomment the
polyop.deleteFaces curO facesToDellBAand execute the script. The top cap of the cylinder and the single face away from it will be deleted. The teapot and the torus have floating faces, which are separate elements. The script will not delete those elements, because they are made by 2 or more faces.
Now, the question is - how many faces have to have the floating element, that will be considered as "faces to delete", but not as "base mesh"?
You can have "base mesh" with 100 faces and floating element with 50 faces. How the script can know which one is "base mesh" and which one is "faces to delete"?
In the code above you can change how much faces must have the "floating faces" by changing the
if (selFacesBA = poGetFaceSelection curO).numberset == 1 thento, for example:
if (selFacesBA = poGetFaceSelection curO).numberset <= 10 thenwhich will delete all floating elemnts, that have 10 or less faces.
Exucly I would need one script which remove deatched faces - so there is hole in base mash and secund script for faces which are extra, outsdte base mesh.
Can you explain in more detalis how these two scripts have to works? Detached faces are detached as elements or...?? How the script must find them?
The code above deletes all elements, that have 10 or less faces, no matter if those elements are created by detaching faces from the base mesh or by deleting the faces, that connects the elements with the base mesh.
The faces, that are outside from the base mesh are also separate elements? Or they are not? If they are separate elements, then the script above will delete them. You need to set the proper value for the face count in those detached, floating, extra faces.
Tools and Scripts for Autodesk 3dsMax
Thank You, work nice and fast
Thank You, work nice and fast but it delete only one last face.
What I'm trying acheive is to remove multiple(one or many faces I don't know, I have to deal with many different geometry) So script should detect all faces which are not connected to base mesh. Script should work on object selection - multiple object so it should work like this:
1 Check meshes in selected geometrys(objects)for any floating faces and delete it if exist.
Exucly I would need one script which remove deatched faces - so there is hole in base mash and secund script for faces which are extra, outsdte base mesh.
I would be gratefull if You could help mi with this.
I can't come up with anything to menage this.
Max file in attachment and there is two kinds of this objects.
.
If you wants to delete single faces(elements, formed by single polygons)
Tools and Scripts for Autodesk 3dsMax