Notifications
Clear all

[Closed] Script for "Selecting Faces by multiple ID's"

is there a way to select faces by specifying multiple ID’s

2 Replies

fn selectFacesByMatIDs objs matIDs = (
	getFunc = undefined
	setFunc = undefined
	for o in objs do (
		oNumFaces = o.numFaces
		
		if (classOf o == editable_mesh) then (
			getFunc = getFaceMatID
			setFunc = setFaceSelection
		)
		else if (classOf o == editable_poly) then (
			getFunc = polyOp.getFaceMatID
			setFunc = polyOp.setFaceSelection
		)
		else ( continue )
		newFaceSelection = for i = 1 to oNumFaces collect (
			if (findItem matIDs (getFunc o i) != 0) then ( i ) else ( dontcollect )
		)
		setFunc o newFaceSelection
	)
)
-- select faces material IDs 1 or 3 in the currently selected objects
selectFacesByMatIDs (getCurrentSelection()) #(1,3) 

u are a star man… thanks again