Selection from array

Maybe this is a little off topic, but iwant to rotate this selection now,

i have this:

tr = Geom::Transformation.rotation([0,0,0], [1,0,0],90, degrees)
Sketchup.active_model.active_entities.transform_entities(tr,sel)

but it doesnt work? anny ideas why?

...(tr, sel.to_a)

Also you could use the Constants ORIGIN and X_AXIS etc

Hey TIG,
thanks for the speedy respons, i don’t get what you mean with constants ORIGIN anda X-AXIS, and i cant find it annywhere, and also is [0,0,0] wrong? because when the script reaches this line it simply stops excecuting, leaving no error message :confused:

The rotation expects a point and a vector, however it will take the equivalent three element array, as you have shown.

SketchUp has several Constants… like ORIGIN, X_AXIS etc
These are a convenient way of passing a ‘standard’ point or vector to a method…

The fail is because the transform_entities method expects a transformation and an entity OR an array of entities.
So if you are passing an entities collection or a selection turn it into a suitable array using .to_a

Hmm wierd, this doesnt seem to work :confused:

tr = Geom::Transformation.rotation(ORIGIN, X-AXIS,90, degrees) 
Sketchup.active_model.active_entities.transform_entities(tr,sel.to_a)

Shouldn’t that be 90.degrees?

1 Like

Well spotted.
I missed his typo !
tr = Geom::Transformation.rotation(ORIGIN, X-AXIS , 90.degrees )

Omg derp

This has to be my dumbest mistake for today haha i guess i need some rest
Thanks a lot slbaumgartner and TIG it works!