Snap subtool to subtool surface script!!

Hello All,

I just recently purchased a DVD tutorial from Eat 3D and it was very informative. I have also been reading the scripting documentation on the Zbrush website. I have been having trouble trying to figure this out and I am sure it is very simple.

One thing I really like Maya that I wish Zbrush had and I am very surprised that it does not already is a capability to snap one subtool to the surface of another. Snap to vert or make live.

One way I was thinking of doing this is using the getting the position of the transpose tool in the position that I would like the other subtool to be in and using the [TransposeGet, Start xPos, Start yPos, Start zPos, End xPos, End yPos, End zPos] to grab this information then selecting the desired subtool I would like to position and use the [TransformSet,xPos,yPos,zPos,xScale,yScale,zScale,xRotate,yRotate,zRotate] to snap it into the same position that the transpose line was in but take out both of the scale options because I would like to change that manually.

I am currently running IButton as the top level commands to run this script but I would like to eventually set it as hot keys or even better some how set it to the transpose line itself.

One issue I am running into is that the TransposeGet and the TransformSet commands use different positioning commands. The transpose has a start and end where the transform uses scale and rotate.

Blender has something similar to what I am thinking of at the beginning of this video that I think could apply to what I am trying to do:
http://www.youtube.com/watch?v=GZ8q95Ta4KE&index=7&list=PLXrZnHilJ_fRhNSXIFcoIkp9ws2mQtqdi

The values returned by TransformGet are to do with the ZBrush document coordinates, not the position of the subtool relative to the origin, so that’s no good for what you’re trying to do.

You can (sort of) do what you want by using the Position sliders in the Tool>Geometry sub-palette:

[IButton,MoveTo,“Move current subtool to the position of the Transpose Line”,
[If,[TransposeIsShown],

//get the position of the start of the Transpose line

[TransposeGet,xPos,yPos,zPos]

//move current subtool to that position

[If,[IExists,Tool:Geometry:X Position],

[ISet,Tool:Geometry:X Position,xPos]

[ISet,Tool:Geometry:Y Position,yPos]

[ISet,Tool:Geometry:Z Position,zPos]

]

]
]//end button

However, you’ll see that this positions the center of the subtool at the point given by the start of the Transpose line, rather than snapping surface to surface. I think it would be difficult to improve on that using ZScript alone - there simply aren’t the commands to get or set the necessary data (such as positions of the individual vertices). You might get something useful from the [Mesh3DGet] command but that doesn’t always work and I can’t remember offhand which properties are OK. You could do it by using a DLL to examine/manipulate the mesh after exporting from ZBrush, then import the changes but that’s a whole different ball game.

HTH,