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

    Right Click->Hide

    Scheduled Pinned Locked Moved Developers' Forum
    16 Posts 3 Posters 835 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.
    • K Offline
      kolem
      last edited by

      I read the tutorials on code.google.com, but it doesn't help a lot.
      I tried to look at the linetool.rb and I just got confused...

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

        @kolem said:

        I tried to look at the linetool.rb and I just got confused...

        Yea - that's the one I talked about. Not very good.

        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

          Maybe Jim's construction line tool is of help: http://sketchuptips.blogspot.com/2008/02/plugin-construction-line-tool.html
          Have a look.

          As for SketchUp plguin writing in general:
          You will find many useful links in this thread: http://forums.sketchucation.com/viewtopic.php?f=180&t=10142
          It's worth noting that all plugins share the same environment, so it's important to learn how namespaces (modules and classes) works in Ruby - and use them. Otherwise you might end up with conflicts with other plugins.
          And a big no-no is overriding basic Ruby and SketchUp methods. Then you will most likely break other people's scripts.

          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

            Try this... take the 'linetool.rb' code and copy it - make a new tool class named 'HiddenLineTool' say...
            and used that wherever 'LineTool' used to appear in the text, and also make a new def linetool >> def hiddenlinetool etc...
            Find the line of code that creates the geometry - it reads view.model.entities.add_line(p1,p2)
            and adjust it so it reads myline=view.model.entities.add_line(p1,p2)
            and insert a new line of code immediately beneath that that reads myline.hidden=true
            Now when you draw the line it'll automatically become a 'hidden' line - I suggest that you have 'Hidden Geometry' switched 'on' whilst using this tool, otherwise you could get very confused...

            Note also that you could make another version of it [GuideLineTool ?] to draw a guide-line (cline) by changing that one line to view.model.entities.add_cline(p1,p2) instead

            TIG

            1 Reply Last reply Reply Quote 0
            • K Offline
              kolem
              last edited by

              ill try that, another issue is that i have a problem editing the code in the notepad, i get all the code in one long row, any suggestions?

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

                @kolem said:

                ill try that, another issue is that i have a problem editing the code in the notepad, i get all the code in one long row, any suggestions?

                Get a better editor than Notepad. Get one that provides syntax highlighting - makes reading the code much easier.
                I use Notepad++ http://notepad-plus-plus.org/ - free app with a support for a wide range of languages.

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

                1 Reply Last reply Reply Quote 0
                • K Offline
                  kolem
                  last edited by

                  thanks a lot!
                  well, I started off by looking at the code and I'm starting to get an idea of how things work.
                  i edited the linetool file and changed the class to 'hiddenlinetool', etc...
                  and added the line TIG wrote, however, I get an error:

                  class/module name must be CONSTANT

                  with a referring to this line:

                  class hiddenlinetool

                  ideas?

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

                    Yes - constants in Ruby must start with capital letters.

                    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

                      The class would be HiddenLineTool
                      but the shortcut def hiddenlinetool...

                      TIG

                      1 Reply Last reply Reply Quote 0
                      • K Offline
                        kolem
                        last edited by

                        Ok, seems like it is going to work, now, how do i execute the tool?
                        window>preferences?

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

                          To test type hiddenlinetool into the Ruby Console.
                          Later on when it's debugged to make a 'Plugins' Menu item use this code at the end - outside of the class etc

                          
                          if not file_loaded?(File.basename(__FILE__))
                            ### make command
                            cmd=UI;;Command.new("Draw Hidden Line"){hiddenlinetool}
                            cmd.status_bar_text="Draws a line and immediately hides it..."
                            ### menu
                            UI.menu("Plugins").add_item(cmd)
                            file_loaded(File.basename(__FILE__))
                          end#if
                          
                          

                          To put the tool into the 'Draw' menu instead, you just change 'Plugins' to 'Draw'.....

                          TIG

                          1 Reply Last reply Reply Quote 0
                          • K Offline
                            kolem
                            last edited by

                            never mind i got it working, thanks for the help

                            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