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

    One-liners

    Scheduled Pinned Locked Moved Developers' Forum
    22 Posts 6 Posters 418 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.
    • TIGT Offline
      TIG Moderator
      last edited by

      It does work, in that it adds faces to selected edges.
      For me it works, then returns the selection, not the new faces or nil.
      I think the initial confusion was that the code had something like "add_faces_to_selected_lines=..." to show what it did, and of course add_faces_to_selected_lines is set to be the selection, I assume this was used because of the arbitrary rule that you can't use a ';' - which makes it impossible to do a one-liner with its intent shown unless you add '#' and then the description at the end of the code line...

      TIG

      1 Reply Last reply Reply Quote 0
      • N Offline
        noelwarr
        last edited by

        You got it TIG. Could you suggest a way to rephrase the whole "challenge" so it is readily apparent?

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

          Yes I was confused by the original wording you chose.

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • daikuD Offline
            daiku
            last edited by

            OBFUSCATORS!

            Your goal should be to write the most readable code possible. This is the opposite.

            Clark Bremer
            http://www.northernlightstimberframing.com

            1 Reply Last reply Reply Quote 0
            • N Offline
              noelwarr
              last edited by

              大工ですか。すごい。何年前日本に住んだけど。大阪に。それに、私も大工ですよ。面白い、なぁ。
              Anyhow, I'm not advocating for this type of code, though I think it's cool that ruby allows for it. All I wanted was a list of cool lines that one might copy and paste into the console to do something useful. Instead it would seem I've started a flame war or something 😮

              1 Reply Last reply Reply Quote 0
              • daikuD Offline
                daiku
                last edited by

                Sorry, but I don't speak a lick of Japanese. I can tell from the first two characters that this was addressed to me, but the rest is lost on me. As a professional timber framer, the Daiku are my heroes. We had a group come to one of our conferences, and the level of skill and craftsmanship was amazing.

                And of course I was only trying to be clever with my first post. Nothing personal 😄

                Clark Bremer
                http://www.northernlightstimberframing.com

                1 Reply Last reply Reply Quote 0
                • N Offline
                  noelwarr
                  last edited by

                  No offence was taken! 😛 The japanese just says I'm a carpenter too and lived (a short period of time) in Osaka a few years back. I was also not left unmoved by Japanese craftmanship when it comes to woodworking. We even ended up selling one of their products a few years back, here in Europe. http://mitaka.eu/
                  It's still the traditional side that gets to the heart 😎

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

                    Why no semi-colons? Seems that we're doing one-statements instead of one-liners then.

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

                    1 Reply Last reply Reply Quote 0
                    • jeff hammondJ Offline
                      jeff hammond
                      last edited by

                      @thomthom said:

                      Why no semi-colons?

                      meh..

                      view = Sketchup.active_model.active_view ; view = view.zoom 1.052

                      parallel projection -> zoom extents -> use the code for true zoom extents…
                      i use it sometimes for printing.
                      (also part of an applescript i use for easy printing to scale from sketchup)

                      dotdotdot

                      1 Reply Last reply Reply Quote 0
                      • N Offline
                        noelwarr
                        last edited by

                        Why not...

                        Sketchup.active_model.active_view.zoom(1.052)

                        Or to include the zoom extents...

                        Sketchup.active_model.active_view.zoom_extents.zoom(1.052)

                        Don't know how to activate the parallel projection though. Anyone?

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

                          Activate Parallel Projection for the current View's Camera:

                          @noelwarr said:

                          Don't know how to activate the parallel projection though. Anyone?

                          Sketchup.active_model.active_view.camera.perspective = false

                          I'm not here much anymore.

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

                            @unknownuser said:

                            view.zoom 1.052

                            Where does this magic number come from?

                            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

                              @thomthom said:

                              @unknownuser said:

                              view.zoom 1.052

                              Where does this magic number come from?

                              .. and it seems to work in Parallel Projection mode, but not in Perspective mode.

                              I'm not here much anymore.

                              1 Reply Last reply Reply Quote 0
                              • jeff hammondJ Offline
                                jeff hammond
                                last edited by

                                @noelwarr said:

                                Why not...

                                Sketchup.active_model.active_view.zoom(1.052)

                                Because I don't know ruby 😉
                                I just found something that worked for what I needed.
                                but your version doesn't use a semicolon so I'll make that my thread entry 😄

                                dotdotdot

                                1 Reply Last reply Reply Quote 0
                                • jeff hammondJ Offline
                                  jeff hammond
                                  last edited by

                                  @thomthom said:

                                  @unknownuser said:

                                  view.zoom 1.052

                                  Where does this magic number come from?

                                  by trying .05... then .06... then .055.. then .054.. etc 😄

                                  [edit-- hmm.. just checked my AppleScript and I'm actually using .053 in it.. that's the one I tested with actual paper/printer]

                                  dotdotdot

                                  1 Reply Last reply Reply Quote 0
                                  • N Offline
                                    noelwarr
                                    last edited by

                                    I've actually gone and changed my first post so that semi colons are allowed, and have modified your magic formula so the 3 steps are all in one line. I wanted no semicolons to avoid people going crazy with them (you could essentially write a whole program with them in one line of text). How about 3 semi colons maximum?

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

                                    Advertisement