Exception in simple Transform?

Is there anything wrong with this snippet? I am getting an exception for the transform! method:

Error: #<TypeError: can't convert Array into Float>
model     = Sketchup.active_model
selection = model.selection
entities  = model.entities

pts = [[0,0,0], [1,0,0], [1,1,0]]

p pts
p pts.class


        Geom::Point3d.new(2.0, 0.0, 0.0)

p pts

A ‘translation’ expects a ‘vector’ rather than a ‘point’ ?
Although any suitable three element ‘array’ will probably work anyway…

BUT your ‘pts’ is itself an Array of three elements, each of which is itself a three element Array [a point?].
The ‘transformation’ is expecting pts to be a three element array containing three Floats NOT three Arrays.

If you want to transform each of the points inside pts then use say:
tr=Geom::Transformation.translation(Geom::Vector3d.new(2.0, 0.0, 0.0) pts.each{|pt| pt.transform!(tr) }
Then reuse the modified pts to make a new face etc…


Yes of course , thank you.

(Que sound of palm slapping forehead.)