Icon representing a recipe

Recipe: Select Sphere 1.0

created by Serca

Profile


Name
Select Sphere 1.0
ID
103382
Shared with
Public
Parent
None
Children
Created on
April 08, 2020 at 18:22 PM UTC
Updated on
April 08, 2020 at 18:22 PM UTC
Description

Tiny script that makes spherical selection around the selected segment

Best for


Code


--[[ Tiny script that makes spherical selection around the selected segment ]]-- function OptionsDialog() ask=dialog.CreateDialog("Select sphere options") ask.sphereRadius = dialog.AddSlider("Slots to fuze",sphereRadius,1,35,0) ask.OK = dialog.AddButton("OK",1) dialog.Show(ask) sphereRadius=ask.sphereRadius.value end -------- global data p_data = { c, p_a = {}, p_b = {}, p4_c } sphereRadius = 12 function main() if selection.GetCount()==0 then print ("Please select at least one segment!") return end OptionsDialog() if selection.GetCount()>0 then for i=1,structure.GetCount() do if selection.IsSelected(i) then d=i; print(" Selected segment ", d) end end for i=1,structure.GetCount() do if not selection.IsSelected(i) then dist_str = structure.GetDistance(i, d) if dist_str < sphereRadius then selection.Select(i) end --print("For seg: ", i, ", D = ", dist_str) end end end end main()

Comments