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

    BOX SELECTION - ruby request

    Scheduled Pinned Locked Moved Developers' Forum
    30 Posts 5 Posters 847 Views 5 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

      Ahh true, and I think that could help immensely.

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

      1 Reply Last reply Reply Quote 0
      • Dave RD Offline
        Dave R
        last edited by

        @chris fullmer said:

        Yeah, but what if you DON'T want everything. You just want the first 15' of 100's of feet deep geometry. That is what I was thinking he meant.

        You have a point there.

        But if you wear a hat... πŸ˜„

        Etaoin Shrdlu

        %

        (THERE'S NO PLACE LIKE)

        G28 X0.0 Y0.0 Z0.0

        M30

        %

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

          The temporary 'box' [group] you draw will have a 3D boundingbox [let's call it bigbox].
          You then test for all model.active_entities that either have...
          some part of their boundingbox within the bigbox - mimics right-drag, OR
          their entire boundingbox within the bigbox - mimics left-drag...............

          Easy-peasy...

          TIG

          1 Reply Last reply Reply Quote 0
          • thomthomT Offline
            thomthom
            last edited by

            I was wondering if it was possible to just draw the selection box using a Tool class. Instead of using actual geometry?
            But you can't draw faces, only lines right? So a dummy group with transparent material is maybe more usable? I just imagine that it's useful to see transparent faces of the selectionbox to visually see how it intersects the model...

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

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

              I think you could define 3dpoints and use those to define the bounding box. And then visually represent it like Thom says in a tool draw method using view.draw GL_QUADS pts.

              I think the drawback there though is that I don't know if you can define the drawing color as partially transparent. So it would be a solid box.

              Maybe the actual geometry method is better?

              Chris

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

              1 Reply Last reply Reply Quote 0
              • H Offline
                harnstein
                last edited by

                @thomthom said:

                I just imagine that it's useful to see transparent faces of the selectionbox to visually see how it intersects the model...

                thats what i imagine, too. maybe could be a sphere too.
                so if some of you think about realizing this, could look like this:

                1. draw box / sphere
                2. group
                3. convert group to "bigbox"
                4. delete all entities within the box
                5. with message: "Do you want to keep the box? Y / N"

                so you can simply erase with the "3d-eraser" parts next to the erased area...

                still sketchin'

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

                  Ahh, actually deleting the geometry inside is a whole different tool. The discussion here has only been covering the idea of creatin a new selection tool. Fortunately for you, what you want already exists. Its called booltools.rb. Check it out.

                  Another way to do it manually would be to create your box and group it, move it in place, then right click on it and choose "intersect with model" and then delete what you don't want. But booltools will do that automatically for you.

                  Chris

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

                  1 Reply Last reply Reply Quote 0
                  • H Offline
                    harnstein
                    last edited by

                    Just grouping and intersecting is not working, i wanted to erase all closed objects and / or lines within the box- and leave bigger surrounding faces intersecting the "bigbox" untouched.

                    A box selection-tool would be really helpful too, thats what i imagined first, too. Having a box, selecting line-clusters- then they get nicely blue and i can erase them all- or move or scale or whatever.

                    I think, the booltools is just a more direct way to group -> intersect -> erase, right?

                    still sketchin'

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

                      Yes, booltools is a more direct way to do the intersect with model actions.

                      So if you are still interested in a 3d selection tool, that should be do-able. a sphere might be too complex for now though,

                      Chris

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

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

                        Thinking about this, bounding boxes always work on the x,y,z axis, right? So it won't work because the bounding box of a cube that is drawn off axis, will not actually match its faces.

                        Chris

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

                        1 Reply Last reply Reply Quote 0
                        • thomthomT Offline
                          thomthom
                          last edited by

                          Make a virtual one out of the vertices?

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

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

                            Nah, because if you add your 8 vertices to it, it will still align itself to the global axes, and not to the vertices. This is from the API

                            @unknownuser said:

                            Bounding boxes are three-dimensional boxes (eight corners), aligned with the global axes, that surround entities within your model
                            .

                            Hmm, but thinking about it, components bounding boxes rotate with them. So is there a way to rotate a bounding box, or at least use a rotated component's bounding box for the selection testing? That might be promising.

                            Chris

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

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

                              Nope, I just tested it. A rotated compenent appears to have a rotated bounding box, but that is just a visual thing. When you get the component.bounds, it is not rotated, it is still aligned to the world axes.

                              EDIT: Which just means that using .bounds won't work for this 3d selection box idea, but it should still be possible.

                              Chris

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

                              1 Reply Last reply Reply Quote 0
                              • thomthomT Offline
                                thomthom
                                last edited by

                                Isn't there a local_bounds method?

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

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

                                  Not that I'm seeing in the API. That would sure be handy though!

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

                                  1 Reply Last reply Reply Quote 0
                                  • thomthomT Offline
                                    thomthom
                                    last edited by

                                    I remember it being mentioned in the initial SU API Blog of the SU7 announcement. Though not what it was related to.

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

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

                                      sure enough:

                                      Measure your groups regardless of their transform
                                      untransformed_bb = my_group.local_bounds

                                      That should be interesting to play with. I've gotta get some sleep though.

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

                                      1 Reply Last reply Reply Quote 0
                                      • thomthomT Offline
                                        thomthom
                                        last edited by

                                        Only for groups it turns out. From the Docs:

                                        @unknownuser said:

                                        The local_bounds method returns the BoundingBox object that defines the size of the group in an untransformed state. Useful for determining the original width, height, and depth of a group regardless of its current position or scale. For components, you can get a similar result by checking my_instance.definition.bounds.

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

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

                                          ... So, make a temporary group of the instance and get the local_bounds if that, then explode it back as it was...

                                          TIG

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

                                          Advertisement