• Login
sketchucation logo sketchucation
  • Login
ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

[Plugin] TT_Lib²

Scheduled Pinned Locked Moved Plugins
310 Posts 66 Posters 394.0k Views
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.
  • T Offline
    thomthom
    last edited by 22 Oct 2010, 20:25

    @jim said:

    Thom, have you generated docs for this lib? I appreciate that you are thinking in terms of re-use, and your code is clean and clear. Is this licensed so that other people can use it also?

    I have some docs generated. But the comments are not complete. It's still taking shape and some things will be changed.
    I'll try to make a note on the modules that are WIP and include more examples. If you have questions about particulars just let me know and I can push them up on the update list.

    For the brave, here is the current output: http://www.thomthom.net/software/sketchup/tt_lib2/doc/ (for TT_Lib 2.5 mind you)

    (Anyone knows how to modify YARDs templates so the constant lists will be more compact?)

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

    1 Reply Last reply Reply Quote 0
    • J Offline
      Jim
      last edited by 22 Oct 2010, 20:38

      Guess I could run yard myself... heh.

      Hi

      1 Reply Last reply Reply Quote 0
      • T Offline
        thomthom
        last edited by 14 Nov 2010, 10:15

        Just a preview of one of the GUI gizmos I'm working on.

        [flash=640,385:378bq4x9]http://www.youtube.com/v/hA0H_Txfjd4?fs=1&hl=en_US[/flash:378bq4x9]

        Code to generate the windows:

        
        #-----------------------------------------------------------------------------
        # Compatible; SketchUp 7 (PC)
        #             (other versions untested)
        #-----------------------------------------------------------------------------
        #
        # Thomas Thomassen
        # thomas[at]thomthom[dot]net
        #
        #-----------------------------------------------------------------------------
        
        require 'sketchup.rb'
        require 'TT_Lib2/core.rb'
        
        TT;;Lib.compatible?('2.4.0', 'Inputbox Test')
        
        #-----------------------------------------------------------------------------
        
        
        module TT;;Plugins;;InputboxTest
          
          ### CONSTANTS ### --------------------------------------------------------
          
          VERSION = '1.0.0'
          
          
          ### MENU & TOOLBARS ### --------------------------------------------------
          
          unless file_loaded?( File.basename(__FILE__) )
            m = TT.menu('Plugins').add_submenu('TT;;GUI')
            m.add_item('TT;;GUI;;Inputbox')     { self.test_inputbox }
            m.add_item('TT;;Plugins;;CleanUp')  { self.test_cleanup }
          end 
          
          
          ### MAIN SCRIPT ### ------------------------------------------------------
          
          def self.test_inputbox
            options = {
              ;title => 'TT;;GUI;;Inputbox',
              ;pref_key => 'TT;;GUI;;Inputbox',
              ;modal => true,
              ;accept_label => 'Save',
              ;cancel_label => 'Abort'
            }
            i = TT;;GUI;;Inputbox.new(options)
            i.add_control( {
              ;label => 'Hello',
              ;value => 'World',
              ;description => 'Lorem ipsum <b>dolor</b> sit amet.',
            } )
            i.add_control( {
              ;label => 'Checkbox1',
              ;value => true
            } )
            i.add_control( {
              ;label => 'Checkbox2',
              ;value => false
            } )
            i.add_control( {
              ;label => 'Integer',
              ;value => 123
            } )
            i.add_control( {
              ;label => 'Float',
              ;value => 1.23
            } )
            i.add_control( {
              ;label => 'Length',
              ;value => 1.23.m
            } )
            ms = Sketchup.active_model.materials
            i.add_control( {
              ;label => 'Dropdown List1',
              ;value => (ms.current) ? ms.current.display_name ; nil,
              ;options => ms.map { |m| m.display_name },
              ;description => 'Unordered ordered.'
            } )
            i.add_control( {
              ;label => 'Dropdown List2',
              ;value => (ms.current) ? ms.current.display_name ; nil,
              ;options => ms.map { |m| m.display_name },
              ;order => 1,
              ;natrual_order => true,
              ;description => 'Naturally ordered.'
            } )
            i.add_control( {
              ;label => 'List1',
              ;value => (ms.current) ? ms.current.display_name ; nil,
              ;options => ms.map { |m| m.display_name },
              ;order => -1,
              ;natrual_order => true,
              ;description => 'Naturally ordered reversed.',
              ;size => 5
            } )
            i.add_control( {
              ;label => 'List2',
              ;value => ms.to_a[0..1].map { |m| m.display_name },
              ;options => ms.map { |m| m.display_name },
              ;order => -1,
              ;natrual_order => true,
              ;description => 'Multiple Selection.',
              ;size => 5,
              ;multiple => true
            } )
            i.add_control( {
              ;label => 'Radioboxes1',
              ;value => 'Hello World',
              ;options => ['Hello World', 'Lorem Ipsum', 'Foo Bar'],
              ;type => TT;;GUI;;Inputbox;;CT_RADIOBOX
            } )
            i.add_control( {
              ;label => 'Radioboxes2',
              ;value => 'Monkeys',
              ;options => ['Cheese', 'Monkeys'],
              ;type => TT;;GUI;;Inputbox;;CT_RADIOBOX
            } )
            i.prompt { |results|
              puts 'Results returned;'
              p results
              #puts i.get_html
            }
          end
          
          
            def self.test_cleanup
            options = {
              ;title => 'TT;;Plugins;;CleanUp',
              ;pref_key => 'TT;;Plugins;;CleanUp',
              ;modal => true,
              ;accept_label => 'CleanUp',
              ;cancel_label => 'Cancel',
              ;align => 0.3
            }
            i = TT;;GUI;;Inputbox.new(options)
            i.add_control( {
              ;label => 'Scope',
              ;value => 'Local',
              ;options => ['Selected', 'Local', 'Model'],
              ;type => TT;;GUI;;Inputbox;;CT_RADIOBOX,
              ;group => 'General'
            } )
            i.add_control( {
              ;label => 'Validate Results',
              ;value => true,
              ;group => 'General'
            } )
            i.add_control( {
              ;label => 'Merge Coplanar Faces',
              ;value => true,
              ;group => 'Coplanar Faces'
            } )
            i.add_control( {
              ;label => 'Ignore Normals',
              ;value => false,
              ;group => 'Coplanar Faces'
            } )
            i.add_control( {
              ;label => 'Ignore Materials',
              ;value => false,
              ;group => 'Coplanar Faces'
            } )
            i.add_control( {
              ;label => 'Ignore UV',
              ;value => true,
              ;group => 'Coplanar Faces'
            } )
            i.add_control( {
              ;label => 'Remove Duplicate Faces',
              ;value => false,
              ;group => 'Faces'
            } )
            i.add_control( {
              ;label => 'Repair Split Edges',
              ;value => true,
              ;group => 'Edges'
            } )
            i.add_control( {
              ;label => 'Remove Lonely Edges',
              ;value => true,
              ;group => 'Edges'
            } )
            i.add_control( {
              ;label => 'Remove Edge Materials',
              ;value => false,
              ;group => 'Edges'
            } )
            i.add_control( {
              ;label => 'Smooth Edges by Angle',
              ;value => 0.0,
              ;group => 'Edges'
            } )
            i.prompt { |results|
              puts 'Results returned;'
              p results
              #puts i.get_html
            }
          end
          
          
          ### DEBUG ### ------------------------------------------------------------
          
          def self.reload
            TT;;Lib.reload
            load __FILE__
          end
        
        end # module
        
        #-----------------------------------------------------------------------------
        
        file_loaded( File.basename(__FILE__) )
        
        #-----------------------------------------------------------------------------
        
        

        Also thinking of adding more wrappers to create windows entirely from Ruby - buttons, lists, dropdowns etc...


        input_test.rb

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

        1 Reply Last reply Reply Quote 0
        • J Offline
          Jim
          last edited by 14 Nov 2010, 14:33

          @thomthom said:

          Also thinking of adding more wrappers to create windows entirely from Ruby - buttons, lists, dropdowns etc...

          This approach will win. 👍

          Hi

          1 Reply Last reply Reply Quote 0
          • T Offline
            thomthom
            last edited by 14 Nov 2010, 15:04

            When I made Vertex Tools I had a similar system for the toolbar system. A set of classes that acted as wrappers for the controls. The main classes where Container and Control - they would have most of the code. From there it was easier to create sub-classes like toolbars and buttons. I then had a very nice abstract layer where I created a toolbar class - where I added Button objects.
            Complex systems though - but I hope to have a base system by the new year.

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

            1 Reply Last reply Reply Quote 0
            • J Offline
              jeffschaid01
              last edited by 5 Feb 2011, 20:41

              Hello,
              I'm having a problem with the program crashing at 49% when exporting as a vrml. I've imported my bmp image, sized, indexed points and generated the mesh. Any suggestions?

              Thanks,
              Jeff

              1 Reply Last reply Reply Quote 0
              • T Offline
                thomthom
                last edited by 6 Feb 2011, 10:01

                @jeffschaid01 said:

                Hello,
                I'm having a problem with the program crashing at 49% when exporting as a vrml. I've imported my bmp image, sized, indexed points and generated the mesh. Any suggestions?

                Thanks,
                Jeff

                Are you referring to Bitmap to Mesh?

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

                1 Reply Last reply Reply Quote 0
                • GaieusG Offline
                  Gaieus
                  last edited by 6 Feb 2011, 15:46

                  Yes, he is.

                  Gai...

                  1 Reply Last reply Reply Quote 0
                  • T Offline
                    thomthom
                    last edited by 7 Feb 2011, 18:33

                    Version 2.5.1

                    • Fixes Webdialog issues with IE7

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

                    1 Reply Last reply Reply Quote 0
                    • T Offline
                      thomthom
                      last edited by 10 Feb 2011, 09:04

                      Version 2.5.2
                      Important bugfix!

                      • Fixed bug in the method that repair broken edges.

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

                      1 Reply Last reply Reply Quote 0
                      • T Offline
                        thomthom
                        last edited by 10 Feb 2011, 13:23

                        Version 2.5.3
                        Important bugfix!

                        • Fixed again repair broken edges.

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

                        1 Reply Last reply Reply Quote 0
                        • GaieusG Offline
                          Gaieus
                          last edited by 10 Feb 2011, 15:05

                          TT, I got this message while overwriting the old library (meaning that the file I marked is write-protected). When I wanted to overwrite anyway, it wanted a password so I could not.

                          Is it an issue if I do not update that particular file?


                          tt-api-so.png

                          Gai...

                          1 Reply Last reply Reply Quote 0
                          • T Offline
                            thomthom
                            last edited by 10 Feb 2011, 15:17

                            @gaieus said:

                            TT, I got this message while overwriting the old library (meaning that the file I marked is write-protected)

                            It's not write protected on my computer. Nor in the zip file.

                            @gaieus said:

                            When I wanted to overwrite anyway, it wanted a password so I could not.

                            I have no idea what this can be. I've never seen Windows ask for that. Are you using some third party applications to manage files?
                            What did you use to extract the files? Did you extract directly over the files?
                            What if you delete, then extract?

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

                            1 Reply Last reply Reply Quote 0
                            • GaieusG Offline
                              Gaieus
                              last edited by 10 Feb 2011, 15:34

                              It's simply Win XP "extract (or open?) all files" when I enter the zip archive (yes, I was simply overwriting the existing install). Here is the dialog that asks for the password:

                              pw.png
                              I then tried to delete the file but it said omething was using it. It was obviously SU as when I closed it, I could delete it and install the library correctly. This made me think however so I tried to reinstall it (now as it had been installed the file again) and with the SU window closed, it allowed me to.

                              So maybe a line in the front post to "close SU before installing" would be useful (people need to restart SU anyway).

                              Gai...

                              1 Reply Last reply Reply Quote 0
                              • Dave RD Offline
                                Dave R
                                last edited by 10 Feb 2011, 23:13

                                Csaba, I got a similar message about that .so file when I extracted the ZIP file to the Plugins folder. SketchUp was open. So I closed SketchUp and tried again. It worked fine then. I wonder if that file is write protected when SU is open and the file is in use.

                                Etaoin Shrdlu

                                %

                                (THERE'S NO PLACE LIKE)

                                G28 X0.0 Y0.0 Z0.0

                                M30

                                %

                                1 Reply Last reply Reply Quote 0
                                • T Offline
                                  thomthom
                                  last edited by 11 Feb 2011, 07:31

                                  @dave r said:

                                  It worked fine then. I wonder if that file is write protected when SU is open and the file is in use.

                                  I sounds like SketchUp keeps a lock on the file when it's loaded. Probably because it's binary code instead of interpreted Ruby.

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

                                  1 Reply Last reply Reply Quote 0
                                  • R Offline
                                    rasstappen
                                    last edited by 30 May 2011, 14:33

                                    Sweet thanks-

                                    Rasstappen

                                    1 Reply Last reply Reply Quote 0
                                    • T Offline
                                      thomthom
                                      last edited by 17 Jun 2011, 17:52

                                      Version 2.5.4
                                      This update requires that you also update:

                                      • Edge Tools ( 2.0.3 )
                                      • Plan Tools ( 1.2.2 )
                                      • CleanUp ( 3.1.4 )

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

                                      1 Reply Last reply Reply Quote 0
                                      • Rich O BrienR Offline
                                        Rich O Brien Moderator
                                        last edited by 17 Jun 2011, 18:01

                                        Will TT_Lib ever be superseded by this? I know there are plugins that still require TT_Lib but it'd be nice to have all yours captured under TT_Lib2

                                        Download the free D'oh Book for SketchUp

                                        1 Reply Last reply Reply Quote 0
                                        • T Offline
                                          thomthom
                                          last edited by 17 Jun 2011, 18:03

                                          Selection Toys is the only one that requires TT_Lib version 1.
                                          Until Selection Toys is rewritten, into version 3, TT_Lib can not be made obsolete.

                                          The other plugins use TT_Lib 2 however.

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

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

                                          Advertisement