sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Vector3d -> Point3d ?

    Scheduled Pinned Locked Moved Developers' Forum
    7 Posts 3 Posters 1.5k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A Offline
      antantantant
      last edited by

      Hi all, another simple question.

      I would like to define a point by another point + a vector. However, in my Ruby, pt + vec returns another vec object, rather than a pt. So, is there a simple way to convert this returning vec to pt, cos I guess they all belong to array right? Thanks!

      -Max

      1 Reply Last reply Reply Quote 0
      • M Offline
        Matt666
        last edited by

        point3D.offset(Vector3D) ? πŸ˜„ (thank you Didier !! )

        Frenglish at its best !
        My scripts

        1 Reply Last reply Reply Quote 0
        • A Offline
          antantantant
          last edited by

          NICE πŸŽ‰ ! Thank you all! πŸ‘

          1 Reply Last reply Reply Quote 0
          • J Offline
            Jim
            last edited by

            Adding a Vector3d to a Point3d should return a Point3d, however the converse is not true. Are you sure of the types of the objects you are "adding"?

            @unknownuser said:

            cos I guess they all belong to array right?

            No! Point3d's and Vector3d's are distinct classes and not related to Arrays. However, SketchUp does add a few methods of "convenience" to the Array class, so that (in some cases) you can use an Array "as if" it were a Point3d or Vector3d.

            
            pt = Geom;;Point3d.new
            v = Geom;;Vector3d.new (1, 0,0)
            pt + v ==> Point3d(1, 0, 0)
            v + pt ==> Error; #<ArgumentError; (eval);45;in `+'; Cannot convert argument to Sketchup;;Vector3d>
            v + [1,2,3] ==> Vector3d(2, 2, 3)
            
            

            In this example, the Array ([ 1, 2, 3] ) is made into a Vector3d before the '+' operation.

            Hi

            1 Reply Last reply Reply Quote 0
            • A Offline
              antantantant
              last edited by

              Thank you Jim! πŸ‘
              BTW, how can I change my profile? I have no picture nor description for myself.

              1 Reply Last reply Reply Quote 0
              • J Offline
                Jim
                last edited by

                "ant"*4
                

                I hope that made sense.

                You can access your profile via the User Control Panel link: UCP

                Hi

                1 Reply Last reply Reply Quote 0
                • A Offline
                  antantantant
                  last edited by

                  That does. I guess I misunderstood '+' from the start. Thanks again.

                  1 Reply Last reply Reply Quote 0
                  • 1 / 1
                  • First post
                    Last post
                  Buy SketchPlus
                  Buy SUbD
                  Buy WrapR
                  Buy eBook
                  Buy Modelur
                  Buy Vertex Tools
                  Buy SketchCuisine
                  Buy FormFonts

                  Advertisement