Profile
- Name
- Select Next Element
- ID
- 103524
- Shared with
- Public
- Parent
- None
- Children
- None
- Created on
- May 19, 2020 at 22:47 PM UTC
- Updated on
- May 19, 2020 at 22:47 PM UTC
- Description
Increments the selected elements of the backbone by one. If no elements are selected, selects the first element. Useful for stepping through the protein to check if everything in inside the good regions on the rama map
Best for
Code
-- Make a list of all of the selected elements
selectedElements = {}
for i=1, structure.GetCount() do
if selection.IsSelected(i) then
selectedElements[#selectedElements + 1] = i
end
end
-- If nothing is selected, select the first element. Other wise, increment the selected elements by 1
if #selectedElements==0 then
selection.Select(1)
else
-- Loop through the list of selected elements, and deselect them
for i=1, #selectedElements do
selection.Deselect(selectedElements[i])
-- Do not select next element if current element is last one. Doing this will cause a crash
if selectedElements[i] ~= structure.GetCount() then
-- Select each element that is one higher than the ones that were currently selected
selection.Select(selectedElements[i]+1)
end
end
end