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

    Question about palettes

    Scheduled Pinned Locked Moved Developers' Forum
    22 Posts 4 Posters 1.9k 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.
    • thomthomT Offline
      thomthom
      last edited by

      Doesn't hide it all the way - also toggles toll up/down, but works on both platforms: UI.show_inspector( 'Layers' )
      http://code.google.com/apis/sketchup/docs/ourdoc/ui.html#show_inspector

      For list of valid strings, use UI.inspector_names
      http://code.google.com/apis/sketchup/docs/ourdoc/ui.html#inspector_names

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

      1 Reply Last reply Reply Quote 0
      • CadFatherC Offline
        CadFather
        last edited by

        thanks Thom, so i should go the 'closeau' route....i'll check it out... just hope i can get them to hide at some point

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

          This code toggleWindows.rb is based on some ideas by Jim.
          It's useful for toggling the Outliner so it's rolledup, as it can cause splats during intensive processing if open...
          I've recently added the ' closeWindow' method.
          name='Layers' - or other window name.
          toggleRollUp(name) toggles the rollup of the window specified by 'name'.
          isRolledUp(name) returns true/false if window specified by 'name' is rolled-up/rolled-down.
          closeWindow(name) closes the window specified by 'name'.
          It required ' Win32API.so' I've attached a zipped version if you don't have it - unzip it into the Plugins folder...Win32API.ziptoggleWindows.rb

          TIG

          1 Reply Last reply Reply Quote 0
          • CadFatherC Offline
            CadFather
            last edited by

            Thanks master TIG - this is amazing!

            one last question..

            how would i have given two send action commands?

            just by this, and each command gets executed as the scripts is read down?

            def togz
            Sketchup.send_action 21354
            Sketchup.send_action 21926
            end
            
            1 Reply Last reply Reply Quote 0
            • TIGT Offline
              TIG Moderator
              last edited by

              Your method should execute the two actions in order, BUT I've not tried it.
              It should first open Layers, or roll it up/down if it's already open.
              Then it would close all open palettes which is not what you really need ?

              I think you'd be better off opening the Layers palette with the first set of code... and then use the isRolledUp() test to roll it down with toggleRollUp() if it was already open and you code just rolled it up.
              E.G. Sketchup.send_action 21354 toggleRollUp('Layers') if isRolledUp('Layers')
              This ensures that the Layers palette window is opened and rolled down, even if it was already open but rolled up!
              Later when you are done with it use closeWindow('Layers') to close just that specified window...

              TIG

              1 Reply Last reply Reply Quote 0
              • CadFatherC Offline
                CadFather
                last edited by

                ok thanks TIG, it's going to be a full afternoon trying to get that in my head, but that example helps a lot! πŸ˜’ πŸ˜†

                but if i get this right, there is no way to have just one button to fully show or fully hide the palette..

                in previous versions it was easier..

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

                  Yes there is. πŸ˜’
                  You start the script running with a variable that persists across usages so to set it if the tools never been used yet...
                  When the user clicks the button the tool has these tests...
                  At the start @open is nil so use
                  ` if @open==1 ### it WAS clicked ON earlier, so it's probably ON

                  now check if it's open and close it if it is.

                  'close code'

                  but if it's already been closed [manually?] do nothing but this...

                  @open=0
                  else ### it's either been clicked OFF, or it has not yet been clicked at all

                  now check if it's closed and open it if it is.

                  'open code'

                  but if it's already open do nothing but this...

                  @open=1
                  end`
                  πŸ˜•

                  TIG

                  1 Reply Last reply Reply Quote 0
                  • CadFatherC Offline
                    CadFather
                    last edited by

                    wow...didn't know what i was asking...! 😲

                    I shall study it veery slowly.. Thanks TIG - you basically wrote it yourself..

                    1 Reply Last reply Reply Quote 0
                    • CadFatherC Offline
                      CadFather
                      last edited by

                      wow, this is terrible... just when i think i 'understand'...

                      this is the code:

                      def togz
                      name='Scenes'
                      if @open==1 	### it WAS clicked ON earlier, so it's probably ON
                      toggleRollUp(name) if isRolledUp(name)  	### now check if it's open and close it if it is.
                      closeWindow(name) 	### 'close code'
                      ### but if it's already been closed [manually?] do nothing but this...
                      @open=0
                      else ### it's either been clicked OFF, or it has not yet been clicked at all
                      togglecloseWindow(name) if iscloseWindow(name)  ### now check if it's closed and open it if it is.
                      Sketchup.send_action 21354 ### 'open code'
                      ### but if it's already open do nothing but this...
                      @open=1
                      end
                      end #def
                      

                      and this is the error when i type togz into the ruby console...

                      Error: #<NoMethodError: undefined method `iscloseWindow' for main:Object>
                      C:/Program Files (x86)/Google/Google SketchUp 8/Plugins/- - togz.rb:14
                      (eval):155

                      i have placed both toggleWindows.rb and win32api.so in the plugins folder (and i saw there is a def called closeWindow in toggleWindows.rb) πŸ˜• πŸ˜• πŸ˜•

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

                        I've added a 'windowIsVisible(name)' test to the toggleWindows code.toggleWindows.rb This code below does what you want...

                        
                        require 'toggleWindows.rb'
                          def toggleLayersWindow()
                            if @toggle==1
                              if windowIsVisible('Layers')
                                closeWindow('Layers')
                              else
                                Sketchup.send_action(21354)
                              end
                              @toggle=0
                            else
                              if windowIsVisible('Layers')
                                if not @toggle ### 1st go
                                  if isRolledUp('Layers')
                                    toggleRollUp('Layers')
                                  else
                                    closeWindow('Layers')
                                  end          
                                else
                                  closeWindow('Layers')
                                end
                              else
                                Sketchup.send_action(21354)
                              end
                              @toggle=1
                            end#if
                          end#def
                        

                        πŸ€“

                        TIG

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

                          Along with a require 'toggleWindows.rb' to ensure it's loaded before accessing the code.

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

                          1 Reply Last reply Reply Quote 0
                          • CadFatherC Offline
                            CadFather
                            last edited by

                            that's not fair TIG - you're hacking your own code! πŸ˜†

                            i'll give it a spin..

                            ok folks, seriously what the heck have you got in those brains...i'm thinking of early retirement.. πŸ˜’

                            Thank You

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

                              Ain't no backing out now! πŸ˜‰

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

                              1 Reply Last reply Reply Quote 0
                              • CadFatherC Offline
                                CadFather
                                last edited by

                                you must be joking, i'm going out for a drink to forget!

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

                                  You'll be drinking binary

                                  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

                                    Note that TIG's current example works on English Sketchup only. It needs a bit of work to retrieve the localized window titles from the exe's resources, in order to work for all language locale editions.

                                    I'm not here much anymore.

                                    1 Reply Last reply Reply Quote 0
                                    • CadFatherC Offline
                                      CadFather
                                      last edited by

                                      that's true.. it works fine, but it greys out many context commands on starting SU... πŸ‘Ž

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

                                        How are you making the commands? - make one only attached to the toolbar.
                                        The reason for the grey-outs is 'too many commands'.
                                        It's possible to accidentally create a new command every time it's used...

                                        TIG

                                        1 Reply Last reply Reply Quote 0
                                        • CadFatherC Offline
                                          CadFather
                                          last edited by

                                          i went through most plugins commands, numbered them all differently (e.g. cmd1, cmd2, etc)

                                          also got rid of some plugins - right now it works - but i'm keeping an eye...

                                          many thanks again TIG... i owe you quite a few pints! πŸ˜„

                                          1 Reply Last reply Reply Quote 0
                                          • CadFatherC Offline
                                            CadFather
                                            last edited by

                                            ok, updated version with better commands and icons. works fine on my pc

                                            TogglePanels.zip

                                            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