Move objects


#1

Hi,

What am I doing wrong?

            start=plane.Origin
            end=(plane.Origin.Y+100)
            if end:
                vect=(end-start)
                rs.MoveObject(arrow_b,vect)

Error message: unsupported operand type(s) for -: ‘float’ and ‘Point3d’


#2

plane.Origin.Y+100 is a number.

I expect you want something like:

start=plane.Origin
end=rs.coerce3dpoint([plane.Origin.X,plane.Origin.Y+100,plane.Origin.Z])
if end:
    vect=(end-start)
    rs.MoveObject(arrow_b,vect)

#3

Thanks!

I tried to find the meaning of “coerce” but with no luck. Can you explain what that means?


#4

Look at this post:

The same question was asked before :slight_smile: you will find your answer there :wink:


(Willem Derks) #5

Hi Thomas,

This might help conceptualize what these methods are intended for:

coercion [kō′ər·shən]
(computer science)
A method employed by many programming languages to automatically convert one type of data to another.

source:

HTH
-Willem


#6

I will search better in the future…


#7

it’s no problem I do the same all the time :smiley: as long as you get your answer :wink: