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

Jari Williamsson jari.williamsson at mailbox.swipnet.se
Tue Sep 22 12:59:19 CEST 2015


Thomas,

I've now added NoteID as a property to FCSmartShapeSegment, and also a 
FCNoteEntry:FindNoteID() method.


Best regards,

Jari Williamsson


On 2015-09-14 13:04, Thomas Weber wrote:
> 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
>
> _______________________________________________
> JWLua mailing list
> JWLua at jwmusic.nu
> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>
>






More information about the JWLua mailing list