You could try a variety of the following:
-- make the modify panel active, as the skin modifier is fussy like that:
SetCommandPanelTaskMode #Modify
-- cache Selection as we will be selecting objects in the for loop,
-- otherwise you don't need to cache it as it is already itterable:
sel = Selection as array.
for obj in sel do
(
-- only need a reference to the skin modifier:
local skinMod = obj.Modifiers[Skin]
if skinMod != Undefined do
(
-- option 1: convert to an editable poly or mesh with editable_mesh:
ConvertTo obj editable_poly
-- option 2: collapse all modifiers below the skin modifier.
-- Not sure if that is what you want. Just need to get the index of
-- the skin modifier, but it is safe to assume it is at the top, so 1:
MaxOps.CollapseNodeTo obj 1 True
-- option 3: your current code:
MaxOps.CollapseNode obj False
-- enable for options 1 and 3:
-- Select obj
-- AddModifier obj skinMod
-- try forcing a viewport redraw:
-- RedrawViews()
)
)
If you are going with option 1 or 3, you might want to wrap the for loop in a with Redraw False context manager to speed things up:
with Redraw False
(
-- code here
)
You can also cache any struct based method calls outside of the for loop to further improved performance:
ColNodeTo = MaxOps.CollapseNodeTo
ColNode = MaxOps.CollapseNode