sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Ruby Sketchup Scriting - Help required! Losing hair!

    Scheduled Pinned Locked Moved Developers' Forum
    9 Posts 6 Posters 1.0k 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.
    • L Offline
      Levethian
      last edited by Levethian

      Hello πŸ˜„

      I have been registered here for a while, and this is my first post.

      A short background: - I'm in my 6th and final year studying Architecture at Newcastle University, and am doing an 'Emergent Digital Design Methods' module which results in the hand-in of a scripted working prototype of an architectural model, either in ArchiCAD, 3D Studio Max, or whatever else. Two-thirds of us have chosen Ruby & SketchUp, since SketchUp is so very widespread.

      I know what I want my script to achieve, and have examples of scripts that achieve it in small parts. Cannibalised and combined, I should be on my way. But translating parts of scripts to work within my own has exposed my massive lack of knowledge of programming (we haven't been specifically taught it) and time is beginning to run short.

      I'm fumbling around with trail and error (mostly error) in Notepad++ & Sketchup, with reference to the Sketchup Ruby API and using the Ruby Console.

      I'd hope to be able to compensate excessively useful information or tutorials that prove to work..!

      So... 😳

      I have a block of code which intends to create variations of gothic arch. All it does so far is to:

      Prompt a UI popup asking the user to enter 3 parametric variables ["Base Height", "Base Width", "Arch Height"] and select 2 drop-down menu variations ["Type", "Glazing"].

      http://i77.photobucket.com/albums/j78/Levethian/6.jpg?t=1261419676

      http://i77.photobucket.com/albums/j78/Levethian/7.jpg?t=1261419678

      Prompts 7 other new drop-down menus. ["Rows", "Variation"].

      http://i77.photobucket.com/albums/j78/Levethian/3.jpg?t=1261419061

      http://i77.photobucket.com/albums/j78/Levethian/8.jpg?t=1261419678

      Based on the parametric variables, the rest of the code designates points to draw, and draws the wire-frame of 20 types of archway.

      http://i77.photobucket.com/albums/j78/Levethian/4.jpg?t=1261419137

      http://i77.photobucket.com/albums/j78/Levethian/9.jpg?t=1261419679

      ...And that is all. The parametric parameters and equations for the points function as expected.

      ❓ My problems start as follows:

      I don't want the 7 pop-up menus to prompt, and I don't want all the arch type wire-frames to load at once. 2 menus max should prompt depending on the user-selection of 'types'. How do I link the values of "types" [0, 1, 2, 3] to blocks of code to load? Do I need to implement a data system?:

      http://i77.photobucket.com/albums/j78/Levethian/2.jpg?t=1261419059

      Or can either of these problems be addressed by 'If True Then Else' commands?

      My second problem is that I'd like to incorporate 'TubeAlongPath' by TIG (c) 7/2005 to automatically select the wire-frame, so that once the frame is loaded, TIG's prompt for the TubeAlongPath starts. The result should be something like:

      http://i77.photobucket.com/albums/j78/Levethian/10.jpg?t=1261419680

      My final problem will be to include functionality which allows the groups to be instantiated as a component which snaps to planes and cuts into surfaces. (I think this would involve the overhaul of the point-arrays to include 'origin' instead of (0, 0, 0), and then tell the origin to be user-defined..)

      http://i77.photobucket.com/albums/j78/Levethian/11.jpg?t=1261420435

      (from reference script)

      I'd be really grateful for any help, and would be pleased to make up for useful contributions (since I have a Thesis to worry about as well!). My many days of experimentation have yielded very few eureka-moments, unfortunately 😞
      There needs to be a blind-panic smiley.

      Deadline is 20 days away.

      Thanks,
      Andrew

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

        Note sure about the prompts thing. Maybe I need to read it againt - I just can't get my head to wrap around what you're asking. Sorry.

        Invoking TIG's pipe plugins: you want to know how to trigger it?

        Cutout components. you need to orient what you draw so the edges that you want to cut the hole is oriented on the XY plane on Z level 0.

        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

          Hi
          I've PM'd you...
          You can't effectively call TubbeAongPath directly but you could cannibalize its code...
          Making a Gothic window that's scripted is quite a first Ruby β˜€

          TIG

          1 Reply Last reply Reply Quote 0
          • GaieusG Offline
            Gaieus
            last edited by

            @tig said:

            ...Making a Gothic window that's scripted is quite a first Ruby β˜€

            Wow, I was also just turning my head around this.
            If it weren't your first post and you didn't misunderstand me, I'd say this is nuts!
            But cool, also (my first, real, major project was in fact some Gothic stuff).

            Should this not be in the developers' forum, BTW?

            And sorry for the offtopic post - take it as welcome πŸ˜‰

            Gai...

            1 Reply Last reply Reply Quote 0
            • EscapeArtistE Offline
              EscapeArtist
              last edited by

              That's impressive for a script. As a big fan of Gothic architecture, I wish you luck on completing your project. Wish I could help, but I don't know the first thing about scripting.

              1 Reply Last reply Reply Quote 0
              • L Offline
                Levethian
                last edited by

                Thanks for the replies πŸ˜„

                @thomthom said:

                Note sure about the prompts thing. Maybe I need to read it againt - I just can't get my head to wrap around what you're asking. Sorry.

                Thats okay πŸ˜„ - at the moment, all the pop-ups activate. I want the user to be able to select which pop-ups activate using the answers to the first pop-up.

                @thomthom said:

                Invoking TIG's pipe plugins: you want to know how to trigger it?

                I would like to incorporate it within my script (fully credited, of course), so that it selects the wire frame and then triggers.

                TIG has agreed to help, so we'll see how it goes πŸ˜‰

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

                  any news here?

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

                    @toto ete said:

                    any news here?

                    I helped him out [via PMs] - he met his deadline and is now probably in an alcohol induced coma πŸ˜‰

                    TIG

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

                      πŸ˜†

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

                      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