<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<br>
<blockquote
cite="mid:trinity-61169c4d-6ff7-4c77-b27c-693d7ae26c85-1406884154602@msvc031"
type="cite">
<div class="gmail_quote">
Jari Williamsson <a class="moz-txt-link-rfc2396E" href="mailto:jari.williamsson@mailbox.swipnet.se"><jari.williamsson@mailbox.swipnet.se></a>
schrieb:
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
0.8ex; border-left: 1px solid rgb(204, 204, 204);
padding-left: 1ex;"> Relinking is most of the time done by
removing the part versions of that data, while making sure
that<br>
the score version remains.<br>
</blockquote>
</div>
</blockquote>
<br>
Jari,<br>
<br>
I now wrote a function that does relinking of hairpins.<br>
It seems to work fine. After processing all hairpins look relinked.<br>
See the code below.<br>
<br>
But I wonder if this is the way you intended it and<br>
if the memory is cleaned correctly.<br>
<br>
It requires saving a new smartshape object at the end, <br>
i.e. the relinked hairpin smartshape will get a new item number.<br>
Is it possible without creating a new object ?<br>
<br>
Jan<br>
<br>
--Relinking hairpin smartshapes<br>
local region = finenv.Region()<br>
local parts=finale.FCParts()<br>
parts:LoadAll()<br>
local score=parts:GetScore() --load score<br>
<br>
local marks = finale.FCSmartShapeMeasureMarks() <br>
marks:LoadAllForRegion(region) -- load all smartshapes from
score<br>
marks:KeepHairpinsOnly() --only keep hairpins<br>
<br>
for hairpinmarks in each(marks) do<br>
local scoresmartshape = hairpinmarks:CreateSmartShape()<br>
if (scoresmartshape ~= nil) then<br>
<br>
local number = scoresmartshape.ItemNo<br>
local left=scoresmartshape:GetTerminateSegmentLeft ()
--required for staff region check<br>
<br>
local parts2 = finale.FCParts()<br>
parts2:LoadAll()<br>
for p in each(parts2) do <br>
if not p:IsScore() --iterate through all parts,
except score <br>
and p:IsStaffIncluded(left.Staff) then --
and only those parts where the staff exists <br>
p:SwitchTo()<br>
local partsmartshape=finale.FCSmartShape()<br>
partsmartshape:Load(number) --load
corresponding smartshape from part<br>
partsmartshape:DeleteData() --delete the
part data<br>
p:SwitchBack()<br>
end<br>
end<br>
scoresmartshape:SaveNewEverything(NULL,NULL) --make sure
this object is still available<br>
end<br>
end<br>
</body>
</html>