import Rhino import rhinoscriptsyntax as rs import scriptcontext as sc def setDetailScale(): """ this script changes the scale of a detail to a selected scale from a listbox version 1.0 www.studiogijs.nl """ detail = rs.GetObject("select detail", filter = 32768) if not detail: return detail = rs.coercerhinoobject(detail) if not detail.DetailGeometry.IsParallelProjection: return #modify the scale scales = {'1/16"=1\'-0"':120, '1/8"=1\'-0"':96, '1/4"=1\'-0"':48, '3/8"=1\'-0"':36, '1/2"=1\'-0"':24, '3/4"=1\'-0"':12, '1-1/2"=1\'-0"':8, '1/6"=1\'-0"':6, '1:1=1\'-0"':1} scale = rs.ListBox(scales.keys(), "Select scale", "Scale detail") if not scale: return intScale = scales.get[scale] detail.DetailGeometry.SetScale(intScale, sc.doc.ModelUnitSystem, 1, sc.doc.PageUnitSystem) #lock detail items = ["YES","NO"] lock = rs.ListBox(items,"Lock Detail/s","YES","NO") detail.DetailGeometry.IsProjectionLocked = lock == 'YES' # if lock == "YES": # detail.DetailGeometry.IsProjectionLocked = True # elif lock == "NO": # detail.DetailGeometry.IsProjectionLocked = False detail.CommitChanges() sc.doc.Views.Redraw() if __name__ == '__main__': setDetailScale()If not using python3.7+
scales
should be collections.OrderedDict
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs