////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // - L F c u t p o l y T o o l v1.0 - // // By // // Landis R. Fields IV // Landis@LandisFields.com // www.LandisFields.com // // // SUMMARY // This script "splits" (extracts and seperates) two objects based on the selected edges. // // INSTALLATION: // Place this file into your scripts directory. // // For Windows your path should most likely be... // "C:\Documents and Settings\*user*\My Documents\maya\7.0\scripts\LFcutpolyTool.mel" // // For the Mac your path should most likely be... // "Library\Preferences\Alias\maya\7.0\scripts\LFcutpolyTool.mel" // // PLEASE NOTE: // This script only works on polygonal objects for obvious reasons. // // USAGE: // Select an edge loop to split from and execute the script. Bam! Done. Works on faces too! // // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // LFcutpolyTool Procedure ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// global proc LFcutpolyTool () { //Get the list of edges that are currently selected and store the result in an array variable string $LFcutpolyToolSelectedEdges[] = `ls-sl`; //Convert the component selection to vertices PolySelectConvert 3; //Get the list of selected verts and store the result in an array variable string $LFcutpolyToolSelectedVerts[] = `ls-sl`; //Loop through the selected verts and... for($LFcutpolyToolEachVert in $LFcutpolyToolSelectedVerts) { //Cut (split) the selected verts polySplitVertex $LFcutpolyToolEachVert; } //Get the shape node that the verts belong to and store the reuslt in a variable string $LFcutpolyToolShapeName[] = `listRelatives -parent $LFcutpolyToolSelectedEdges[0]`; //Get the name of the object by getting the transform node of the shape and store the result in a variable string $LFcutpolyToolObjectName[] = `listRelatives -parent $LFcutpolyToolShapeName[0]`; //Seperate the object/s with NO construction history (-ch 0) to avoide the "polyseperate" output string $LFcutpolyToolSeperatedObjectsList[] = `polySeparate -ch 0 $LFcutpolyToolObjectName[0]`; //Loop through the seperated objects list and... for($LFcutpolyToolEachObject in $LFcutpolyToolSeperatedObjectsList) { //Hit the object with a merge vert using a low iteration (0.0001) polyMergeVertex -d 0.0001 -ch 0 $LFcutpolyToolEachObject; //Clear the vertex selection that maya performs after the merge select -cl; } //Loop through the seperated objects list again and... for($LFcutpolyToolEachObject in $LFcutpolyToolSeperatedObjectsList) { //Toggle the selection of the seperated objects to serve as visual feedback for the user select -tgl $LFcutpolyToolEachObject; } //Give the user text based feedback in the status window that the cut was successful print "LFcutpolyTool successfull!"; }