PDA

View Full Version : polyListComponentConversion


ikaris
10-05-2004, 07:22 PM
Hello everyone,

I recently found this very nice and simple command to convert polygon selections:

polyListComponentConversion

Personally, I prefer to find component conversions without using PolySelectConvert, using polyInfo instead. However, that means I have to write a seperate procedure to extract the component conversions with a tokenize, like this one:




CODE
// Usage: findShared("pPlane1.e[1]", "ef")
// Returns the faces connected to pPlane.e[1]

proc string[] findShared(string $sComp, string $sType)
{
string $szShared[] = eval("polyInfo -" + $sType + " " + $sComp);

string $buffer[];

int $iSize = `tokenize $szShared[0] $buffer`;

clear $szShared;

int $i;
for ($i = 2; $i < $iSize; $i++)
{
if ($buffer[$i] != "Hard")
{
string $szTemp[] = {$buffer[$i]};
$szShared = `stringArrayCatenate $szShared $szTemp`;
}
}

return $szShared;
}



I don't like doing this, and I find that polyListComponentConversion is a much better way...

HOWEVER !

I can't get the return value of polyListComponentConversion to be flattened, there's no flag for it ! So I end up with things like [64:67] and such, which I'd like to break up into individual elements....

Any ideas ?

Thanks !

john_homer
10-05-2004, 08:36 PM
I'm not sure I completly understand what you are trying to do... so I could be completly wrong (and potentially insulting ;) but hay, here goes..

can you get the result that you want (a flattened list of (verts?), that are shared by the selection (faces?) by using...

ConvertSelectionToVertices;
ls -sl -flatten;

.j

ikaris
10-05-2004, 09:04 PM
Hi John_Homer !

Don't worry, it wasn't insulting :D

The issue is that I would like to avoid doing any selection at all, as I believe it will slow things down. I think if I work purely behind the scenes, my scripts will run a bit faster...

Yes, I agree, it's easy to pass the components to a selection and then use an ls to select if flattened:

select -r $szMypolyListComponentConversionSelection;
string $szFlattenedSelection[] = `ls -sl -fl`;

but I'd prefer to do it "silently", without actually selecting anything... :)

You know what I mean ?

john_homer
10-05-2004, 10:08 PM
fair enought, I know what you mean,

unfortunatly, in that case I dont know the answer though :D

good luck with it.

.j

GennadiyKorol
10-05-2004, 11:57 PM
Something like this will do i hope:

$List = `polyListComponentConversion -tv`;
$List = `ls -fl $List`;

Or you can use the filterExpand too for the last line.

Cheers

martinw
10-09-2004, 03:31 PM
As the previous reply says, try filterExpand. You need to give it the type of components you want it to expand, and it will return them in an array, one component per element.

If you want if for all poly component types, the following should work:

filterExpand -sm 31 -sm 32 -sm 34 -sm 35;

The numbers refer to the different component types, in this case verts, faces, edges and uvs. (Check the filterExpand docs for the full list)

CGTalk Moderation
01-19-2006, 11:00 AM
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.