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...
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...
Comment