no implicit conversion to float from string

S

stephanie borg

I have this program where there is float numbers in x and y which are
then used to move a model to those coordinates.

x = a[1]
y = a[2]

obj = Sketchup.active_model.selection[0]
pt = obj.bounds.center.vector_to([x,y,0])
tr = Geom::Transformation.translation(pt)
obj.transform!(tr)

Ruby is giving me this error:

#<TypeError: no implicit conversion to float from string>

I tried to do x = a[1].to_s but still give me the same error
 
H

Hassan Schroeder

I have this program where there is float numbers in x and y

Are you sure?
=A0 =A0 =A0 =A0x =3D a[1]
=A0 =A0 =A0 =A0y =3D a[2]

puts x.class
puts y.class
Ruby is giving me this error:

#<TypeError: no implicit conversion to float from string>

I tried to do x =3D a[1].to_s but still give me the same error

Then it seems like you'd want to do `x=3D a[1].to_f` instead, yes?

--=20
Hassan Schroeder ------------------------ (e-mail address removed)
twitter: @hassan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top