ScriptSpot

Forum topic · Scripts Wanted

Select objects with 0 vertices

By pokoy · 2009-12-07

Description

Hello all,
i'm quite sure this is something that most of you can write down in 2 seconds.
I have an exported dataset where dummies are presented by objects with 0 vertices. I'd like to get rid of them, therefore i'd need all of the (visible) objects with zero vertices to be selected so i can isolate or delete them.

Thank you in advance,
Marcin

Comments (5)

pokoy · 2009-12-07

thank you so much!

to delete them: for i in

Anubis · 2009-12-07

to delete them:

for i in selection where (getPolygonCount i)[2] == 0 do delete i

and to isolate/deselect them:

for i in selection where (getPolygonCount i)[2] == 0 do deselect i

br0t · 2009-12-07

aww i was too slow :(
@le1setreter: after looking at your approach, i added the "clearSelection()" and deleted the "isHidden" check.

wieder was gelernt, danke :)


macroScript selectZeroVerticeObjects
        category:"Custom"
        tooltip:"Select all Objects with 0 Vertices"
        buttontext:"Sel 0 VertObj"
(
	clearSelection()
	local selCount = 0
	for obj in geometry do
	(
		try
		(
			if (obj.numVerts == 0) do
			(
			selectMore obj
			selCount = selCount+1
			)--end if
		)--end try
		catch ()--end catch
	)--end for
	print (selCount as String+" Objects with 0 Vertices have been selected.")
)--end macroscript
Attachments

le1setreter · 2009-12-07

maybe this might help you:


--epmty elsection
clearSelection()

--select all geometry objects
select(geometry)

-- one array for all geoemtry objects - and one array to place the identified objects into
allGeometry = selection as array
zeroVerts = #()


for i=1 to allGeometry.count do (
	if (classof allGeometry[i] == Editable_Poly) or (classof allGeometry[i] == Editable_mesh) or (classof allGeometry[i] == PolyMeshObject) do (
		if (allGeometry[i].numverts == 0) do append zeroVerts allGeometry[i]
	)
)

select(zeroVerts)