[JW Lua] CellFrameHold.ClefIndex: wrong value in measures with regular AND mid-measure clefs

Jan Angermüller jan at angermueller.com
Wed Jan 28 13:42:41 CET 2015


Jari,

when looking at FCCellFrameHold.ClefIndex in a measure that
holds a regular AND a mid measure-clef (see attached test file),
the FCCellFrameHold.ClefIndex may return a wrong result
(in the test case below it returns the clef index from the next (!) 
measure).

If you run the code below on the attached document,
FCCellFrameHold.ClefIndex in measure 2 will return 3 (bass clef),
although the bass clef starts in measure 3 and not 2.
The correct value for FCCellFrameHold .ClefIndex would be the first value
from the mid measure-clefs collection (FCCreateCellClefChanges) from 
measure 2,
i.e. in the code below: midclefs:GetItemAt(0).ClefIndex

Or in other words:
in a measure that hold a regular and a mid measure-clef,
don't use CellFrameHold.ClefIndex as it holds the value from
a different (!) measure. I don't if it's always the value from the
measure that follows, at least it's not value from the current measure.

(Don't worry about the notation from the file,
it's a file for test purposes only and probably makes no sense in the 
real world).

Best regards,
Jan

function PrintClefs(staff,startmeasure,endmeasure)
     local region=finale.FCMusicRegion()
     region.StartStaff=staff
     region.EndStaff=staff
     region.StartMeasure=startmeasure
     region.EndMeasure=endmeasure
     region:SetStartMeasurePosLeft()
     region:SetEndMeasurePosRight()
     for i,j in eachcell(region) do
         local cell=finale.FCCell(i,j)
         local CellFrameHold=finale.FCCellFrameHold()
         CellFrameHold:ConnectCell(cell)
         if CellFrameHold:Load() then
             print("Measure",i,"Regular Clef",CellFrameHold.ClefIndex)
             local midclefs=CellFrameHold:CreateCellClefChanges()
             if midclefs~= nil then
                 for m in each(midclefs) do
                     print("Measure",i,"MidClef",m.ClefIndex)
                 end
             end
         end
     end
end

local region=finale.FCMusicRegion()
region:SetFullDocument()
PrintClefs(region.StartStaff,region.StartMeasure,region.EndMeasure)

Running [Unnamed Script] ======>
Measure 1 Regular Clef 12
Measure 2 Regular Clef 3 *(This should be 0 ! The value 3 is from the 
next measure)*
Measure 2 MidClef 0
Measure 2 MidClef 12
Measure 2 MidClef 0
Measure 3 Regular Clef 3
<======= [Unnamed Script] succeeded (Processing time: 0.000 s).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20150128/c389b37f/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: measures.musx
Type: application/octet-stream
Size: 44469 bytes
Desc: not available
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20150128/c389b37f/attachment.obj>


More information about the JWLua mailing list