Convert many surfaces with different names to their own layer

Good day all,

I have a large file that contains close to 1000 surfaces all that have individual name properties. I need to convert these to individual layers for sorting and combining later down my design process. Does anyone know of a script that can move or duplicate surfaces based on layer name to a new layer of the same name?

I have “some”, not a lot, but “some” experience scripting outside of rhino, but do not know where to begin.

Any help would be appreciated!

Cheers,

dsuhay

Hi Dan - here is a quick RhinoScript that should get you started -

Call Main()
Sub Main()

Dim asrf,sSrf, sname

aSrf = Rhino.ObjectsByType(8)
If Not isArray(aSrf) Then Exit Sub

For Each sSrf In aSrf
	sname = Rhino.ObjectName(sSrf)
	If Not isNull(sName) Then
		If Not Rhino.IsLayer(sName) Then
			Rhino.AddLayer sname
		End If
		Rhino.ObjectLayer sSrf, sName
	End If
Next

End Sub

I’m not sure I got it right here - you want to create about 1000 layers, each having one surface and have the layer name take on the surface (object) name? Eminently possible, but the file will probably be pretty be difficult to manage with 1000 layers - not to mention the layer navigation… Is that what you really want to do?

OK, Pascal beat me to it for the script…

–Mitch

This is exactly what I want to do as a starting point for my model. It is for a composite laminate schedule and needs to be sorted. I will try @pascal 's script and let you know how it works!

Worked beautifully! Now to sort :confused: