<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">I guess the static
      MarkMetricsForRebuild() functions should solve the problem...<br>
      I haven't had the problem again since they are in.<br>
      <br>
      Jan Angermueller<br>
      <br>
      Am 27.06.2014 21:29, schrieb Jan Angermüller:<br>
    </div>
    <blockquote cite="mid:53ADC637.5020804@angermueller.com" type="cite">
      <meta http-equiv="content-type" content="text/html;
        charset=ISO-8859-1">
      <br>
      <div class="moz-forward-container">
        <pre>Jari,

I have a problem probably with the metrics update.
While I was playing a little bit with your dynamic_horizpos script
that you posted once and was trying to add the
"avoid vertical collision of articulation with dynamics" functionality
that you also have in your group demonstration youtube video.
So if it detects an articulation collision it will not only move
the dynamics horizontally (as in your script), but also vertically down.

It works fine, but ... only for a small regions. The larger
the regions are (e.g. 5 measures across 5 staves) I get wrong metric 
calculations from FCArticulation:CalcMetricPos(point). It doesn't calculate a point 
anymore, after it was calculated a few times.

With the first script version it worked only on the very first point 
calculation, then I added the following hoping that it would update the metrics.

     local cellmetrics = finale.FCCellMetrics()
     cellmetrics:LoadAtEntry(entry)
     local entrymetrics = finale.FCEntryMetrics()
     entrymetrics:Load(entry)

And yes, it somehow did. Now it works on a few more entries.
But after some measures it stops again and doesn't calculate anymore
(FCArticulation:CalcMetricPos(point) then returns false,
while FCExpression:CalcMetricPos(point) still does fine).

I have attached the full script. Apart from the few lines above
this is the only thing I added to your script
(the script works fine in most cases, but as it currently only uses
a very simple collision detection, it's just a demonstration yet...)

function RemoveArticulationCollision(entry,expr)
     if entry.ArticulationFlag then
        local articulations= entry:CreateArticulations()
        local point = finale.FCPoint(1,1)
        local point2 =finale.FCPoint(1,1)
        expr:CalcMetricPos(point2)

        for a in each(articulations) do
           a:CalcMetricPos(point)    -- this is where the problem occurs

           print(point.X,point.Y)   -- this will print (1,1) in the attached screenshot example in the last measure, instead of the real value

           local mindiff=60        -- minimum difference, below this value there will probably be a collision
           local vertdiffabs= math.abs(point2.Y)-math.abs(point.Y)
           local vertdiff =point2.Y-point.Y

           if    ((point2.Y<point.Y) and (vertdiffabs<mindiff)) then   
               -- expression currently below articulation
               if vertdiffabs~=mindiff then   -- don't change anymore if it is "perfect" position
                    expr.VerticalPos= expr.VerticalPos+(vertdiffabs-mindiff)
                   point2.Y=point2.Y+(vertdiffabs-mindiff)
               end
          elseif ((point2.Y>point.Y) and (vertdiffabs>-90)) then    
              -- expression currently above articulation
                expr.VerticalPos= expr.VerticalPos+(vertdiffabs-mindiff)
                point2.Y=point2.Y+(vertdiffabs-mindiff)
          end
        end
     end
     return expr
end

Also attached are two screenshots of what happens.
The dynamics in the last measure third staff is not fixed when I select 
all measures and apply the plugin,
but the other three fixes are fine.
When I only select the last measure, that one will also be fixed. So 
there seems to be a metrics problem.

Do you have any hints ?

Jan



</pre>
        <br>
      </div>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
JWLua mailing list
<a class="moz-txt-link-abbreviated" href="mailto:JWLua@jwmusic.nu">JWLua@jwmusic.nu</a>
<a class="moz-txt-link-freetext" href="http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu">http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>