In one of the Autodesk Forums, someone had asked for a routine that would put each Polyline in a drawing file on a separate layer. That sounded like a fun challenge, and in the process of putting together a bare-bones solution, I had to decide how these new layers would be named. (I chose to let all of the other layer properties remain at their defaults.). Since I was using a while loop that included an integer-based counter variable to process each Polyline in turn, it seemed simple enough to use that integer value as part of layer name, to make the name unique for each Polyline. Being somewhat retentive, I wanted all the layer names for a given run of the routine to have the same number of characters in them, but there was no way to know up front how many Polylines there would be in any given file.
Once in a file, it is easy enough to determine the total number of polylines, and then to use the itoa AutoLISP function to convert that integer to a string and the strlen function…
Read more