ZBrushCentral

Help with using Zscript and Macro to batch process files in a folder

Hello,

I’m unfamiliar with Zscripting and couldn’t find an answer googling around. I have about 200 .STL files in a folder that I would like to:

  1. open the file in Zbrush
  2. run the following macro
  3. export into a specific folder

Here is the macro that I saved:

//ZBRUSH MACRO - Recorded in ZBrush version 2021
[IButton,???,“Press to run this macro. Macros can be aborted by pressing the ëescí key.”,
[IShowActions,0]
[IConfig,2021]
[FileNameSetNext,“C:\Users\JakeShearer\Dropbox (ToLTech)\R&D\XR\Ojemann-Thompson Project\Case11\Freesurfer_STL\case11_objects00012.stl”][IPress,Tool:Import]
[IConfig,2021]
[IConfig,2021]
[FileNameSetNext,“C:\Users\Public\Documents\ZBrushData2021\ZPluginData\3DPrintHubData//ascii.GoZ”][IPress,Tool:Import]
[IPress,Tool:SubTool:Rename]
[CanvasStroke,(ZObjStrokeV02n45=H348V281H34AV281H384V283H39AV283H3BBV284H40AV286H43AV286H486V286H4CDV286H4F3V286H516V285H52FV284H53EV282H550V281H55CV281H566V280H571V27EH579V27CH587V279H595V276H59FV274H5A5V273H5A6V273H5ABV272H5ADV271H5AFV270H5B0V270H5B4V26FH5B7V26FH5BCV26EH5CCV26DH5D6V26AH5DBV269H5DFV268H5E0V267H5E2V267H5E3V267H5ECV266H600V266H618V265H627V263H63DV261H64CV25FH653V25DH653V25D)]
[IPress,Transform: Edit]
[IPress,Tool:Geometry:Half]
[IUnPress,Tool:Geometry:Adapt]
[ISet,Tool:Geometry:AdaptiveSize,100]
[FileNameSetNext,“C:\Users\Public\Documents/ZBrushData2021/Temp/objIn.goz”][IPress,Tool:Geometry:ZRemesher]
[FileNameSetNext,“C:\Users\Public\Documents/ZBrushData2021/Temp/objIn.goz”][IPress,Tool:Geometry:ZRemesher]
[IPress,Tool:Geometry:Close Holes]
[IPress,Tool:Geometry:WeldPoints]
[IPress,Tool:Geometry:Optimize Points Order]
[IPress,Tool:Geometry:Check Mesh Integrity]
[IPress,Tool:Geometry:Fix Mesh]
[FileNameSetNext,“C:\Users\JakeShearer\Dropbox (ToLTech)\R&D\XR\Ojemann-Thompson Project\Case11\Freesurfer_STL\Case11 OBJ\case11_objects00012.obj”][FileNameSetNext,“C:\Users\JakeShearer\Dropbox (ToLTech)\R&D\XR\Ojemann-Thompson Project\Case11\Freesurfer_STL\Case11 OBJ\case11_objects00012.obj”][IPress,Tool:Export]
]

Thank you in advance for any help, I don’t really know where to begin!

Hi,

Welcome to ZBC! :slight_smile:

This isn’t straightforward, I’m afraid. There’s not a simple zscript solution for doing batch processing of the sort you want. To start with, your macro would need editing to work with more than one file, and (although I’ve not tested it) I think it would fail anyway with the STL import. (Did you test it after recording it?)

I’ll take a look and see what I can do but it will not be for a few days.