sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    ๐Ÿ›ฃ๏ธ Road Profile Builder | Generate roads, curbs and pavements easily Download

    Double Line 2 (dline.rb update)

    Scheduled Pinned Locked Moved Plugins
    52 Posts 15 Posters 16.7k Views 15 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.
    • TIGT Offline
      TIG Moderator
      last edited by

      Jim

      I also noticed that you use the onKeyDown method to get 'TAB'... this usually fails on a MAC as TAB is screwed on key-down... the recommended way is to use

      def onKeyUp(key, repeat, flags, view)
          if key==9 or key==15 or key==48 ### TAB =9 for PC, MAC 15/48 for some locales ?
             ###
      

      Note how I also have some other keys mapped as in some locales/MacOSs it seems that '9' isn't Tab ๐Ÿ˜•

      TIG

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

        Is there no VK_* constant for tab that would be correct for the platform it runs on?

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

        1 Reply Last reply Reply Quote 0
        • TIGT Offline
          TIG Moderator
          last edited by

          @thomthom said:

          Is there no VK_* constant for tab that would be correct for the platform it runs on?

          No. There should be but it's missing...
          It's a simple matter to always check for 'key-up' if using 'Tab' though ๐Ÿ˜‰

          TIG

          1 Reply Last reply Reply Quote 0
          • pilouP Offline
            pilou
            last edited by

            Don't work on the V6 (pc) ๐Ÿ˜ฎ
            Drawing lines are good but
            Walls are not drawn when Enter pressed ๐Ÿ˜ž

            
            Error; #<ArgumentError; wrong number of arguments(2 for 1)>
            C;/Program Files/Google/Google SketchUp 6/Plugins/dline2.rb;157;in `start_operation'
            C;/Program Files/Google/Google SketchUp 6/Plugins/dline2.rb;157;in `onReturn'
            C;/Program Files/Google/Google SketchUp 6/Plugins/dline2.rb;157
            

            Frenchy Pilou
            Is beautiful that please without concept!
            My Little site :)

            1 Reply Last reply Reply Quote 0
            • TIGT Offline
              TIG Moderator
              last edited by

              @unknownuser said:

              Don't work on the V6 (pc) ๐Ÿ˜ฎ
              Drawing lines are good but
              Walls are not drawn when Enter pressed ๐Ÿ˜ž

              
              > Error; #<ArgumentError; wrong number of arguments(2 for 1)>
              > C;/Program Files/Google/Google SketchUp 6/Plugins/dline2.rb;157;in `start_operation'
              > C;/Program Files/Google/Google SketchUp 6/Plugins/dline2.rb;157;in `onReturn'
              > C;/Program Files/Google/Google SketchUp 6/Plugins/dline2.rb;157
              

              This is the same problem I mentioned with DrawHelix and model.start_operation taking a second argument after v6.
              Unfortunately in this tool it is NOT coded to allow use in v6 at all... BUT here is the fix...
              In a copy of the script in the v6 folder find the two lines reading [one might be in French ๐Ÿ˜’ ]
              Sketchup.active_model.start_operation("Double Line", true)
              and edit the text so there is no 'true' thus
              Sketchup.active_model.start_operation("Double Line")
              Now it will work in v6 [this will also work in v7/8 but is less efficient in refresh of display terms]
              I think a relatively idiot proof way of doing a start_operation that is optimized for all versions is

              begin
                Sketchup.active_model.start_operation("Double Line", true)
              rescue
                Sketchup.active_model.start_operation("Double Line")
              end
              

              That is, it tries to start an operation with a second argument flag set [best for most v7/8 uses] BUT if it fails then it does one without the flag - e.g. v6..........

              TIG

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

                No one really responded when I asked the question about begin-rescue clause with start_operation. Probably a poor choice for a topic sentence on my part.

                http://forums.sketchucation.com/viewtopic.php?f=180&t=22338

                Hi

                1 Reply Last reply Reply Quote 0
                • TIGT Offline
                  TIG Moderator
                  last edited by

                  @jim said:

                  No one really responded when I asked the question about begin-rescue clause with start_operation. Probably a poor choice for a topic sentence on my part.
                  http://forums.sketchucation.com/viewtopic.php?f=180&t=22338

                  Great minds think alike... fools never differ...
                  I agree that this begin-rescue way is less prone to error like your .version v. .version_number typo which screwed Pilou's v6...

                  TIG

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

                    I can't get my Mac to print out the key code for a Tab?

                    using this: http://rhin.crai.archi.fr/RubyLibraryDepot/plugin_details.php?id=205

                    Hi

                    1 Reply Last reply Reply Quote 0
                    • TIGT Offline
                      TIG Moderator
                      last edited by

                      @jim said:

                      I can't get my Mac to print out the key code for a Tab?

                      using this: http://rhin.crai.archi.fr/RubyLibraryDepot/plugin_details.php?id=205

                      For onKeyDown it won't as Tab on Mac doesn't fire onKeyDown ๐Ÿ˜’
                      But with onKeyUp it should return 9
                      BUT note that some locales/MacOSs can return 15 or even 48 for Tab... ๐Ÿ˜ฒ
                      I use this

                      ### Type 'keycode' in the Ruby Console...
                      class TIG_KeyCode
                        def activate
                          @key=""
                          puts "TIG's Non-Shortcut Keycode Reporter.\n"
                          puts "Click in the Main Window outside of the"
                          puts "Ruby Console then Press Non-Shortcut Keys..."
                        end
                        def onKeyDown(key, repeat, flags, view)
                          @key=key.to_s
                          puts "You Pressed Keycode = "+@key
                        end
                        def onKeyUp(key, repeat, flags, view)
                          @key=key.to_s
                          puts "You Released Keycode = "+@key
                        end
                        def deactivate(view)
                          puts "You have pressed a Shortcut Key...\nExiting."
                          return nil
                        end
                      end#class
                      def keycode()
                        Sketchup.active_model.select_tool(TIG_KeyCode.new)
                        puts ""
                      end#if
                      

                      TIG

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

                        Well, that's rather a pain, not to mention bug-ish.

                        Hi

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

                          Is it reported?

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

                          1 Reply Last reply Reply Quote 0
                          • TIGT Offline
                            TIG Moderator
                            last edited by

                            @thomthom said:

                            Is it reported?

                            I have seen it discussed in various places - I've added it to the Tool's API notes...

                            TIG

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

                              @tig said:

                              I have seen it discussed in various places - I've added it to the Tool's API notes...

                              Link?

                              Hi

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

                                @jim said:

                                @tig said:

                                I have seen it discussed in various places - I've added it to the Tool's API notes...

                                Link?

                                http://code.google.com/apis/sketchup/docs/ourdoc/tool.html#commentWidgetTitle

                                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 don't see any note.

                                  Hi

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

                                    Updated to fix Tab issue and correct start_operation for version 6+

                                    http://forums.sketchucation.com/viewtopic.php?f=323&t=33875

                                    Hi

                                    1 Reply Last reply Reply Quote 0
                                    • TIGT Offline
                                      TIG Moderator
                                      last edited by

                                      @jim said:

                                      @tig said:

                                      I have seen it discussed in various places - I've added it to the Tool's API notes...

                                      Link?

                                      Y'know... I don't recall... BUT I have been avoiding using onKeyDown for TAB-key for MAC compatibility for ages by using onKeyUp key==9 etc... I even teach it to my students ๐Ÿ˜’
                                      I've search my usual haunts... and not found a link but there must be something somewhere as I can't have dreamed up the problem alone...
                                      It seems to have been raised around here http://forums.sketchucation.com/viewtopic.php?p=273542#p273542 Jeff was also involved and Fredo? ...

                                      TIG

                                      1 Reply Last reply Reply Quote 0
                                      • TIGT Offline
                                        TIG Moderator
                                        last edited by

                                        @jim said:

                                        I don't see any note.

                                        It's currently the first item in the User Notes list [~5 hours ago] - are your pages cached ? Try refreshing them...

                                        TIG

                                        1 Reply Last reply Reply Quote 0
                                        • TIGT Offline
                                          TIG Moderator
                                          last edited by

                                          @jim said:

                                          Updated to fix Tab issue and correct start_operation for version 6+
                                          http://forums.sketchucation.com/viewtopic.php?f=323&t=33875

                                          Jim
                                          When you link back to something you need to get the link from the 'small-file-square' below the post's title Capture.PNG that way you link to the very page, not the thread itself... http://forums.sketchucation.com/viewtopic.php?p=297720#p297720 works
                                          http://forums.sketchucation.com/viewtopic.php?f=323&t=33875 does not.

                                          TIG

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

                                            Of course it works. I'm not sure what problem you are having.

                                            Hi

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

                                            Advertisement