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

    [REQUEST] Automatic drawing of vertical lines

    Scheduled Pinned Locked Moved Plugins
    35 Posts 8 Posters 3.5k Views 8 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.
    • X Offline
      xrok1
      last edited by

      once you start drawing your line, press the up arrow on your keyboard and your line will be locked to the Z axis. this should help. πŸ˜‰

      β€œThere are three classes of people: those who see. Those who see when they are shown. Those who do not see.”

      http://www.Twilightrender.com try it!

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

        I don't mind trying to write the plugin, but I don't want to duplicate Todd's efforts if he is already working on it.

        It will take me longer than Todd, but I think I can do it. I've been working on making "tools" for SU so this would help me out,

        Chris

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

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

          Have at it Chris. Ping me if you need help.

          Here's a suggestion. After presenting the distance dialog and accepting the value for the first line, draw the line when the user clicks the vertex, and remember that line length. That way, is there are 15 lines to be drawn at 12", then there is no re-entering of data for 14 of those drawing operations.

          The way the Nudge tool works is if you left click, the distance dialog comes up (otherwise, it works with just Arrow Keys, repeating the same distance for each nudge). So, maybe you make it so that if any arrow key (or other key, or right click) is pressed, then you put up the distance dialog.

          Todd

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

            I say don't bother with a dialog. Use the VCB to enter a value, or hit ENTER to use the last value. The goal is efficiency. The workflow is:

            Activate Tool
            Click Vertex
            enter length, press ENTER
            repeat:
            Click OR double-click next vertex.
            Double click uses last length.
            Single click and enter new length, press ENTER
            end:

            or something like that.

            Hi

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

              Not bad ideas there folks. I'll have to figure out double click - and pretty much everything else πŸ˜„

              Actually I have the beginings written. I have a tool. You activate it. I can get the input point on a left button down/up. I don't know how to get values from what is entered into the VCB, so I'll have to figure that out. All in all, sounds like a fun script to try and figure out. I'll probably have questions.

              Chris

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

              1 Reply Last reply Reply Quote 0
              • chrisglasierC Offline
                chrisglasier
                last edited by

                @panga said:

                ... i'm manually drawing vertical lines from points of the CAD file with a known Z, and joining with the line tool the top of these vertical lines. From a later post ... if you or others sketchup users can find some similar interests in this script !

                I am not a ruby scripter but I am doing some studies into the practical application of parametric variables and find your problem interesting. If you have time please tell me how you identify the points with a known Z (x,y values, or some specific intersection type, perhaps), and where does the known Z value come from(spot height label or interpolation perhaps)?

                I don't have Autocad, so sorry if these questions would be answered by opening the file.

                Thanks

                Chris

                With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

                1 Reply Last reply Reply Quote 0
                • P Offline
                  Panga
                  last edited by

                  Hi all,

                  @unknownuser said:

                  I am not a ruby scripter but I am doing some studies into the practical application of parametric variables and find your problem interesting. If you have time please tell me how you identify the points with a known Z (x,y values, or some specific intersection type, perhaps), and where does the known Z value come from(spot height label or interpolation perhaps)?

                  I'm making projects in landscape amenity, and each time I received from a geometrician an AutoCAD file that includes all the data I need : roads and buildings layouts, roads levels etc...In this file, the most important points are specified with a Z value, as text object in autocad. I'm using these values to define the height of my vertical lines, and to interpolate some others.

                  Try to open the autocad file with this free software : http://infograph.com/products/dwgviewer/
                  Note : In the file I uploaded here, the texts are converted in vectors, normally they are really text objects.

                  @unknownuser said:

                  Actually I have the beginings written. I have a tool. You activate it. I can get the input point on a left button down/up. I don't know how to get values from what is entered into the VCB, so I'll have to figure that out. All in all, sounds like a fun script to try and figure out. I'll probably have questions.

                  Really happy if you can have fun writting this script Chris !! πŸ˜‰ If you success to do it, I'll make a small tutorial of all my procedure to make my terrains. Many thanks for all your efforts.

                  Panga.

                  1 Reply Last reply Reply Quote 0
                  • chrisglasierC Offline
                    chrisglasier
                    last edited by

                    @panga said:

                    ... each time I received from a geometrician an AutoCAD file that includes all the data I need :

                    Almost certainly true but not in a format that is transferable except by retyping - not good for you but interesting to me - thanks for the feedback.

                    Thanks and bon chance!

                    Chris

                    With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

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

                      Well, my prototype is working. But I've run into issues. I can't get onLButtonDoubleClick to work when I also have an onLButtonUp method. How do I keep the on up from conflickting with my doubleclick? I should note that I have a UI.inputbox that pops up in my onLButtonUp. So as soon as the left button is released, that inputbox pops up. I think that is the conflict.

                      Also, I have not figured out how to remember variables inbetween tool sessions. I was thinking I should be able to start the tool, the user inputs the height. All goes well. Switch to the select or move tool. Then come back to my tool. I wanted it to remember the last input height. But I have been unsuccesful at getting that to work. I was guessing that I could try to write the value to a text file and then have my script get the value from the text file each time. Is that a reasonable solution? Or am I just doing it wrong?

                      @Panga Right now the script works so you input the height. The line is made so that the line is the input-height above 0. So you type 10m, the line will go to the 10m height. It doesn't go 10meters above your starting point. So if your starting point is at 5m abaove 0, and you type 10m, your line will be 5m tall. Because it will start at 5m and go to 10m for a total of 5m height. The alternative is to make it so the height entered is always the length of the line. If you start at 5m height and type 10m, your line could be 10m tall, going to an elevation of 15m. Which way is preferable to your workflow?

                      Allrighty, its coming along.

                      Chris

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

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

                        Chris, to remember user entered values across SketchUp sessions, use the Sketchup.write_defaults and read_defaults methods. Whatever you write will be written to the Windows registry or the Mac .plist file.

                        Pick a name (a key) wisely, like fullmer_linetool_length and store the value in a hex encoded value for best portability on both platforms. You might encounter a known bug if you don't encode a length value. (I don't remember right know if it is a dot, apost, quote or blank that causes issues on Windows.

                        To remember a user entered value across Tool invocations within a SketchUp session, you can just set a class variable (@@somevar) with the value you want to remember. Of course, you have to have created a class, and not just put your tool in a module... πŸ˜‰

                        The best design would be to do both the class variable and the xxx_defaults methods.

                        1 Reply Last reply Reply Quote 0
                        • P Offline
                          Panga
                          last edited by

                          Hi Chris,

                          @unknownuser said:

                          @Panga Right now the script works so you input the height. The line is made so that the line is the input-height above 0. So you type 10m, the line will go to the 10m height. It doesn't go 10meters above your starting point. So if your starting point is at 5m abaove 0, and you type 10m, your line will be 5m tall. Because it will start at 5m and go to 10m for a total of 5m height. The alternative is to make it so the height entered is always the length of the line. If you start at 5m height and type 10m, your line could be 10m tall, going to an elevation of 15m. Which way is preferable to your workflow?

                          Definitly the second solution. I need to create vertical lines from a point with a specific lenght. So the height entered has to be the lenght of the line.

                          Thanks again.

                          Panga.

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

                            @unknownuser said:

                            Of course, you have to have created a class, and not just put your tool in a module...

                            I think a module-level variable would have sufficient scope as it would be available anywhere within the scope of the module. A module is a class, except that it can not be instantiated. So when you say you need create a class, a module will also work.

                            
                            module JF
                              # Don't initialize if it already has a value
                              @my_var = 1 if @my_var.nil?
                            end
                            
                            def JF.test_method
                              p @my_var
                            end
                            
                            p JF.test_method
                            1
                            
                            

                            This just shows you can't create an instance of a module even though it is a technically a class:

                            
                            > Module.class
                            Class
                            > Class.class
                            Class
                            
                            > Module.new.new
                            Error; #<NoMethodError; (eval);33; undefined method `new' for #<Module;0x7e4f2b8>>
                            (eval);33
                            
                            > Class.new.new
                            #<#<Class;0x7e4e430>;0x7e4e400>
                            
                            
                            

                            Hi

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

                              @Panga ok, I'll aim for that.
                              @Jim, someday I hope to understand that πŸ˜„

                              I was using instance variables, so I'll just change it over to a class variable. And I think for me right now that will do the trick - at least from activation to activation of the tool.

                              Chris

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

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

                                @Panga, ok the script is working pretty good now. I am going to attempt to write in some code that makes it remember your last setting over SketchUp sessions. So use it, turn off sketchup and then turn it back on and it should still remember the last number you typed. That is the goal. I never did get double click to work. Oh well.

                                I should be done soon enough I hope,

                                Chris

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

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

                                  ok, script released here:

                                  301 Moved Permanently

                                  favicon

                                  (www.sketchucation.com)

                                  It does not remember your settings from one SU session to another. I kept getting a lot of errors in trying to implement read_default and write default methods. And I also couldn't figure out how to encode in hex. THat is a new world to me and I didn't find anything useful (or that I understood?) in the ruby rdocs either. I think I'm done for the night, but maybe tomorrow if I get a chance, I'll try it again. Thanks for all the help everyone! Hope its useful Panga and others,

                                  Chris

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

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

                                    @unknownuser said:

                                    @Jim, someday I hope to understand that
                                    +1 πŸ˜•

                                    Frenglish at its best !
                                    My scripts

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

                                      @chris fullmer said:

                                      ok, script released here:

                                      301 Moved Permanently

                                      favicon

                                      (www.sketchucation.com)

                                      It does not remember your settings from one SU session to another. I kept getting a lot of errors in trying to implement read_default and write default methods. And I also couldn't figure out how to encode in hex. THat is a new world to me and I didn't find anything useful (or that I understood?) in the ruby rdocs either. I think I'm done for the night, but maybe tomorrow if I get a chance, I'll try it again. Thanks for all the help everyone! Hope its useful Panga and others,

                                      Chris

                                      You want to convert some data to HEX values?

                                      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

                                        Yeah, how would I go about doing that?

                                        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

                                          Do you want to convert numbers to hex? Or do you want to take a string and convert each byte into a hex number?

                                          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

                                            I have no idea. I think the string idea (unless its harder to implement).

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

                                            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