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

    Load Toolbars

    Scheduled Pinned Locked Moved Developers' Forum
    7 Posts 3 Posters 232 Views 3 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.
    • BurkhardB Offline
      Burkhard
      last edited by

      I start to set my own Toolbar to load the single Toolbars with a one Button solution.

      I use for the start:

      def thea_show

      User::ToolbarSet["Thea Exporter"].show()

      end #def

      @cmd = UI::Command.new("Thearender") { thea_show }
      @cmd.small_icon = "../images/th.png"
      @cmd.large_icon = "../images/th.png"
      @cmd.tooltip = "Thea Render"

      ( The cmd are for Jim's Toolbar Plugin )

      This works for four of six Buttons. ( Shaderlight and the Thea Exporter do not open )
      Is there a reason why some toolbars wont open and some do?

      Thanks Burkhard


      Render.png

      [http://www.ia-plus.de(http://www.ia-plus.de)]

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

        thea_show ?
        If you type that in the Ruby Console does it work ??

        TIG

        1 Reply Last reply Reply Quote 0
        • BurkhardB Offline
          Burkhard
          last edited by

          With Thea Exporter not but with Maxwell ..Yes

          ...and don't ask why...I just tried a few things πŸ˜‰


          maxwell.png

          [http://www.ia-plus.de(http://www.ia-plus.de)]

          1 Reply Last reply Reply Quote 0
          • BurkhardB Offline
            Burkhard
            last edited by

            This works too (Thea For SketchUp), just Shaderlight and Thea Exporter failed.

            def theaskp_show

            User::ToolbarSet["Thea For SketchUp"].show()

            end #def

            @cmd = UI::Command.new("Thearender") { theaskp_show }
            @cmd.small_icon = "../images/ths.png"
            @cmd.large_icon = "../images/ths.png"
            @cmd.tooltip = "Thea Render for Sketchup"

            [http://www.ia-plus.de(http://www.ia-plus.de)]

            1 Reply Last reply Reply Quote 0
            • BurkhardB Offline
              Burkhard
              last edited by

              Found a workaround. It needs to be refresh, so I build in a refresh Button with:
              User::ToolbarSet.refresh() (Thanks to Dan http://sketchucation.com/forums/viewtopic.php?f=180&t=51432 )
              So, if a Toolbar is not loaded, it works after refresh the hash πŸ˜†

              [http://www.ia-plus.de(http://www.ia-plus.de)]

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

                (A) Any script that is going to access User::ToolbarSet should have a require call at the top like:
                require('user/toolbarset.rb')
                whose argument is whatever the dir and filename you used.

                This way you be sure that the User module and ToolbarSet hash have been created.

                (B) Ruby UI:Toolbar objects are created in the order that scripts are run.
                1) Alphabetical according to their filename
                2) as they are specified in require() calls

                (Which can change the alpha order.)

                (C) My suggestion is to name YOUR custom toolbar script so that it loads LAST, by using "X_my_toolbars.rb" or something, as it's filename. Then the require call, as shown in (A) at the top of this file, would create the User::ToolbarSet hash AFTER all other toolbars have been created.

                πŸ’­

                I'm not here much anymore.

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

                  @burkhard said:

                  Found a workaround. It needs to be refresh, ...
                  So, if a Toolbar is not loaded, it works after refresh the hash.

                  The Toolbar WAS loaded, but UI::Toolbar references are NOT automatically added into the custom User::ToolbarSet hash.

                  SO.. I created the UI::Toolbar.refresh() method to find any new toolbars (created after the hash was populated,) and add them.

                  I WILL NOT modify the API's UI::Toolbar class constructor method, in a public script, because I feel it is a violation of the API Terms of Use.

                  BUT perhaps we can modify the User::ToolbarSet hash's [] method's error Proc, so that it refreshes the hash automatically.
                  See: http://sketchucation.com/forums/viewtopic.php?f=180&t=51432&p=466742#p466742

                  πŸ’­

                  I'm not here much anymore.

                  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