Finding objects with no verts

Discussions concerning programming of SOFTIMAGE©
Post Reply
User avatar
Pete
Posts: 118
Joined: 16 Jun 2009, 09:28

Finding objects with no verts

Post by Pete » 10 Oct 2012, 11:05

Hi All,

Just wondering if anyone knows a good way of finding objects have no verts. I'm just trying to weed a few unnecessary objects out of a scene but I'm going to have to do it often so i'm trying to find a good way of selecting(then deleting) these objects through scripting.

Thanks
Pete

User avatar
xsisupport
Posts: 713
Joined: 09 Jun 2009, 11:02
Location: Montreal Canada
Contact:

Re: Finding objects with no verts

Post by xsisupport » 10 Oct 2012, 12:23

Here's an old script I found on my hard drive.

Code: Select all

var oNoPoints = new ActiveXObject( "XSI.Collection" );

SelectObj( "#3dobject" );

SelectAllUsingFilter("object", siCheckComponentVisibility, null, null);

oEnum = new Enumerator( Application.Selection ) ;
for (;!oEnum.atEnd();oEnum.moveNext() )
{
	var oSelItem = oEnum.item() ;
	if ( classname( oSelItem ) == "X3DObject" &&
		 oSelItem.Type == "polymsh" &&
		 oSelItem.ActivePrimitive.Geometry.Points.Count == 0
		 )
	{
		oNoPoints.Add( oSelItem );
		LogMessage( oSelItem.fullname + " has zero points" );
	}
}


SelectObj( oNoPoints );
// Steve Blair
// "You're not a runner, you're just a guy who runs" -- my wife
//
// My Blogs: Arnold | Softimage

User avatar
Pete
Posts: 118
Joined: 16 Jun 2009, 09:28

Re: Finding objects with no verts

Post by Pete » 07 Jun 2013, 06:24

Awesome, thanks man! I didn't receive a notification for this one so i only just got it. I'll clean up my dodgy hacky workaround now :)

Thanks!
Pete

Post Reply

Who is online

Users browsing this forum: No registered users and 36 guests