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

    Clipping When drawing from a Tool

    Scheduled Pinned Locked Moved Developers' Forum
    10 Posts 3 Posters 942 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.
    • J Offline
      Jim
      last edited by

      When drawing temporary geometry from a Tool, the geometry often gets clipped. There is a tool.getExtents method which sounds like exactly what I need to fix this.

      From the docs:

      @unknownuser said:

      In a typical implementation, you will create a new BoundingBox, add points to set the extents of the drawing that the tool will do and then return it.

      But, how can I get the size of the BoundingBox?

      Hi

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        See http://download.sketchup.com/sketchuphelp/gsu6_ruby/Docs/Ruby-BoundingBox.html#new

        Make a new bounding box - 'new', then 'add' a min point and a max point to it that are well away from where you are at, and you are then drawing geometry within the bbox...

        You could dynamically add points to the bbox as you move your cursor to ensure that you are still within the bbox ?

        If you don't make abbox that's the size of your geometry you can get weird things with groups etc. In the past I have drawn a long diagonal line, which makes the bounds increase and then erased it later BUT the 'add' a point method works...

        TIG

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

          Thanks TIG,

          I still don't know how to calculate how big to make the bounding box. Maybe I can use the camera distance to origin as an estimate...

          Hi

          1 Reply Last reply Reply Quote 0
          • TIGT Offline
            TIG Moderator
            last edited by

            @jim said:

            Thanks TIG,

            I still don't know how to calculate how big to make the bounding box. Maybe I can use the camera distance to origin as an estimate...

            Why not get the model's bounding box and x10(0)(00) its min and max ? IF you know how big you are making the geometry then you should be able to make a point equal to where you are defining (or picking) and that'd enlarge the bounding box to suit ?

            TIG

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

              Oh, I see, but I am starting with a blank model - there is nothing to add to the bbox.

              Hi

              1 Reply Last reply Reply Quote 0
              • TIGT Offline
                TIG Moderator
                last edited by

                @jim said:

                Oh, I see, but I am starting with a blank model - there is nothing to add to the bbox.

                Then make the temporary bbox far bigger than you'd ever expect the drawn geometry to be ?

                Clear the temp bbox at the end and the model's bbox then becomes the bbox of the geometry you just made ?

                TIG

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

                  If the drawing is getting clipped, it's because you have drawn geometry to get clipped (In other words, you have drawn Geometry, and it is getting clipped).

                  Since you have thus have physical geometry to work with, you can dump all the points from entities the comprise your drawn geometry into a temporary bounding box, just like TIG suggested. You can then use this temporary bbox to pass to tool.getExtents.

                  Todd

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

                    @unknownuser said:

                    If the drawing is getting clipped, it's because you have drawn geometry to get clipped (In other words, you have drawn Geometry, and it is getting clipped).

                    Since you have thus have physical geometry to work with, you can dump all the points from entities the comprise your drawn geometry into a temporary bounding box, just like TIG suggested. You can then use this temporary bbox to pass to tool.getExtents.

                    Todd

                    It's the lines drawn from within the tool (view.draw) that are getting clipped, not any user-drawn geometry. In this case, there is not yet geometry to add to a BoundingBox.

                    Hi

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

                      Not a problem. Just use the view points then.

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

                        The thing with a Bounding Box is - it's virtual. You don't have to have any geometry to create and populate a bounding box.

                        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