<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<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>
</body>
</html>