Notifications
Clear all

[Closed] select doesn't work

Running a script to find objects with multisub materials and then the next step would be to select those objects.

However it only picks 1 of the found objects.

If I use “delete” it will delete all found objects.

 for obj in geometry
	where isKindOf obj.mat MultiMaterial do
	(
		 delete obj 
		)

This works fine

 for obj in geometry
	where isKindOf obj.mat MultiMaterial do
	(
		 select obj 
		)

doesn’t work. I’m confused. I bet what I’m missing is really simple :\

Appreciate any input I can get.

3 Replies

gah. found it.

selectMore obj

Don’t do it that way, deleting only works because it deletes the objects one by one, select clears previous selection with each new object, selectMore updates the selection with each new object – which will be very slow the more objects there are. You want to collect the objects first and select all of them (same with delete, btw.):

select (for obj in geometry where isKindOf obj.mat MultiMaterial collect obj)

Sorry Swordslayer, just noticed your reply now.

Thank you for the heads up. Good info to know.