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

Getting bounding box in custom axis

Scheduled Pinned Locked Moved Developers' Forum
10 Posts 3 Posters 546 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.
  • P Offline
    Pixero
    last edited by 10 Dec 2010, 18:16

    I need to find the bounding box max and min for a selection in a custom axis.
    Is there a way to find the min and max vertices position from a custom axis such as for example the view direction?
    Is there another better way?

    1 Reply Last reply Reply Quote 0
    • D Offline
      Dan Rathbun
      last edited by 10 Dec 2010, 20:07

      see Group.local_bounds

      I'm not here much anymore.

      1 Reply Last reply Reply Quote 0
      • P Offline
        Pixero
        last edited by 10 Dec 2010, 20:57

        Thanks, but would it work for getting the bounds for the selection in the view direction? Something like this.
        Viewbounds.jpg

        1 Reply Last reply Reply Quote 0
        • D Offline
          Dan Rathbun
          last edited by 10 Dec 2010, 21:16

          No.. sorry.. now (with your pic,) I see what you want.

          If you could temporarily align the axis to the view, then the bounds would return what you want. BUT.. the API does not allow access to the Axis as a Ruby object.

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • D Offline
            Dan Rathbun
            last edited by 10 Dec 2010, 21:19

            It may be possible to temporarily transform the selection to align to the view, then change the camera to align to the axis, get your bounds, then reset the view, and undo the tranformation.

            I'm not here much anymore.

            1 Reply Last reply Reply Quote 0
            • P Offline
              Pixero
              last edited by 10 Dec 2010, 21:27

              I'm thinking loud here:
              Would it be possible to get the bounding box for the selection the ordinary way and then compare the min and max values of the bounding box in the Camera.xaxis and Camera.yaxis to see which is highest and lowest and use those values to generate a "view bounding box"? No idea how to do it though...

              1 Reply Last reply Reply Quote 0
              • T Offline
                thomthom
                last edited by 11 Dec 2010, 15:57

                @pixero said:

                Thanks, but would it work for getting the bounds for the selection in the view direction? Something like this.
                [attachment=0:7iscdulp]<!-- ia0 -->Viewbounds.jpg<!-- ia0 -->[/attachment:7iscdulp]

                Project the position of the vertices in the selection to the screen and use the projected points to create a new boundingbox?

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

                1 Reply Last reply Reply Quote 0
                • P Offline
                  Pixero
                  last edited by 11 Dec 2010, 16:39

                  I dreamt the solution last night and so far it's working. A few things to fix though. 😄
                  What I'm doing is to get the bounding box of the selection the regular way.
                  Then make a copy of the boundingbox points in a array and rotate them around the center to match the camera rotation. Then test those rotated points in worldspace to see which are max and min for the different x, y, z axis and then use the corresponding bbox.corner index to create a new rotated bounding box.
                  Easy peasy.... perhaps not, but it seems to work.
                  By the way, any good example how to test the points to see which is max and min?

                  1 Reply Last reply Reply Quote 0
                  • D Offline
                    Dan Rathbun
                    last edited by 11 Dec 2010, 16:56

                    BoundingBox.max

                    BoundingBox.min

                    In addition, the Ruby standard Array class has the Enumerable module mixed in, which gives all Arrays a max and min method.

                    In the Sketchup API, Point3d class is compatible with Array.

                    I'm not here much anymore.

                    1 Reply Last reply Reply Quote 0
                    • P Offline
                      Pixero
                      last edited by 11 Dec 2010, 16:59

                      Thanks.

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

                      Advertisement