[JW Lua] Once more a glissando metrics test script

Jan Angermüller jan at angermueller.com
Tue Feb 10 12:13:12 CET 2015


Jari,

below is another*glissando smartshape test script* that demonstrates the 
weird metrics behaviour.
If you use it with the attached musx file, it will create two glissandos:

1.) the first one in measure 1 uses default offset, i.e. 
FCSmartShapeSegment:SetEndpointOffsetY(0)
and is *v**isible in scroll view, but at the wrong position, but not 
visible in score view. *

2.) the second one in measure 2 uses custom offset, i.e. 
FCSmartShapeSegment:SetEndpointOffsetY(FCEntryMetrics.BottomPosition)
and is *visible in score view at (nearly) the correct position, but not 
visible in scroll view*.

Any ideas ? There must be a metrics problem somewhere.

In a much more complex environment I also had the situation
that calling FCNote:CalcAccidental() automatically moved the
attached custom offset glissando to a new position. It was reproduceable
in the complex script, but not in the reduced test script below.
I tested with Finale 2014d/Windows/JW Lua 0.30.

Best regards,
Jan

function CreateGlissandoSmartshape(noteentrylayer,firsttime)
     for e in each(noteentrylayer) do
         if e.MeasurePos==0 then    -- take note on measure pos 0 ...
             for e2 in each(noteentrylayer) do
                 if e2.MeasurePos==2048 then   -- ... and note on 
measure pos 2048  ...
                         local smartshape = finale.FCSmartShape() -- ... 
and add a glissando smartshape

                         --set smartshape glissando flags
                         smartshape:SetEntryAttachedFlags(true)
                         smartshape:SetEntryBased(true)
                         smartshape:SetPresetShape(true)
smartshape:SetShapeType(finale.SMARTSHAPE_GLISSANDO)
                         smartshape:SetLineID(1)

                         --connect segments to measure/staff
                         local leftseg = 
smartshape:GetTerminateSegmentLeft()
                         local rightseg = 
smartshape:GetTerminateSegmentRight()
                         leftseg:SetMeasure(e.Measure)
                         rightseg:SetMeasure(e2.Measure)
                         leftseg:SetStaff(e.Staff)
                         rightseg:SetStaff(e2.Staff)

                         --set flags for custom offset
                         if firsttime then --first time don't use custom 
offset and set to default position
                             leftseg:SetCustomOffset(true) --No left 
custom offset
                             rightseg:SetCustomOffset(false) -- No right 
custom offset
                             leftseg:SetEndpointOffsetX(0)
                             rightseg:SetEndpointOffsetX(0)
                             leftseg:SetEndpointOffsetY(0)
                             rightseg:SetEndpointOffsetY(0)
                         else --second time use custom offset and shift 
vertical position up
                             --load entrymetrics for shifting up the 
glissando to the note
                             local entrymetrics=finale.FCEntryMetrics()
                             entrymetrics:Load(e)
                             local entrymetrics2=finale.FCEntryMetrics()
                             entrymetrics2:Load(e2)
                             local pagescale = 0.8547 --page scale in 
score view in the attached glissando.musx file

                             leftseg:SetCustomOffset(false) --Use left 
custom offset
                             rightseg:SetCustomOffset(true) -- Use right 
custom offset
                             leftseg:SetEndpointOffsetX(0)
                             rightseg:SetEndpointOffsetX(0)
leftseg:SetEndpointOffsetY(entrymetrics.BottomPosition/pagescale) --Y 
coordinate requires shifting up from bottom of page to 
noteentry.BottomPosition
rightseg:SetEndpointOffsetY(entrymetrics2.BottomPosition/pagescale)
                         end

                         smartshape:SaveNewEverything(e,e2) --Save 
smartshape
                         break --we're finished with the demo
                 end
             end
         end
     end
end

--Make sure Metrics are setup correctly (not necessary in this script, 
but anyway...)
finale.FCEntryMetrics:MarkMetricsForRebuild()
finale.FCCellMetrics:MarkMetricsForRebuild()

--Create glissando in measure 1 with default offset
local noteentrylayer=finale.FCNoteEntryLayer(0,1,1,1) --load layer 1 in 
measure 1 staff 1
noteentrylayer:Load()
CreateGlissandoSmartshape(noteentrylayer,true)

--Create glissando in measure 1with custom offset
noteentrylayer=finale.FCNoteEntryLayer(0,1,2,2) --load layer 1 in 
measure 2 staff 1
noteentrylayer:Load()
CreateGlissandoSmartshape(noteentrylayer,false)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20150210/985e1923/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: glissando.musx
Type: application/octet-stream
Size: 50169 bytes
Desc: not available
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20150210/985e1923/attachment.obj>


More information about the JWLua mailing list