ZBrushCentral

Accessing coordinate under cursor

Hey guys,

Hopefully this should be a simple enough question, I’m looking to access the 3D coordinates under the cursor. Basically, coordinates that zbrush displays in the corner of the screen, seen in the screenshot. Although zbrush is displaying it I can’t seem to find it anywhere in the interface, the Transform:info seems to be something different, more of a screen space thing.

Thanks for your help.

Attachments

coordinates question.png

It’s possible but with a bit of a hack. What the code does is temporarily switch to Move mode so that the Transpose Line can be placed. The position of the start of the Transpose line can then be got. As the Transpose line is visible in Move mode the PixolPick command is used to guess that we’re over the model. I say ‘guess’ because the canvas depth varies with document size but a model is unlikely to have forward facing polygons that are as far back as 2800 z-depth.

[VarSet,xPos,0]
[VarSet,yPos,0]
[VarSet,zPos,0]
[IFreeze,
[VarSet,z,[PixolPick,1,[MouseHPos],[MouseVPos]]]
[If,z < 2800,//we’re over the model
[VarSet,err,0]
[IPress,Transform:Move]
[CanvasClick,[MouseHPos],[MouseVPos]]
[If,[TransposeIsShown],
[TransposeGet,xPos,yPos,zPos]
]
[IPress,Transform:Draw Pointer]
,
[VarSet,err,1]
]
]//end freeze
[If,!err,
[Note,[StrMerge,xPos," : “,yPos,” : ",zPos]]
]

Thanks Marcus, that’s exactly what I was after!

The second part of the script involved moving a tool to the point we’ve just found I’ve done this by just using the deformation:offset although when the xPos value is 1 the deformation requires a value of 100. My initial solution was to use this:

[ISet,Tool:Deformation:Offset,(xPos*100)]

but unforuantely if the xPos is higher than 1 the deformation is capped at 100. Anything higher currently requires me to loop the deformation 100 times which is fairly slow.

I can easily just add an “if” so that for some cases it will do the simple maths rather than the loop, but I just wanted to check there wasn’t an easier way to set somethings position.

Thanks,

Taylor

You could set the position in the Tool>Geometry>Position sliders. I seem to remember there’s something odd about setting those using zscript, in that the values that are set are relative to the previous values, so you’ll have to test and see what happens!

That worked perfectly! Just shows how much of the zbrush interface I’m unaware of :stuck_out_tongue: Thanks so much for your help!

You’re welcome. :slight_smile:

@ryankittleson the script has no ibutton so that is the reason why the script runs when it is loaded.
Hope it helps
Nicolas