So if I have layers named by numbers they don’t sort in order, for instance Rhino sorts layers like this
E1
E10
E2
E20
instead of like this;
E1
E2
E10
E20
Anyway to have them sort numerically?
So if I have layers named by numbers they don’t sort in order, for instance Rhino sorts layers like this
E1
E10
E2
E20
instead of like this;
E1
E2
E10
E20
Anyway to have them sort numerically?
I use 01 to 09 in these numerical situations and it has become a natural way to use 1 to 9, and a double 00 if the numbers in the hundreds.
This is a problem with computer sorting in general. Windows Explorer works the same way.
Its possible to modify the Layer dialog to sort naturally (or logically). I’d probably want to make it optional.
For example, run the attached script and you can see the difference.
Option Explicit
Call TestLayerNameSort()
Sub TestLayerNameSort()
Dim arrNames, arrNormalSort, arrLogicalSort, strName
arrNames = Rhino.LayerNames
Rhino.ClearCommandHistory
Call Rhino.Print("Layer names - no sort")
For Each strName In arrNames
Call Rhino.Print(" " & strName)
Next
Call Rhino.Print("--")
Call Rhino.Print("Layer names - sort ascending")
arrNormalSort = Rhino.SortStrings(arrNames, True, True, False)
For Each strName In arrNormalSort
Call Rhino.Print(" " & strName)
Next
Call Rhino.Print("--")
Call Rhino.Print("Layer names - logical sort ascending")
arrLogicalSort = Rhino.SortStrings(arrNames, True, True, True)
For Each strName In arrLogicalSort
Call Rhino.Print(" " & strName)
Next
End Sub
@dale Yes Logical sort does do what I am looking for, and I agree it might be nice to have the option. Although is there a time where you wouldn’t use logical sort.
@margaret Actually windows use to be that way but not anymore. I forgot when it changed but it’s been a while.
@BrianM Thanks.
Ah. I have old habits and so I never noticed the change.
Add another vote for this, I had to write a script today to modify layer names and add leading zeroes to get it to properly sort 160 numbered layers… In this case I didn’t really have the choice to plan this from the beginning, as the layer names were derived from the filenames of the 160 files I imported.
Thx, --Mitch