delete half of model (polygon)?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 09 September 2005   #1
delete half of model (polygon)?

Would it be possible to write a script that deletes half of a model, the faces (everything on the -X side)?

It would be a big time saver for me. I use smooth proxy a lot with the mirror function. Sometimes when I want to do extrudes in the vertical middle of the model I have to UNsmooth proxy first / do my stuff / then smooth proxy again. But then I have to carefully select the left side of the model and delete. Which cost time if you need to do it 20 times a day.
It's not a big thing, but I think some modelers will find this useful. If some programmers can elaborate on this, that would be great! Thanks in advance.
 
Old 09 September 2005   #2
global proc killHalf() {

string $sel[] = `ls -sl`;

select -r ($sel[0] + ".vtx[*]");

string $pnts[] = `ls -sl -fl`;

select -cl;

for($pnt in $pnts) {

float $pos[] = `xform -q -ws -t $pnt`;

if($pos[0] < 0) {

select -add $pnt;

}

}

ConvertSelectionToFaces;

delete;

}

killHalf;

 
Old 09 September 2005   #3
HI thanks for your script, very cool!
But it's not always accurate, on a simple model it worked, but on a more detailed model it selection too much.

Check the screenshot:
http://www.4legsmedia.com/temp/bakuSelectionError.jpg

But I'm gonna do some work myself too, checking out what xform can do for me in the manual.
 
Old 09 September 2005   #4
just a fast guess: move the model a little bit so there are no vertices that could belong to both sides ...
 
Old 09 September 2005   #5
Hey that's not a bad idea, when I first read it, I thought: "no way". But I moved the object .001 to the X+ and it worked.
I'm gonna to program the move of .001 in the script, and make it move back to 0 when done.

I hope this is a fail proof method.
Thanks!
 
Old 09 September 2005   #6
I have changed the code to this:

PHP Code:
 global proc polyKillHalf() {
 
// put selection in array
 
string $objSelected[] = `ls -sl`;
 
 
// move object to the right
 
setAttr ($objSelected[0]+".translateX"0.001;
 
 
// select vertices of model
 
select -($objSelected[0] + ".vtx[*]");
 
 
// deselect right side of vertices
 
string $pnts[] = `ls -sl -fl`;
 
select -cl;
 
 for(
$pnt in $pnts) {
  
float $pos[] = `xform -q -ws -t $pnt`;
  if(
$pos[0] < 0) {
   
select -add $pnt;
  }
 }
 
 
// delete half
 
ConvertSelectionToFaces;
 
delete;
 
 
// move object to center again
 
setAttr ($objSelected[0]+".translateX"0;
}
polyKillHalf


Thanks for the help!
 
Old 09 September 2005   #7
instead of programming a movement of the model, just change the if($pos[0] < ) statement
__________________

 
Old 09 September 2005   #8
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 10:13 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.