Icon representing a recipe

Recipe: nicm25.hts.BluricSelect v1.01

created by Nicm25

Profile


Name
nicm25.hts.BluricSelect v1.01
ID
104863
Shared with
Public
Parent
None
Children
None
Created on
June 27, 2021 at 12:05 PM UTC
Updated on
June 27, 2021 at 12:05 PM UTC
Description

blurring wide range do selecting! (segment select, number distance)

Best for


Code


-- created by Nicm25; function pldc() local retd=dialog.CreateDialog("BluricSelect Ver 1.01") retd.si=dialog.AddSlider("distance",10.0,1.0,20.0,1) retd.bt=dialog.AddButton("OK",1) return retd end function plfa() local lc=0 local lfd=dialog.SelectSegments() selection.DeselectAll() for lc=1,#lfd do selection.Select(lfd[lc]) end end function plss() local lc=1 local retd={} for lc=1,structure.GetCount() do retd[lc]=selection.IsSelected(lc) and 1 or 0 end return retd end function run(avs,avx) local segs=1 local sege=1 local stcd={} local lc=0 local setdi=0 if avx<-0.001 or avx>1000.001 then return 1 end setdi=avx sege=#avs if selection.GetCount()<0.5 then plfa() end for lc=segs,sege do stcd[lc-segs+1]=selection.IsSelected(lc)and 2 or 0 end for lc=segs,sege do if stcd[lc-segs+1]>1.5 then for lpo=segs,sege do if stcd[lpo-segs+1]<0.5 and structure.GetDistance(lc,lpo)<setdi then stcd[lpo-segs+1]=1 selection.Select(lpo) end end end end setdi=segs-2 for lc=segs,sege do if stcd[lc-segs+1]>0.5 then if lc-setdi>1.5 and lc-setdi<2.5 then selection.Select(lc-1) end setdi=lc end end return 0 end local lfi=0 local tdr=pldc() lfi=dialog.Show(tdr) if lfi>0.5 then lfi=run(plss(),tdr.si.value) if lfi>0.5 then print("terminated by exception error") end end

Comments


Nicm25 Lv 1

thank you for your interest.
this is by product of bootstrap, where i prepare tools myself from beginning
and my personal 'Hand Tools, Selection such package'(hts).

In this little script, selecting range around selected segment,
nearby segments may be selecting continuously to blurring effect.
2 arguments
select: currently selected segment will be this argument.
distance: select based on distance, you can adjust spherical target range.
range: 1.0-20.0 (ext0.0-999.9), default: 10.0, function: real number in angstrom units
int return: whether it was successfully. function: 0 is okay, else is problem