Delete render elements which start with "mk_"

I've been trying to find a way to delete render elements with a certain suffix in the elementname, in my case "mk_" but I cannot seem to find any resources that describe how to do this. There are plenty of resources on adding or deleting all elements but not by the elementname or a ceratin string part.

If you can help in any that that would be super appreciated.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
obaida's picture

you can use this Function :

(
	fn Delete_rEl_By_String str = (
		local reMgr = maxOps.GetCurRenderElementMgr()
		local num = reMgr.numrenderelements()
		for n = num-1 to 0 by -1 where (findstring (reMgr.getrenderelement n).elementName str) != undefined do (
			reMgr.RemoveRenderElement (reMgr.getrenderelement n)
		)
	)
	Delete_rEl_By_String "mk_"
)
<code/>
ce89's picture

Thank you so much for your

Thank you so much for your help. That is very appreciated!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.