Forum Groups
  All forums
    Help & Feedback
      Questions
      Work in progress
      Finished Art
      Non-Max related
    Community
      Offtopic
      News
    Hardware
    Photography


Featured Threads
  inspiration alert!!!
(37 replies)
  Indespensible MaxScripts, Plugins and 3rd Party Tools
(37 replies)
  The allmighty FREE Resources Thread !
(17 replies)
  spam alert!!!
(4886 replies)
  Maxforums member photo gallery index
(114 replies)
  Maxforums Member Tutorials
(89 replies)
  three cheers to maxforums...
(240 replies)
  101 Things you didnt know in Max...
(198 replies)
  A Face tutorial from MDB101 :D
(95 replies)
  Maxforums.org Members Gallery
(516 replies)
  SON OF POST YOURSELF
(637 replies)
  Dub's Maxscript Tutorial Index
(119 replies)

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?


Thanks
read 353 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 349 times
7/21/2015 11:58:20 PM (last edit: 7/21/2015 11:58:20 PM)
#Maxforums IRC
Open chat window


Support Maxforums.org