Icon representing a recipe

Recipe: nicm25.hti.ABChecker v1.01

created by Nicm25

Profile


Name
nicm25.hti.ABChecker v1.01
ID
104862
Shared with
Public
Parent
None
Children
None
Created on
June 30, 2021 at 12:05 PM UTC
Updated on
June 30, 2021 at 12:05 PM UTC
Description

judging only by bending of backbone! (nullable segment select, number threshold, boolean highquality)

Best for


Code


-- created by Nicm25; function pldc() local retd=dialog.CreateDialog("ABChecker Ver 1.01") retd.la=dialog.AddLabel(" beta... ...alpha") retd.si=dialog.AddSlider("threshold",0.5,0.0,1.0,2) retd.ck=dialog.AddCheckbox("high Quality",false) retd.bt=dialog.AddButton("OK",1) return retd 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,avy) local segs=0 local sege=0 local stcd={} local lc=0 local setdi=0.0 local sethq=false if avx<-0.001 or avx>1.001 then return 1 end setdi=avx+0.2 setdi=setdi*setdi*1.8 sethq=avy and true or false sege=#avs if selection.GetCount()>1.5 then for lc=1,sege do if avs[lc]>0.5 then if segs<0.5 then segs=lc else sege=lc end end end else segs=1 for lc=1,sege do if structure.IsLocked(lc) then segs=lc+1 end end end if segs>sege-2 then print("not supported partial puzzle") return 1 end for lc=segs+1,sege-1 do stcd[lc-segs+1]=structure.GetDistance(lc-1,lc+1)+ (sethq and(structure.GetDistance(lc-1,lc)+structure.GetDistance(lc,lc+1)-7.63)*7.0 or 0.0) end selection.DeselectAll() selection.SelectRange(segs,sege) undo.SetUndo(false) structure.SetSecondaryStructureSelected("l") selection.DeselectAll() for lc=segs+1,sege-1 do if stcd[lc-segs+1]<4.7+setdi then selection.Select(lc) end end structure.SetSecondaryStructureSelected("h") selection.DeselectAll() for lc=segs+1,sege-1 do if stcd[lc-segs+1]>5.2+setdi then selection.Select(lc) end end undo.SetUndo(true) structure.SetSecondaryStructureSelected("e") selection.DeselectAll() return 0 end local lfi=0 local tdr=pldc() lfi=dialog.Show(tdr) if lfi>0.5 then lfi=run(plss(),tdr.si.value,tdr.ck.value) if lfi>0.5 then print("terminated by exception error") end end

Comments


Nicm25 Lv 1

improved to undo history into one task.
other that, there are no changes to specifications.

Nicm25 Lv 1

improved to undo history into one task.
other that, there are no changes to specifications.