[JW Lua] Glissando metric pos calculation always returns false

Jan Angermüller jan at angermueller.com
Wed Feb 4 17:44:03 CET 2015


Jari,

the functions FCSmartShape:CalcLeftEntryMetricPos and 
CalcRightEntryMetricPos always return a false and no point calculation 
when the smartshape is an (entry-based) glissando.
Below you find the test code.

I was also experimenting with some metrics rebuild functions
( finale.FCEntryMetrics:MarkMetricsForRebuild() and 
finale.FCCellMetrics:MarkMetricsForRebuild() )
but always the same result: no calculation and a false-return.

It also doesn't matter if it is a JWLua-created glissando or a manually 
created glissando.

Best regards,
Jan

function GetEntryToSmartshape(id,measure,staff)
     local region=finale.FCMusicRegion()
     region.StartMeasure=measure-1
     if region.StartMeasure<1 then
        region.StartMeasure=1
     end
     region:SetStartMeasurePosLeft()
     region:SetEndMeasurePosRight()
     region.EndMeasure=measure
     region.StartStaff=staff
     region.EndStaff=staff

     for e in eachentry(region) do
        if (e.ENTNUM == id) then
            return e
        end
     end
     return nil,0
end

--finale.FCEntryMetrics:MarkMetricsForRebuild() --currently taken out as 
it made no difference
--finale.FCCellMetrics:MarkMetricsForRebuild()

local marks = finale.FCSmartShapeMeasureMarks()
marks:LoadAllForRegion(finenv.Region())
marks:RemoveDuplicateReferences()
for mark in each(marks) do
     local smartshape = mark:CreateSmartShape()
     if (smartshape ~= nil)
        and smartshape:IsGlissando() then
         local leftseg=smartshape:GetTerminateSegmentLeft ()
         local leftentryID=leftseg:GetEntryRefNumber()
         local 
leftnoteentry=GetEntryToSmartshape(leftentryID,leftseg.Measure,leftseg.Staff)

         local rightseg=smartshape:GetTerminateSegmentRight ()
         local rightentryID=rightseg:GetEntryRefNumber()
         local 
rightnoteentry=GetEntryToSmartshape(rightentryID,rightseg.Measure,rightseg.Staff)

         local point1=finale.FCPoint(0,0)
         local point2=finale.FCPoint(0,0)
         print("Entry-based:",smartshape.EntryBased)
         print("Left entry measure pos:",leftnoteentry.MeasurePos)
         print("Right entry measure pos:",rightnoteentry.MeasurePos)
print("CalcLeftEntryMetricPos:",smartshape:CalcLeftEntryMetricPos(leftnoteentry,point1))
print("CalcRightEntryMetricPos:",smartshape:CalcRightEntryMetricPos(rightnoteentry,point2))
         print("Points:",point1.X,point1.Y,point2.X,point2.Y)
     end
end




More information about the JWLua mailing list