Profile
- Name
- Band Breather 0.1
- ID
- 101252
- Shared with
- Public
- Parent
- None
- Children
- Created on
- July 20, 2015 at 21:17 PM UTC
- Updated on
- July 20, 2015 at 21:17 PM UTC
- Description
Sets every band to your chosen multiple of its current length. Use less than 100% for pull bands, more than 100% for push bands. Alternate to "breathe" the protein in its current shape.
Best for
Code
-- Band Breather
-- Sets every band to your chosen multiple of its current length.
-- Use less than 100% for pull bands, more than 100% for push bands.
-- Alternate to "breathe" the protein in its current shape.
-- Choose zero to set all band lengths to zero.
-----------------------------
-- Defaults for Dialog Box
MaxPercent = 200
MinPercent = 0
Percent = 100
-----------------------------
-- Program Constants
SCRIPT = "Band Breather"
VERSION = "0.1"
-----------------------------
BandCount = band.GetCount()
Done = 0
function GetParams()
dlg = dialog.CreateDialog(SCRIPT.." "..VERSION)
dlg.l1 = dialog.AddLabel("Resize bands to x% of current length")
dlg.Percent = dialog.AddSlider("%",Percent,MinPercent,MaxPercent,0)
dlg.ok = dialog.AddButton("OK",1)
dlg.cancel = dialog.AddButton("Cancel",0)
if dialog.Show(dlg) > 0 then
Percent = dlg.Percent.value
print("Resize all bands to "..Percent.."% of their current length.")
return true
else
print("Dialog cancelled")
return false
end
end
function ResizeBands()
for b = 1, BandCount do
band.SetGoalLength(b, Percent/100 * band.GetLength(b))
Done = Done + 1
end
end
---------------------------
function Cleanup()
print("Resized "..Done.." bands out of "..BandCount)
end
function Main()
if GetParams() then
ResizeBands()
end
Cleanup()
end
Main()
--xpcall(Main, Cleanup)