Download Version 1.1: jj_VectorSnap

Introduction

JJ_VectorSnap is a simple modeling utility written in Python to snap tagged points to a vector defined by two 'picked' points. It's useful for quickly aligning rows of points or shearing them to a specific position. The script enables you to lock any of the axes so that movement is constrained or, alternatively, in non-locked mode will snap points to the nearest point on that vector. The script also has an optional 'uniform' command which spreads the points out uniformly along the length of the vector (between the two picked points). The script is intended to be complementary to Andy Nicholas's excellent Taut plugin which works on edges.

  • Quick and accurate way of shearing and aligning points to vectors
  • Can optionally spread points out uniformly

Movement on X, Y, Z only (VSnapX, VSnapY, VSnapZ)
Here, the tagged points are only allowed to move along x to snap to the 'picked' vector. Using any of these single axis commands is probably the most useful mode for the script.


Movement on Y only (VSnapY)..
Here the points are only moved upwards towards the vector..

Movement on Y only (VSnapY)
In this example you can clearly see how the points snap on Y to the picked Vector but preserve their x and z positioning.


Two Axis Movement
(VSnapXY)

Here, points are allowed to move along both X and Y to the target vector.


Conventional Vector Snap (VSnapXYZ)
Here, points are snapped to the nearest point on the vector with no constraint on any X,Y or Z movement. This command is a 'pure' snap to vector where points will take the shortest possible route to the vector (a vector being an infinite line intersecting the two points).


Uniform(VSnapUNI)
Here, points are snapped to the nearest point on the vector with no constraint on any X,Y or Z movement and then spaced evenly between those two points. There are no axis constraints available in this mode - it's a direct vector snap with even spacing. The only thing to note is that unlike Uniform Inclusive (below) the points are spaced between the pick points but the spacing doesn't include the end points.


Uniform Inclusive(VSnapUNI2)
Here, points are snapped to the nearest point on the vector with no constraint on any X,Y or Z movement and then spaced evenly between those two points. The spacing is 'inclusive' of the start and end points you pick..


Property Page (jj_VSnapPPG)
Using the jj_VSnapPPG command you can bring up a property page which can remain open during your modeling session and which lets you pick the axis/mode you need.

How to Use jj_VectorSnap

When you place jj_VectorSnap into your plugins directory and either restart XSi or Update Plugins, the script creates nine new commands which you can either drag on to a toolbar or use via keymapping. Those commands are:

jj_VSnapPPG brings up a PPG which lets you select the mode
jj_VSnapX only allows movement on X to the Vector
jj_VSnapY only allows movement on Y to the Vector
jj_VSnapZ only allows movement on Z  to the Vector
jj_VSnapXY  only allows movement on XY to the Vector
jj_VSnapXZ only allows movement on XZ to the Vector
jj_VSnapYZ only allows movement on YZ  to the Vector
jj_VSnapXYZ unlocked movement to vector
jj_VSnapUNI unlocked movement to vector spacing points between vector 'start' and 'end'
jj_VSnapUNI2 unlocked movement to vector spacing points between vector 'start' and 'end' inclusive of those points

Notes on Usage

1. You can pick as many points as you like in the Pick Session but only the first two will be used to define the vector.


How to Install jj_VectorSnap

jj_VectorSnap is a Python script which means that you'll need a copy of Python installed on your machine and a copy of the PyWin32 extension.

Installing Python takes a couple of minutes. You can either download these separately from here:

PyWin32

Python

or download a single bundle from ActiveState which does the complete install in one hit:

http://www.activestate.com/Products/ActivePython/?tn=1

Once you've installed Python you just need to drag jj_VectorSnap into your plugin directory.

C:\users\xxxxx\Softimage\XSI_5.11\Application\Plugins

Then, go to File: Plugin Manager and hit 'Update All'. The commands should now be available.

Thanks
Huge thanks to Andy Nicholas, Derek Jenson and Amaan Akram for advice and guidance on this script.

Versions

Version 1.1:
jj_VectorSnap1.1.zip
25.11.2006: Fixed bug in dot product calculation which caused misaligned snap in X, Y or Z modes (see image below). Thanks to Remy and Ooops on XSi Base for spotting this one. If you get the misalignment below, you need to upgrade to 1.1. This definitely shouldn't happen!



Version 1.0: jj_VectorSnap1.0.zip
- Original released version 23.11.2006. Contained misalignment bug (picture above).

Julian Johnson
julian@exch.demon.co.uk