ScriptSpot

Forum topic · General Scripting

Delete render elements which start with "mk_"

By ce89 · 2022-03-21

Description

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 (2)

you can use this Function :

obaida · 2022-03-26


(
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_"
)

ce89 · 2022-03-27

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