Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5938

How to sort layouts order by print order in a list

$
0
0

Hello,I wrote a script to rename several layouts with serial names.
Exmaple:
form
image
to
image

now it works,but when I change these layouts print order,
image
It turned like this:
image

I reconized that the layouts order in python’s list were sort by create time,
not by print order.

Please teach me how to sort layouts order by print order in a list?

import Rhino 
import Rhino.Geometry as rg
import scriptcontext as sc
import rhinoscriptsyntax as rs
import math

sc.doc = Rhino.RhinoDoc.ActiveDoc

def RenameLayootWithSerialName():
    layouts = rs.ViewNames(False,1)
    prefix = rs.GetString("input prefix of layout",False,False)
    
    for i in range(len(layouts)):
        newname = str(prefix)+'-'+str(i+1).zfill(2)
        rs.RenameView(layouts[i],str(newname))


RenameLayootWithSerialName()

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 5938

Trending Articles