Announcement

Collapse
No announcement yet.

[script] acad layers > 3dsmax layers per color

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [script] acad layers > 3dsmax layers per color

    Hi people,

    A quick script that goes thrue all selected objects in the scene and puts it on a new layer.
    that layer will have the same wirecolor.
    So instead of more then 40 layers in max (that came from autocad) you get a couple new ones with the wirecolors kept.

    Perhaps handy to some1.

    NumberOfColors = #()
    NewLayers = #()
    for i in selection do (
    --build an array with the colors used in the scene appendUnique is a new function
    appendIfUnique NumberOfColors i.wirecolor
    )
    for i = 1 to NumberOfColors.count do (
    -- create Layers of the colors
    LayerName = "Color Layer :" + i as string
    NewLayers[i] = LayerManager.newLayerFromName LayerName
    NewLayers[i].wireColor = NumberOfColors[i]
    -- all layers are created now, now only add the objects to the layer and we are done.
    )
    for i in selection do (
    for t = 1 to NumberOfColors.count do (
    -- for each color check get layer and check
    LayerName = "Color Layer :" + t as string
    tmp = LayerManager.getLayerFromName LayerName
    if tmp.wireColor == i.wirecolor do (tmp.addNode i)
    )
    )

    print "And we are done.... "


    [edit]
    Btw : it's not fool proof hehe, no checks and such so...
    Last edited by pixelstudio; 29-04-2008, 03:39 AM.
    My Homepage : http://www.pixelstudio.nl

  • #2
    It seems very useful for me. I will try it.

    Thank you.
    www.gaell.com

    Comment


    • #3
      Fun, thanks for sharing.

      Heres an additional script thats useful to just get rid of the excessive amount of empty layers left over when cleaning up autocard layer schemes.

      Code:
      toolTip="Delete Unused Layers"
      buttonText="Delete Unused Layers"
      
      --start macro
      
      --Delete all layers that have no objects in them and are not the current layer
      
      LayDelete = #()
      for i = 1 to (LayerManager.count-1) do 
      (
      	append LayDelete (LayerManager.getlayer i).name
      )
      print LayDelete
      for i = 1 to LayDelete.count do
      (
      	LayerManager.deleteLayerByName LayDelete[i]
      )
      Dave Buchhofer. // Vsaiwrk

      Comment

      Working...
      X