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

    Use Sketchup default cursors

    Scheduled Pinned Locked Moved Developers' Forum
    23 Posts 7 Posters 5.8k Views 7 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.
    • T Offline
      timc
      last edited by

      I was playing around with a new tool, and was wondering if there is an easy way to use Sketchup cursors, or do I have to use custom cursors?

      For example I want to use the pencil cursor in my own tool. Are there constants setup that I can pass to UI.set_cursor()?

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

        Nothing built-in - you'll need to create your own, but you can screenshot them easily enough.

        Hi

        1 Reply Last reply Reply Quote 0
        • T Offline
          timc
          last edited by

          How about the wait cursor, is there a way to display that?

          1 Reply Last reply Reply Quote 0
          • C Offline
            confitex architure
            last edited by

            Hello!
            I've seen plugins such as the one from 1001bit.com that change the cursor when launching a plugin (like when deciding the position of a stair.)
            UI.set_cursor should be helpful.
            Does someone have a short code to share to give an example?
            Help is welcome.

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

              http://code.google.com/intl/nb/apis/sketchup/docs/ourdoc/ui.html#create_cursor
              http://code.google.com/intl/nb/apis/sketchup/docs/ourdoc/ui.html#set_cursor
              http://code.google.com/intl/nb/apis/sketchup/docs/ourdoc/tool.html#onSetCursor

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

              1 Reply Last reply Reply Quote 0
              • C Offline
                confitex architure
                last edited by

                Right thomthom, thanks
                It changes it with an image. How to replace it by a square that fits values you entered previously? By putting a temporary component that draws the square and that follows the mouse path?
                Or how to get the same effect that I see on this advertisement from 3skng i see on the bottom?

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

                  Not sure if this is what you're talking about, but there are methods you can use to draw things directly to the viewport without adding geometry to the model.

                  Error 404 (Not Found)!!1

                  favicon

                  (code.google.com)

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

                  1 Reply Last reply Reply Quote 0
                  • C Offline
                    confitex architure
                    last edited by

                    Nothing happens...Not even errors on Ruby console.

                    I tried

                    model = Sketchup.active_model
                    view = model.active_view
                    point1 = Geom;;Point3d.new 0,0,0 
                    point2 = Geom;;Point3d.new 10,10,0
                    point3 = Geom;;Point3d.new 10,20,0
                    point4 = Geom;;Point3d.new 10,30,0
                    status = view.draw_polyline point1, point2, point3, point4
                    
                    

                    Or

                    point = []
                    model = Sketchup.active_model
                    view = model.active_view
                    point[0] = Geom;;Point3d.new 0,0,0
                    point[1] = Geom;;Point3d.new 10,10,0 
                    status = view = view.draw GL_LINES, point
                    
                    
                    1 Reply Last reply Reply Quote 0
                    • thomthomT Offline
                      thomthom
                      last edited by

                      @unknownuser said:

                      The draw method is used to do basic drawing. This method can only be called from within the draw method of a tool that you implement in Ruby.

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

                      1 Reply Last reply Reply Quote 0
                      • C Offline
                        confitex architure
                        last edited by

                        I don't get it.
                        What does that mean? Can you give me a short example?

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

                          You can only use the .draw methods from within a custom ruby Tool.

                          You must create a Tool http://code.google.com/intl/nb/apis/sketchup/docs/ourdoc/tool.html
                          Implement the Tool.draw method http://code.google.com/intl/nb/apis/sketchup/docs/ourdoc/tool.html#draw
                          and do your drawings from that method.

                          I've attached a quick and dirty test code.


                          test.rb

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

                          1 Reply Last reply Reply Quote 0
                          • C Offline
                            confitex architure
                            last edited by

                            Thank you for such a "dirty" code! 😄
                            Now I get it

                            1 Reply Last reply Reply Quote 0
                            • C Offline
                              confitex architure
                              last edited by

                              In the onMouseMove definition, view.invalidate match better. (I've seen that thanks to an old post from Jim)

                              		def onMouseMove(flags, x, y, view)
                              			view.invalidate
                              		end
                              

                              I don't really understand why in deactivate(view) refresh makes it and not in onMouseMove. Nevermind.
                              It's now easy to follow the mouse move and to replace the cursor with the .draw method.

                              Thanks again!

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

                                ah, the .refresh method is new to 7.1 I think - I was just testing it - comparing it to the old .invalidate.

                                Also, note that my test code is by no means a standard for best practice. For a real tool that draws you probably want to add extra code to ensure you only draw when you have new changes to draw. Drawing on every mousemove isn't very efficient - it's just a quick'n dirty way to test some code.

                                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

                                  Do SU use .cur files? Isn't it just .png?

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

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

                                    I've only used .pngs', but I suspect the extension is less important. I think SU uses the freeimage lib which supports many formats. (I'm clearly making a lot of guesses about how things work.)

                                    Hi

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

                                      If it reads .cur format, I wonder how it deals with the hotspot point of the cursor. Since the .cur format has that stored within, but .png does not. And the method that creates the cursor expected you to input hotspot co-ords.

                                      Only way is to test it.

                                      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

                                        Yea, weird that the .cur format isn't supported. With these PNGs you always have to remember where the hotspot for the cursor is...

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

                                        1 Reply Last reply Reply Quote 0
                                        • Dan RathbunD Offline
                                          Dan Rathbun
                                          last edited by

                                          UPDATED!

                                          Here are 4 Yellow pencil cursors I made myself with Visual Studio (and converted to png with Paint.NET)
                                          They point NorthEast, NorthWest, SouthEast & SouthWest.

                                          Given in Windows .curformat, so you may use with any Windows Application; .. OR..

                                          and in .pngimage format for use with Sketchup custom tool(s) / plugins.

                                          • 32x32 png cursor images have hotpoint as part of filename
                                          • button images have size (16 or 24) as part of filename

                                          I grant permission to use freely for NON-COMMERCIAL purposes. I however reserve and retain Copyright under US code, and International Treaty (Berne Convention.)

                                          [read Copyright.txt for tips on use with Ruby, where to install etc.]

                                          UPDATED! Originally only in .cur format; Now given in png format with small and large button images as well. Cleaned up the bmp after conversion to png, and did anti-aliasing work on edges. ENJOY!


                                          Four Directional yellow pencil Cursors.
                                          Free for NON-COMMERCIAL use.
                                          Author retains Copyright.
                                          [read Copyright.txt for tips on use with Ruby.]

                                          I'm not here much anymore.

                                          1 Reply Last reply Reply Quote 0
                                          • Dan RathbunD Offline
                                            Dan Rathbun
                                            last edited by

                                            %(#408000)[Yellow Pencil Cursors UPDATED!
                                            Now also in png image format; w/ new anti-aliasing edge work, small and large button images.
                                            See original post link below:
                                            ]

                                            http://forums.sketchucation.com/viewtopic.php?f=180&t=22204&p=198338#p198338

                                            I'm not here much anymore.

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

                                            Advertisement