PDA

View Full Version : Gift : edge connect poly tool


Nicool
08-08-2004, 05:22 PM
Hi !
For my CGtalk buddies :twisted:


// connectEdge - By Nicolas d'Haussy
// Kind of bridge tool between two selected edges.
// Works from a feature of polyAppend fucntion.

// Retruns the object name from a string like : "pCube1.e[11]"

proc string componentStringToObjectName(string $componentString) {

string $buffer[];
tokenize($componentString, ".", $buffer);
return $buffer[0];
}


// Returns the number of the component (whatever it is) from a string (like : "pCube1.e[11]")

proc int componentStringToNumber(string $componentString) {

string $buffer[];
tokenize($componentString, ".", $buffer);
tokenize($buffer[1], "[", $buffer);

int $componentNumber = `match "[0-9]+" $buffer[1]`;

return $componentNumber;

// preg_match (/(.+?)\.[a-z]\[(\d+)\]/, $str, $ra) from php IRC help
}


// Edge connection procedure here
string $sel[] = `ls -sl`;

// Check if the selection is made of edges
if (size(`filterExpand -sm 32`) != 2) {

error("You must select two polygonal edges to connect them.\n");
}

// Check if the edges are from the same mesh
if ((componentStringToObjectName($sel[0])) != (componentStringToObjectName($sel[1]))) {

error("The two selected edges must come from the same polygonal mesh to be connected.\n");
}

polyAppend -ed (componentStringToNumber($sel[0])) -ed (componentStringToNumber($sel[1])) (componentStringToObjectName($sel[0]));

print($sel[0] + " connected to " + $sel[1] + ".\n");

Iconoklast
08-08-2004, 06:01 PM
Could you give us (well me.. :blush: ) an example on how to use this? I'm not sure how it works exactly :[

Cheers :)

Digidim
08-08-2004, 06:17 PM
thx...but wonder whats the advantage against the Append Poly Tool ?
____

@Iconoklast: just select 2 edges & run the script...

Nicool
08-09-2004, 09:53 AM
Yeah... Sorry guys ;)

Select two edges over an hole and run this script then. (Anyway, there are error message if you use it a wrong way) A kind of bridge tool, let's say you've modeled a face with the noz separated from the mousse, that makes easy to connect the lips to the nostrils :thumbsup:

CGTalk Moderation
01-18-2006, 10:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.