Icon representing a recipe

Recipe: Hold Segment in Space

created by marsfan

Profile


Name
Hold Segment in Space
ID
103597
Shared with
Public
Parent
None
Children
None
Created on
June 15, 2020 at 05:15 AM UTC
Updated on
June 15, 2020 at 05:15 AM UTC
Description

Locks selected segments in space

How it works:
For each selected segment add bands in each cardinal direction (Up, Down, Left, Right, Front, Back) of the segment, set their strength to 10, and sets the target length to the current length.

Best for


Code


function setBandParameters(idx) if (idx==0) then error("Band could not be created") else band.SetStrength(idx, 10) band.SetGoalLength(idx, band.GetLength(idx)) end end length = 2 for i=1,structure.GetCount() do if selection.IsSelected(i) then if i==1 then xAxis = i+2 else xAxis = i-1 end if i==structure.GetCount() then yAxis = i-2 else yAxis = i+1 end idx = band.Add(i, xAxis, yAxis, length, 0, 0) setBandParameters(idx) idx = band.Add(i, xAxis, yAxis, length, math.pi / 2, 0) setBandParameters(idx) idx = band.Add(i, xAxis, yAxis, length, math.pi, 0) setBandParameters(idx) idx = band.Add(i, xAxis, yAxis, length, math.pi/2, math.pi/2) setBandParameters(idx) idx = band.Add(i, xAxis, yAxis, length, math.pi/2, math.pi) setBandParameters(idx) idx = band.Add(i, xAxis, yAxis, length, math.pi/2, 3 * math.pi / 2) setBandParameters(idx) end end

Comments


Bruno Kestemont Lv 1

This recipe existed a time ago ("band to native" or something like that) but I was unable to find it back.

It's useful for the electron density puzzles !