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

    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.
    • PixeroP Offline
      Pixero
      last edited by

      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
      • Dan RathbunD Offline
        Dan Rathbun
        last edited by

        see Group.local_bounds

        I'm not here much anymore.

        1 Reply Last reply Reply Quote 0
        • PixeroP Offline
          Pixero
          last edited by

          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
          • Dan RathbunD Offline
            Dan Rathbun
            last edited by

            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
            • Dan RathbunD Offline
              Dan Rathbun
              last edited by

              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
              • PixeroP Offline
                Pixero
                last edited by

                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
                • thomthomT Offline
                  thomthom
                  last edited by

                  @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
                  • PixeroP Offline
                    Pixero
                    last edited by

                    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
                    • Dan RathbunD Offline
                      Dan Rathbun
                      last edited by

                      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
                      • PixeroP Offline
                        Pixero
                        last edited by

                        Thanks.

                        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