How to make a script “batch friendly”
Hello fellow members of scriptspot. I use BatchIT by Paul Neale for batch processing max files, I enjoy using it, and highly recommend it. I have a question, as it appears to be an entirely different beast to prepare or format scripts to be used in a batch process. My question, for the most part is this: How would one go about making a script that will search for a given object and then if not found continue the search for the next object, so on and so forth, and then finally delete any of the found objects. With my limited scripting abilities, The only scripts that I can make would be a known existent target, and delete it, otherwise the script will hit the wall and the batch process will fail.
Comments
.
...
Tools and Scripts for Autodesk 3dsMax
.
What criteria will be used to search the objects - their names, their positions, etc?
If you want to find and delete all objects which name is "ObjecetToDelete" then you can use this:
delete (for o in objects where o.name == "ObjecetToDelete" collect o)
If you want to find and delete all objects which name is "ObjecetToDelete_001", "ObjecetToDelete_002", "ObjecetToDelete_002_A", etc then you can use this:
delete (for o in objects where matchPattern o.name pattern:"ObjecetToDelete*" collect o)
Tools and Scripts for Autodesk 3dsMax
Continued
Thank you so much for helping me out with this, miauu, I’ll have to try the script later today. Thanks again. Would you happen to know how to rename objects in a scene by adding a prefix to any name such as bone would be renamed Z_bone. The reason I ask this is because otherwise I would need to go in manually into hundreds of files and use a standard rename utility and it takes forever. How come there aren’t more batch scripts and batch utilities out there? That would be great
.
Renaming the selected objects:
Renaming all objects in the scene
Tools and Scripts for Autodesk 3dsMax
New
Thank you so much, Miauu. Works like a charm!