The use of the array makes it easier if you are moving say a selection [array = selection.to_a] or collecting just some things e.g. array = selection.grep(Sketchup::Group) - to just transform selected groups…
It is good practice to parenthesize arguments, do NOT have a space between the method and the opening (
The listed-entities/Array-entities must all be in the same ‘entities’ context, and must also be ‘valid?’.
What kind of Transformation are you using ?
What kind of ‘Entities’ are you listing ?
Thanks. I’m drawing clines to represent the bounding box of a component definition, then transforming them to position of a given component instance.
The brackets and NO space before ( are key. It’s just frustrating that the API has so many syntax errors. It’s easy to copy the samples to test them, but the author never bothered to do it.
The particular example of transform_entities has multiple errors and undefined variables.
He possibly did, on most, if you start at the top it often has the context variables, but there’s no mention of them after that…
also, if somethings been added in a later version by someone else, the variables may differ…
you need to have a good trawl around the SketchUcation Developers Forum to see the historical context…
and Trimble need to fix the API doc…
Been complaining about this for years. Ever since I came to SketchUp in v7.
There was an “New API Errors” thread started at SketchUcation back in those days (2009.) (And there was one that even preceded that covering an older API website.)