sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    FaceMe Components have extra large BoundingBox?

    Scheduled Pinned Locked Moved Developers' Forum
    9 Posts 4 Posters 383 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.
    • Chris FullmerC Offline
      Chris Fullmer
      last edited by

      I am trying to work with the bounding boxes of components and I am finding that faceme components bounding boxes are not working as expected. So I wrote a little snipet of code that adds a c_point to all the corners of a bounding box. And sure enough, the face_me components bbox is extra-large. I figure it might have something to do with the fact that they can swivel, but that sort of does not seem logical. The large bbox does not really correspond to the size of the component or its axis or anything. So is this just a bug? or is it working as exected for reasons I'm thinking of? Here's the script exactly as I run it from the webconsole. Select a group and then run the code.

      model = Sketchup.active_model
      ents = model.entities
      sel = model.selection
      
      bbox = sel[0].bounds
      p1 = bbox.corner 0
      p2 = bbox.corner 1
      p3 = bbox.corner 2
      p4 = bbox.corner 3
      p5 = bbox.corner 4
      p6 = bbox.corner 5
      p7 = bbox.corner 6
      p8 = bbox.corner 7
      
      ents.add_cpoint p1
      ents.add_cpoint p2
      ents.add_cpoint p3
      ents.add_cpoint p4
      ents.add_cpoint p5
      ents.add_cpoint p6
      ents.add_cpoint p7
      ents.add_cpoint p8
      

      bbox_fun.png

      Any thoughts on this?

      Chris

      Lately you've been tan, suspicious for the winter.
      All my Plugins I've written

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

        Chris,
        (probably not understanding your question, but) when I import a file that has a component created as a face-me (rather than loose geometry with the file itself set as face-me) I get (why?) an extra large bounding box: so I expode the import and get the face-me with its normal sized bounding box...?
        Best, Tom.

        http://www.tomsdesk.moonfruit.com/
        2.5D Trees & Shrubs!

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

          Wierd. Here's a map/model of the corners of a boundingbox for the faceme cube component in the model as the view is rotated.

          face_me_bb.jpg
          face_me_bb.skp

          When the axis is moved to the middle of the compo, the corners move like this:

          face_me_bb2.jpg


          face_me_bb2.skp

          Hi

          1 Reply Last reply Reply Quote 0
          • Chris FullmerC Offline
            Chris Fullmer
            last edited by

            I'm going to guess that its related. I just don't know if its a bug or not. I think it probably is.....? In ruby there is a way to create bounding boxes that are not necessarily displayed. That is the bounding box I am having issues with - the one I can create in ruby. But I bet that somehow SU is confused somewhere.

            I have managed to go into the component and get all the points I need. But its a bit of a tedious workaround. And I'm still not done with it, so I might run into more issues down the road...

            Chris

            Lately you've been tan, suspicious for the winter.
            All my Plugins I've written

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

              Here's the webconsole code to make the pattern.

              
              model = Sketchup.active_model
              $entities = model.entities
              $selection = model.selection
              class MyViewObserver < Sketchup;;ViewObserver
              def onViewChanged(view)
              pts = ((0..7).map{|n| $selection[0].bounds.corner(n)})
              pts.each {|pt| $entities.add_cpoint(pt)}
              end
              end
              # Attach the observer.
              Sketchup.active_model.active_view.add_observer(MyViewObserver.new)
              
              

              Hi

              1 Reply Last reply Reply Quote 0
              • Chris FullmerC Offline
                Chris Fullmer
                last edited by

                Very cool Jim, thanks for the code to play with. That is quite interesting. I choose its a bug.

                Chris

                Lately you've been tan, suspicious for the winter.
                All my Plugins I've written

                1 Reply Last reply Reply Quote 0
                • AdamBA Offline
                  AdamB
                  last edited by

                  The bounds method gives you an AABB not an OBB, so it is expected behavior that it will be 'fat' when your object is rotated to be not aligned with the XYZ axes.

                  ie There is a difference between taking the BB in local space and transforming those (8) points into world space compared to transforming the object into world space and determining the BB (which is what SU does).

                  Move along..

                  Adam

                  Developer of LightUp Click for website

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

                    @adamb said:

                    The bounds method gives you an AABB not an OBB, so it is expected behavior that it will be 'fat' when your object is rotated to be not aligned with the XYZ axes.

                    I'm not sure what you mean by AA and O.

                    One of oddities in the images is that the points are a little more than "fat" - they are too big for being just the result of a bounding box created around rotated geometry. Another weird thing is that the points are above and below the compo in the Z direction.

                    Hi

                    1 Reply Last reply Reply Quote 0
                    • AdamBA Offline
                      AdamB
                      last edited by

                      Mea culpa

                      AABB = Axis aligned Bounding box (blue box)

                      OBB = Oriented Bounding box (red box)

                      SketchUpScreenSnapz035.png

                      Developer of LightUp Click for website

                      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