Question: Communicating with ZBrush outside of ZBrush, or multi-plugin workaround

I am just starting out with ZBrush and ZScript, so I am sorry if my questions are a bit noobish. I have tried searching around for these answers, but can’t seem to find them.

  1. Can you launch ZBrush with command line arguments, such as making ZBrush run certain plugins/scripts once launched?

  2. Can a program outside of ZBrush tell ZBrush to run different plugins/scripts/save/anything?

The reason I ask these is because I am trying to write a script that does several different steps automatically. However, some of these steps use other plugins, and I have heard that only one plugin can be run at a time (so if you call another plugin, your plugin will stop). Why is this? Does ZBrush have any plans to better support pluggins? Is there a way to work around this at all? Are the UV Master, Dynamesh(something like that), and 3D print exporter that come with ZBrush open source plugins that I can just yoink the code from and run instead?

I would really rather use ZBrush for all of this, instead of needing to jump between ZBrush and Maya, or worse yet, write GUI bound code to get this all automated…

Thanks for any help!!

You can’t control ZBrush from the command line beyond launching it with a file. You can write an executable (or for that matter, a DLL) that launches ZBrush with a zscript but I don’t know if you could launch more than one zscript this way. The Windows code would be something like:

#include <windows.h>

static const char *zbrushFolder = "C:\\Program Files (x86)\\Pixologic\\ZBrush 4R3";
static const char *zbrushExe = "zbrush.exe";
static const char *scriptPath = "C:\\Users\\Mark\\Desktop\\TestZScript.zsc";//if just a file name then ZBrush will look in the default location 'ZScripts'

WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
  ShellExecute(NULL, "open", zbrushExe, scriptPath, zbrushFolder, SW_SHOWNORMAL);
  return 0;

Is it possible to pass parameters to other plugins either through that method, or through another script, such as the size in inches for the 3D printing plugin?


Thanks for the reference, but can you tell me what I am suppose to be looking at in order to help answer my question? Sorry, I am not the one doing this plugin, and know very little of ZScript at the moment. So I am still getting use to the ZScript terms and whatnot, so sorry if this is a stupid question. I am just trying to figure out if ZScript is the proper route to take before jumping in.

I think you might be able to repeatedly load a zscript text file (writing the necessary commands on the fly) but you will have to test that. You can’t do it through a zscript directly because setting any option for another plugin immediately passes control to that plugin.

Let me make sure I understand this. I can write the lines that need to be executed to set certain parameters on the fly (using my external program), then, using the method you posted above (if it does work with launching more than 1 zscript), call that file that sets certain parameters, waits a certain amount of time, then redoes this over and over, and then tells a certain plugin to start working, waits, then repeat until all the plugins are done. Then calls 1 last zScript to save? That will probably work if it does work this way.

If you know the steps required you could record them as a macro, that might help.

I would love to use this approach, but don’t know, at all, if it would work. It really depends on how macros are recorded and how the ability to use them work, or if they suffer from other problems.

Yes, that’s it.

A macro will not work for the same reason as a single zscript will not work - a macro is just another type of zscript and will lose control the moment a plugin is called (even if it is simply setting an option on the plugin interface).

[Edit: Actually NO - see below!]

Well, it turns out I was wrong. It IS possible to set multiple zplugin interface items from another zscript, so you can certainly set things from a single zscript. Not sure when that became possible… apologies. :o Recording a macro will not work though as the plugin interface buttons will not register - you need to actually code the button presses. Another thing to note is options that automatically set other options may not work. For example, using
[ISet,ZPlugin:3D Print Exporter:X,9]
does not automatically set the Y and Z values (as happens if you set it by hand).

It is also possible to run more than one zscript in the manner I suggested. If you start off the zscript with [IPress,HIDE] then focus should return to your application and subsequent calls work as intended.

Hi marcus_civis. I’ve tried to understand the info here and make a script, or series of scripts, that will properly use a plugin, but with no success. And I can’t find a successful example of this anywhere on this forum or the internet in general. The command reference is no help here, either. Could you possibly show a working example that would, for example, load a tool, pre-process it with Decimation Master, and then decimate it? I don’t need anything but the script example, values, etc don’t matter, just a working script, which I have yet to see anywhere. I can figure the rest, if it’ll work.

I know this is years later from the last post, but I’m hoping for a miracle. :slight_smile: If marcus_civis is no longer here, or anyone else knows how to do this, I would exceedingly grateful for the help.



I’m sorry to say that you can’t control a plugin from zscript. I was mistaken in my post above. Some plugins you might be able to set switches on or off, or set slider values, but it will depend very much on how that plugin is written. For the Pixologic plugins it probably won’t work but that’s because the switches etc. are coded to work together in a set way (for example, with the 3DPrint Hub plugin, clicking on “inch” will turn off “mm”) and not an attempt to limit what can be done with zscript.

The problem with all zscripts, macros and plugins is that only one can be active at a time. So if your script presses a plugin button then control passes to the plugin and your script ceases to run. Currently there is no way around that, I’m afraid.


Thanks marcus_civis. I appreciate the clarification. :slight_smile: