sketchucation logo sketchucation
    • Login
    โ„น๏ธ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Right Click Edit

    Scheduled Pinned Locked Moved Developers' Forum
    12 Posts 4 Posters 667 Views 4 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.
    • S Offline
      scetchnscribble
      last edited by

      hey thanks I tried that and it worked... but when i look over this code I only see the context menu listed at the beginning as a comment. How does the script run it if it is only a comment? Is this script calling another external script that i am overlooking?

      **```
      #-----------------------------------------------------------------------------

      Name ; Window Maker 1.0

      Description ; A tool to create parametric Double Hung and Slider windows.

      Menu Item ; Tools->Windows

      Context Menu; Edit Window

      Usage ; Select window type and then specify the size.

      ; If the size needs to be changed after inserting into the model,

      ; right click on the window and select "Edit Window".

      Date ; 9/10/2004

      Type ; Dialog Box

      #-----------------------------------------------------------------------------

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

        That code in the first post is the entire script?

        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

          @chris fullmer said:

          That code in the first post is the entire script?

          Chris

          No - it include's @last's Parametric.rb - as TIG mentioned. And the Window class it works with extends a Parametric class which I can only assume is from parametric.rb - so I'm guessing the parametric.rb contains the context-menu code.

          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

            require 'parametric.rb'
            calls that ruby, so look at that file too...

            TIG

            1 Reply Last reply Reply Quote 0
            • S Offline
              scetchnscribble
              last edited by

              @unknownuser said:

              require 'parametric.rb'
              Thanks I did check that and there was no sign of anything, I still have no clue.

              @unknownuser said:

              That code in the first post is the entire script?
              Yup thats the entire script. sure it requires sketchup.rb and parametric.rb, but a lot of scripts do.

              I downloaded it right from the google website Window Maker http://sketchup.google.com/download/rubyscripts.html

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

                Read to the end of the file parametric.rb and you will find...

                #=============================================================================
                # Add a context menu handler that will add a menu choice to a context menu
                # for editing parametric objects
                if( not $parametric_loaded )
                    UI.add_context_menu_handler do |menu|
                        klass = Parametric.selection_parametric?
                        if( klass )
                            menu.add_separator
                            menu.add_item("Edit #{klass}") { Parametric.edit_selection }
                        end
                    end
                    $parametric_loaded = true
                end
                

                which looks suspiciously like the code for a context-menu ? ๐Ÿ˜ฎ

                TIG

                1 Reply Last reply Reply Quote 0
                • S Offline
                  scetchnscribble
                  last edited by

                  @tig said:

                  which looks suspiciously like the code for a context-menu ? ๐Ÿ˜ฎ

                  yeah i did another test and some how its passing the class name to parametric.rb but how? is it through the following code?
                  **```
                  def create_entity(model)
                  #TODO; try to find existing definition matching the parameters
                  @entity = model.definitions.add self.compute_name

                  1 Reply Last reply Reply Quote 0
                  • S Offline
                    scetchnscribble
                    last edited by

                    so my question now is if I require another script, such as, parametric.rb does that mean it loads the script and allows me to pass methods and variables back and forth between the two scripts? ๐Ÿ˜•

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

                      class Window < Parametric
                      means that Window 'extends' [builds upon OR uses] the Parametric class - i.e. it's like they are parts of the same code: so making a Window gives it certain properties through the Parametric code, later on the property found in a selected object can trigger the Parametric 'checker' and make the context-menu appear, adjusted to suit the exact type of 'parametric' object that it is...
                      Window needs Parametric to work - it can't stand alone - if you were to remove parametric.rb Window wouldn't work...
                      They work in tandem.
                      Parametric can be used by lots of different scripts for other objects requiring similar dialogs etc...

                      TIG

                      1 Reply Last reply Reply Quote 0
                      • S Offline
                        scetchnscribble
                        last edited by

                        thanks, great explanation. I'm guessing nothing in parametric.rb is actually specifically changed to work with windows.rb and it is the windows.rb script that utilizes the methods and variables in the parametric.rb script. i'll keep working at it

                        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