sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Manipulating the InputPoint

    Scheduled Pinned Locked Moved Developers' Forum
    10 Posts 6 Posters 1.5k Views 6 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.
    • W Offline
      Whaat
      last edited by

      Take a look at the line tool. When you enter a length in the VCB and press 'Enter', a line gets created and the InputPoint for the linetool is set to the end of the new line, allowing you to inference from this new point.

      There does not seem to be a way to duplicate this behaviour in Ruby (i.e. setting an InputPoint to a given Point3d object). What would solve my problem is if there was a method to set the position attribute of the InputPoint. For example:

      ip=Sketchup;;InputPoint.new
      ip.position=Geom;;Point3d.new(0,0,0)
      

      Am I missing something here? Is there a workaround for this problem? I attempted a workaround by determing the screen coordinates (using view.screen_coords) of the input point and then calling InputPoint.pick(view,x,y) method using the screen coordinates. This does not work to an acceptable level of accuracy.

      Thanks.

      SketchUp Plugins for Professionals

      1 Reply Last reply Reply Quote 0
      • R Offline
        RickW
        last edited by

        I thought there was a way to do that, but I don't remember offhand what it is. If I get a chance to hunt it down, I'll let you know.

        RickW
        [www.smustard.com](http://www.smustard.com)

        1 Reply Last reply Reply Quote 0
        • Didier BurD Offline
          Didier Bur
          last edited by

          Hi,
          I had the same problem int the past.
          Try this:

          a=Geom::Point3d.new(1,2,3)
          -> returns Point3d(1, 2, 3)
          b=Geom::Point3d.new(0,0,0)
          p=Sketchup::InputPoint.new(a)
          -> returns #Sketchup::InputPoint:0xc905860
          p.position
          -> returns Point3d(1, 2, 3)
          Sketchup.active_model.entities.add_line(b,p.position)
          creates a line, so setting an InputPoint to a given Point3d object works.

          Hope dis is whaat u r looking for ?

          DB

          1 Reply Last reply Reply Quote 0
          • W Offline
            Whaat
            last edited by

            @didier bur said:

            Hi,
            I had the same problem int the past.
            Try this:

            a=Geom::Point3d.new(1,2,3)
            -> returns Point3d(1, 2, 3)
            b=Geom::Point3d.new(0,0,0)
            p=Sketchup::InputPoint.new(a)
            -> returns #Sketchup::InputPoint:0xc905860
            p.position
            -> returns Point3d(1, 2, 3)
            Sketchup.active_model.entities.add_line(b,p.position)
            creates a line, so setting an InputPoint to a given Point3d object works.

            Hope dis is whaat u r looking for ?

                 Great!!  That's perfect Didier!  I think that will work!  Thankyou!
            

            SketchUp Plugins for Professionals

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

              I so strongly wanted it...
              And it has appeared so simply!

              
              module Sketchup
                class InputPoint
                  def position=(pt)
                    self.copy! InputPoint.new(pt)
                  end
                end
              end
              
              

              And it works and with arrays

              
              a=Geom;;Point3d.new(1,2,3)
              p=Sketchup;;InputPoint.new(a)
              p.position=Geom;;Point3d.new(10,20,30)
              #or
              p.position=[10,20,30]
              
              

              πŸ˜„
              Whether it is necessary now?

              Didier Thank you!
              πŸ‘

              1 Reply Last reply Reply Quote 0
              • Didier BurD Offline
                Didier Bur
                last edited by

                Hi,
                Guess what gave me the idea of 'InputPoint.new(Geom::Point3d.new(x,y,z)) ?

                I always wanted to know how to create with Ruby a group, but not empty.
                Don't remember who answered here (Rick or TIG) to simply write:
                Sketchup.active_model.entities.dd_group(ents)
                where ents is an array of entities. Not in the official docs. Excuse me SU team, but they are sooooo bad !
                So I tried passing an argument to InputPoint...

                DB

                1 Reply Last reply Reply Quote 0
                • thomthomT Offline
                  thomthom
                  last edited by

                  Ah! So it is possible! To set the inputpoint!! For the love of sanity - I spent hours trying to find a way to do that. Don't know why it never occurred to me to try this.

                  This should have been mentioned in the API docs.

                  Thomas Thomassen β€” SketchUp Monkey & Coding addict
                  List of my plugins and link to the CookieWare fund

                  1 Reply Last reply Reply Quote 0
                  • thomthomT Offline
                    thomthom
                    last edited by

                    No ... no it was not mentioned in the docs at all. Though I added a comment now.

                    @chris fullmer said:

                    Maybe I should stop reading the Docs more often πŸ˜„

                    Ditto! πŸ˜‰

                    Thomas Thomassen β€” SketchUp Monkey & Coding addict
                    List of my plugins and link to the CookieWare fund

                    1 Reply Last reply Reply Quote 0
                    • Chris FullmerC Offline
                      Chris Fullmer
                      last edited by

                      Hehe, sorry. I deleted my comment rather quickly because I thought it was lame - so now you quoted me and it looks like you made it up. So to recap, essentially I said that I had just done this same thing earlier, without looking at the Docs, just presuming it was possible. Had I looked at the Docs, I might not have even tried. So Maybe I should code more often without reading the Docs.

                      Sorry for the confusion πŸ˜„

                      Chris

                      Lately you've been tan, suspicious for the winter.
                      All my Plugins I've written

                      1 Reply Last reply Reply Quote 0
                      • thomthomT Offline
                        thomthom
                        last edited by

                        So I'm not mad! πŸ˜„

                        Thomas Thomassen β€” SketchUp Monkey & Coding addict
                        List of my plugins and link to the CookieWare fund

                        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