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

    [Plugin] bim-tools 0.13.4(june 22, 2015)

    Scheduled Pinned Locked Moved Plugins
    206 Posts 37 Posters 218.9k Views 37 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.
    • brewskyB Offline
      brewsky
      last edited by

      I've been able to remove the dependency on pathname and it's running now on SU7 and SU8.

      Although one (probably showstopper) problem remains. Auto-updating of modified objects does not work on SU7 because the "EntitiesObserver.onElementModified" method was added in SU8.
      That means updating geometry must be done manually by disabling and re-enabling the observers (red/green button).

      New version added to this post, I will add it to the plugin store when I also fixed the MAC issue, but that has to wait a little until I get my hands on a MAC πŸ˜‰


      bim-tools-0.13.3.rbz

      Sketchup BIM-Tools - http://sketchucation.com/forums/viewtopic.php?p=299107

      1 Reply Last reply Reply Quote 0
      • brewskyB Offline
        brewsky
        last edited by

        Hi Dan,

        I also removed a "tap"-call because it was added in ruby 1.9.
        Would you consider this a good substitute? Or would it be much slower?

        hash = {}.tap{ |r| bt_entities.each{ |ent| ent.properties_editable.each{ |k,v| (r[k]||=[]) << v } } }
        
        hash = bt_entities.inject({}) {|h,ent| ent.properties_editable.each{ |k,v| (h[k]||=[]) << v}; h}
        

        something I borrowed from:
        http://stackoverflow.com/questions/5490952/merge-array-of-hashes-to-get-hash-of-arrays-of-values

        Sketchup BIM-Tools - http://sketchucation.com/forums/viewtopic.php?p=299107

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

          .
          Well the 1st thing I had to do is proper indentation:

          hash = {}.tap {|r|
            bt_entities.each {|ent|
              ent.properties_editable.each {|k,v|
                (r[k]||=[]) << v
              } 
            } 
          }
          
          

          and

          hash = bt_entities.inject({}) {|h,ent|
            ent.properties_editable.each {|k,v|
              (h[k]||=[]) << v
            }
            h
          }
          
          

          Then the 2nd thing, is that Ruby is designed for easily read and understood code. (Why I like it so much.)

          I do not understand why some coders go out of their way, to write minimalist hard to read and understand code. Come back 3 years from now and see if the coder remembers what the code is supposed to do, without spending a half hour consulting method documentation, etc.

          3. Re., inject(), in the past in pre-YARV Ruby, it was notoriously slow. But things have gotten better.

          4. My opinion of tap() is that it might be nifty, but it will serve mostly to contribute to ugly code.

          5. I'd just do it simple like this:

          
          hash = Hash;;new {|h,key| h[key]=[] }
          
          bt_entities.each {|ent|
            ent.properties_editable.each {|k,v| hash[k] << v }
          } 
          
          

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • brewskyB Offline
            brewsky
            last edited by

            @dan rathbun said:

            .
            I do not understand why some coders go out of their way, to write minimalist hard to read and understand code. Come back 3 years from now and see if the coder remembers what the code is supposed to do, without spending a half hour consulting method documentation, etc.

            LOL Thank you very much! I totally agree with you. It indeed seemed a nifty piece of code I found on stackoverflow, but every time I needed to edit it, it took me half an hour to re-interpret it(and I'm still not 100% sure how the tap works).
            Now you write it out it does not seem so difficult anymore πŸ˜„
            I should have added the indentation myself the moment I tried to understand what it did πŸ˜•

            Sketchup BIM-Tools - http://sketchucation.com/forums/viewtopic.php?p=299107

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

              @brewsky said:

              ... and I'm still not 100% sure how the tap works πŸ˜•

              It is very similar to the map! / collect! methods for Enumerable objects. So you could use map! in place of tap for arrays.

              But, in Ruby 2.0, tap is defined in Object, not just enumerable classes, so every object can "tap" into a block of code that can change and then return itself.

              So tap is kind of like a general purpose "bang" method, but designed for especially for chaining so it always returns it's receiver object, whether it made changes or not. ("Bang" methods usually return nil when they do not make changes to the receiver, making them unsuitable for method chaining.)

              I'm not here much anymore.

              1 Reply Last reply Reply Quote 0
              • brewskyB Offline
                brewsky
                last edited by

                Fix for mac! Menu layout needs some work still.
                Check out the plugin store πŸ˜„

                Sketchup BIM-Tools - http://sketchucation.com/forums/viewtopic.php?p=299107

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

                  Thank you for Mac fix.
                  Successfully loaded and working.

                  1 Reply Last reply Reply Quote 0
                  • brewskyB Offline
                    brewsky
                    last edited by

                    @twillm said:

                    Successfully loaded and working.

                    Great! πŸ˜„

                    Sketchup BIM-Tools - http://sketchucation.com/forums/viewtopic.php?p=299107

                    1 Reply Last reply Reply Quote 0
                    • A Offline
                      awadrummer
                      last edited by

                      Does anyone know if this plugin is compatible with Sketchup Pro 2018? I'm looking to upgrade, but can't live without this one.

                      Thanks,

                      Chris B.

                      1 Reply Last reply Reply Quote 0
                      • brewskyB Offline
                        brewsky
                        last edited by

                        @awadrummer said:

                        Does anyone know if this plugin is compatible with Sketchup Pro 2018?

                        I did a little test and I ran into some issues for su2018 😞
                        I will try to find some time to look into them...

                        @awadrummer said:

                        I'm looking to upgrade, but can't live without this one.

                        Great to hear you like it!

                        Sketchup BIM-Tools - http://sketchucation.com/forums/viewtopic.php?p=299107

                        1 Reply Last reply Reply Quote 0
                        • A Offline
                          awadrummer
                          last edited by

                          @brewsky said:

                          @awadrummer said:

                          Does anyone know if this plugin is compatible with Sketchup Pro 2018?

                          I did a little test and I ran into some issues for su2018 😞
                          I will try to find some time to look into them...

                          @awadrummer said:

                          I'm looking to upgrade, but can't live without this one.

                          Great to hear you like it!

                          Thank you Brewsky! The only issue I've found with 2018 is it freezes/takes a long time to process, but I generally have ALOT of lines. With that being said it is still usable. Thanks for your help and designing this awesome plugin!

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

                          Advertisement