Category Archives: Scripts

n_mirrorComponents

Download

Given a list of mesh components (as a valid selection or by
using the components argument), this class will return and/or
select the mirror components.

ARGUMENTS:
components = poly verts, faces or edges (I will expand to nurbs soon)
tolerance = error threshold for the search mechanism. The lower this value, the more precise the results,
but also the more prone to error in the case the mesh is not perfectly symmetrical
axis = 0 for x, 1 for y and 2 for z. No need to specify positive or negative
absolute = if True, the search will occur in world space
doSelect = should we select what we find? You may not always want this…
addToSelection = if True, the class returns a list of both initial components and mirroredComponents

USAGE:
#copy this file to your PYTHONPATH
from n_mirrorComponents import n_mirrorComponents

#Just return the results
#create a poly sphere and select a few verts, then run
mc = n_mirrorComponents()
mc.doIt()
print mc.mirroredComponents

#Select and return the results,
#specify some arguments
mc = n_mirrorComponents(axis = 0, doSelect = 1, addToSelection = 1)
mc.doIt()

#use a predefined components list instead of a selection
myList = ["pSphere1.vtx[258]", "pSphere1.vtx[238]"]
mc = n_mirrorComponents(components = myList, doSelect = 1)
mc.doIt()

NOTE1: Currently only poly meshes are supported (maybe I’ll
extend to nurbs too at some point)
NOTE2: Internally the search mechanism needs verts.
If the components are faces, edges or uvs, I am converting to verts,
do the work and then convert back to your initial components or selection,
based on the type of the first component. I may extend this functionality at some point if need be.


toMaya

Download

This python script allows you to talk to Maya
through a commandPort.
It works with both MEL and python and can be used in conjunction with
any script editors that can execute external commands and can provide
variables for the current scripts and the current selection.

Setup:
1. Copy toMaya.py to your PYTHONPATH
2. Setup your script editor
3. In Maya open port 6001

Examples:
Eclipse->External Tools Configurations:
Location: c:\Python26\python.exe
Arguments: *pathTo\toMaya.py "${resource_loc}" "${selected_text}"

EditPlus->Configure User Tools
Command: python *pathTo\toMaya.py
Argument: "$(FilePath)" "$(CurSel)"

UltraEdit->Tool Configuration
Command Line: *pathTo\python.exe *pathTo\toMaya.py "%F" "%sel%"

Enjoy and drop me a line if you have any questions.