[JW Lua] Beatchart

Chris marcel.denio at gmail.com
Thu Apr 26 08:52:20 CEST 2018


Pat

Here is an excerpt from my script about "fullspan"

-------------------------------------
local function methodBeatChart(musicregion,distanceprefs)
     finenv.UI():MenuCommand(finale.MENUCMD_NOTESPACING)  -- pour 
initialiser les beatcharts

     for noteentry in eachentrysaved(musicregion) do

         if  noteentry.Duration == finale.WHOLE_NOTE and 
noteentry:IsNote()  then
             local cell = finale.FCCell(noteentry.Measure, noteentry.Staff)
             local ts = cell:GetTimeSignature()

             -- seulement pour les mesures faisant la longueur d'une ronde
             if  ts.Beats *  ts.BeatDuration == 4096 then
                 noteentry.ManualPosition = 0    -- supprimer un 
éventuel positionnement manuel

                 local cm = cell:CreateCellMetrics()
                 local beatchartelements = finale.FCBeatChartElements()
beatchartelements:LoadAllForItem(noteentry.Measure)

                 -- calcul de la largeur de la ronde
                 local wRonde = noteentry:CalcWidestNoteheadWidth ()

                 -- spacebefore total (global + mesure)
                 local spaceBefore = distanceprefs.SpaceBefore + 
getSpaceBeforeOneMeasure(noteentry.Measure)

                 -- coordonnée de la note (en EVPU) à partir du début du 
Beat-Chart (après SpaceBefore)
                 local xRonde = (cm.Width / 2) - (wRonde / 2) - spaceBefore

                 local fullspan
                 for bce in each(beatchartelements) do
                     if bce:GetInitElement() then -- 1° élément (init)
                         fullspan=bce.FullSpan
                     else
                         bce.MinimumPosition =0   -- avec les 
altérations il est différent de 0
                         bce.HorizontalPosition= fullspan * xRonde/ 
cm.MusicWidth
                         bce:Save()
                     end
                 end
             end
         end
     end

     finenv.UI():RedrawDocument()
end
-------------------------------------

Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20180426/f21ae0ed/attachment-0001.html>


More information about the JWLua mailing list