Forum Groups
  All forums
    Help & Feedback
      Work in progress
      Finished Art
      Non-Max related

Maxunderground news unavailable

Whats wrong with my snippet?
show user profile  jpedleham
-- create new layer
layer = LayerManager.newLayer()
-- set layer's name
layer.setname "InstanceLayer"

--loop start

for obj in $ do (
--see if object is an instance
if (InstanceMgr.CanMakeObjectsUnique obj == true) then
-get layer name
layer = LayerManager.getLayerFromName "InstanceLayer"
--move object to layer
for n in (selection as array) do layer.addnode n

Im trying to select each object and (if it is an instance) move it to a new layer.
I dont see anything wrong with the above code but when i run it, all of the geometry is moved regardless of whether its an instance.

Can someone with more experience in maxscript than me (so anyone else really) take a look please?

read 282 times
7/21/2015 11:52:56 PM (last edit: 7/21/2015 11:57:40 PM)
show user profile  jpedleham
Nevermind, stupid mistake. i realised i was just adding the selected geometry to the layer rather than the current object. Brainfart.
read 278 times
7/21/2015 11:58:20 PM (last edit: 7/21/2015 11:58:20 PM)
#Maxforums IRC
Open chat window