This is something I’ve not been good at myself in adhering to – and that is ensuring that when I write plugins they do not modify locked groups or components. Because the surprising reality is that the
#locked? property of the
ComponentInstance class is nothing more than a simple flag. It doesn’t prevent any of the other methods in the API from modifying the content of the locked entity. It simply sits there waving its flag hoping you will observe it and make the appropriate action.
Personally I rarely use the locking feature in SketchUp and therefore do not think of it when I program. And since there’s nothing in the API that enforces it – not even outputs or any warnings I often sin when I write my plugins. As of the time of writing this I don’t think I have even made a single plugin that respects this property. As a heavy plugin user that makes the locked property pretty useless and unreliable.
But I shall make efforts to make amends. And I hope you will too when you write your plugins. And I hope SketchUp in the future implements enforcement of this property or at least output some warning. (It would also help if the documentation clearly explained all of this – as it’s not an obvious behaviour in the form it’s currently in.)