[JW Lua] Find out FCNote a tab slide in a chord is attached to

Thomas Weber thomas.weber at notengrafik.com
Mon Sep 14 13:04:28 CEST 2015


Dear experts,

is there a way to find out what notes a tab slide is attached to?  FCSmartShapeSegment only gives me the entry.  I figured as a workaround, I might find out using FCSmartShapeSegment::GetEndpointOffsetY or FCSmartShape::CalcLeftEntryMetricPos and ::CalcRightEntryMetricPos, but those seem to always yield a y position of 0.

Any help is greatly appreciated.  Below is some testing code.

Best wishes
Thomas Weber


local function getTerminateSegmentAndEntry(smartShape, leftOrRight)
    -- This might be possible much more efficiently, but I don't know how
    local segment = smartShape["GetTerminateSegment"..leftOrRight](smartShape)
    local cellEntries = finale.FCNoteEntryCell(segment.Measure, segment.Staff)
    cellEntries:Load()
    for entry in each(cellEntries) do
        if entry.ENTNUM == segment.EntryRefNumber then
            return segment, entry
        end
    end
    return segment -- no entry matching EntryRefNumber found
end


local function inspectEnd(tabSlide, leftOrRight)
    local segment, entry = getTerminateSegmentAndEntry(tabSlide, leftOrRight)
    local point = finale.FCPoint(0, 0)
    tabSlide["Calc"..leftOrRight.."EntryMetricPos"](tabSlide, entry, point)
    print(leftOrRight, segment.EndpointOffsetY, point:GetY())
end


local marks = finale.FCSmartShapeMeasureMarks()
marks:LoadAllForRegion(finenv.Region(), true)
for mark in each(marks) do
    local smartShape = mark:CreateSmartShape()
    if smartShape:IsTabSlide() then
        inspectEnd(smartShape, "Left")
        inspectEnd(smartShape, "Right")
    end
end




More information about the JWLua mailing list