ZBrushCentral

Automate Cube and Sphere Creation

Has the functionality of CanvasClick been removed because it doesn’t seem to operate as explained in the docs. I would like to automate the creation of a simple sphere and cube, but just copying what I would normally do manually doesn’t seem to produce any results. Is this just not possible to do with Zscript?

Here is what I have for just the cube (which doesn’t work unless I manually create something prior to executing the script).

[IButton,“Create”,“Create Geometry”, [IPress,Tool:Sphere3D] [CanvasClick,0,0,100,100] [TransformSet,320,240,0,100,120,200,0,0,0] ]

Hi,

Welcome to ZBC. :slight_smile:

Your script works as expected for me. Which OS are you on? And which version of ZBrush?

Marcus

Thanks for responding.

I’m using ZBrush 2022.0.3 on Windows 10.

I’m new to ZBrush, so perhaps it’s something more fundamental? I’ve found that it appears to only work as intended when the Lightbox is left open (or if I had previously created a sphere/cube manually). For example:

  • Launch Zscript
  • Load Script
  • Run Script → Sphere is generated

But…

  • Launch Zscript
  • Close Lightbox
  • Load Script
  • Run Script → Sphere is NOT generated

Is there some kind of scripting dependency based upon the Lightbox window being open? Also, rarely the sphere is not generated despite the LightBox being left open at startup, though this is typically not the case.

I’ve gotten the script to work as intended, I just don’t fully understand why it only generates the desired geometry under certain interface conditions.

I think what’s happening is Lightbox is getting in the way of the simulated canvas click. You can actually specify coordinates off the canvas which should solve the problem:

[IButton,"Create","Create Geometry",
	 [IPress,Tool:Sphere3D] 
	 [CanvasClick,0,-4096,0,-4100] 
	 [TransformSet,320,240,0,100,120,200,0,0,0] 
]

I’m afraid that zscript is full of these little quirks that you may have to solve by trial and error. All part of the fun! :roll_eyes:

HTH,
Marcus