[JW Lua] Finding a SmartShape by one of their anchor points

Thomas Weber thomas.weber at notengrafik.com
Mon Aug 28 07:16:21 CEST 2017


Hi all,

I'm trying to find SmartShapes that start or end at a specific position given by a staff/measure number and a MeasurePos.  The typical way of retrieving a SmartShape would probably be LoadAllForRegion on FCSmartShapeMeasureMarks.  However, this will only get me the SmartShape at the given point if I create a region that fully encompasses the entire SmartShape.  There I'm stuck in a vicious circle because I can only be sure the region encompasses the entire SmartShape if I already have the SmartShape I'm looking for.

Alternatively, I could simply make the region the entire document or use LoadAll on FCSmartShapes and iterate over them, but that seems pretty wasteful and poorly scalable when I imagine this could e.g. be used in the context of an entire opera, especially when a script is only applied selectively to very short selections, but run hundreds of times by users.

A workaround solution might be to assume that a SmartShape does not stretch over more than N bars (N being an arbitrarily chosen number) and restrict the search region to that area - risking to fail should there be SmartShapes spanning more then N bars.

Any smart ideas or hints to what method I might have failed to consider?

Best,
Thomas


-- 

Notengrafik Berlin GmbH
HRB 15007

UstID: DE 289234097
Geschäftsführer:
Thomas Weber und Werner J. Wolff

fon: +49 30 220661685

Leuschnerdamm 13
10999 Berlin

notengrafik.com




More information about the JWLua mailing list