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

    Get Dimmensions plugin

    Scheduled Pinned Locked Moved Plugins
    10 Posts 3 Posters 3.3k 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.
    • D Offline
      dedmin
      last edited by

      Can somebody improve this very useful plugin? When the component is not aligned with the wold coordinates the reported dimensions are not accurate! Thanks in advance!

      GetDimensions.rb

      1 Reply Last reply Reply Quote 0
      • J Offline
        Jim
        last edited by

        Use .local_bounds instead of .bounds to get the BB in the first place.

        boundingBox = model.selection[0].local_bounds

        Wait... that doesn't seem to account for scaling... so it's not what I thought.

        Hi

        1 Reply Last reply Reply Quote 0
        • J Offline
          Jim
          last edited by

          This is based on code from Didier and TIG. It should work for selected Groups and Instances in any context, although I only tried it at model level.

          
          model = Sketchup.active_model
          entities = model.entities
          selection = model.selection
          
          e = selection[0]
          
          scale_x = ((Geom;;Vector3d.new 1,0,0).transform! e.transformation).length
          scale_y = ((Geom;;Vector3d.new 0,1,0).transform! e.transformation).length
          scale_z = ((Geom;;Vector3d.new 0,0,1).transform! e.transformation).length
          
          bb = nil
          if e.is_a? Sketchup;;Group
            bb = Geom;;BoundingBox.new
            e.entities.each {|en| bb.add(en.bounds) }
          elsif e.is_a? Sketchup;;ComponentInstance
            bb = e.definition.bounds
          end
          
          if bb
            width  = bb.width  * scale_x
            depth  = bb.depth  * scale_z
            height = bb.height * scale_y
            puts "#{width}, #{height}, #{depth}"
          end
          
          

          Hi

          1 Reply Last reply Reply Quote 0
          • D Offline
            dedmin
            last edited by

            Thanks, but where to put this code? ๐Ÿ˜’

            1 Reply Last reply Reply Quote 0
            • X Offline
              xrok1
              last edited by

              could someone post a screen shot of what this plug does? sounds very interesting.

              โ€œThere are three classes of people: those who see. Those who see when they are shown. Those who do not see.โ€

              http://www.Twilightrender.com try it!

              1 Reply Last reply Reply Quote 0
              • J Offline
                Jim
                last edited by

                Just pops a dialog showing the dimensions of the selected Group or Component.

                Hi

                1 Reply Last reply Reply Quote 0
                • D Offline
                  dedmin
                  last edited by

                  @xrok1 said:

                  could someone post a screen shot of what this plug does? sounds very interesting.

                  Untitled.jpg

                  1 Reply Last reply Reply Quote 0
                  • X Offline
                    xrok1
                    last edited by

                    ahh, bounding box dimensions. ๐Ÿ˜ž i was hoping it was some kind of auto dimesioning thing. ๐Ÿ˜ณ
                    thanks guys.

                    โ€œThere are three classes of people: those who see. Those who see when they are shown. Those who do not see.โ€

                    http://www.Twilightrender.com try it!

                    1 Reply Last reply Reply Quote 0
                    • J Offline
                      Jim
                      last edited by

                      I sent a plugin to dedmin to try. It shows the dimensions of a selected group or instance correctly eve when scaled and rotated. I'll post it when I hear back.

                      Hi

                      1 Reply Last reply Reply Quote 0
                      • J Offline
                        Jim
                        last edited by

                        Plugin posted here: http://forums.sketchucation.com/viewtopic.php?f=323&t=28851

                        Hi

                        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