sketchucation logo sketchucation
    • 登入
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    ⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update

    BOX SELECTION - ruby request

    已排程 已置頂 已鎖定 已移動 Developers' Forum
    30 貼文 5 Posters 1.2k 瀏覽 5 Watching
    正在載入更多貼文
    • 從舊到新
    • 從新到舊
    • 最多點贊
    回覆
    • 在新貼文中回覆
    登入後回覆
    此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
    • H 離線
      harnstein
      最後由 編輯

      Hi there!

      I'm thinking of a ruby the converts a ordinary box into a "selection-box" it often comes to me, that i want to select many entities by drawing selection-square from the right side (everything crossed is selected) or from the left side (only the entities, which a completely inside the box are selected)- but because its 3d there are often some entities far BEHIND the ones i'd like to select. You sometimes want that, but often you don't.

      Somebody got an idea?

      still sketchin'

      1 條回覆 最後回覆 回覆 引用 0
      • Chris FullmerC 離線
        Chris Fullmer
        最後由 編輯

        So you want a selection tool that only looks at what is visible?

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

        1 條回覆 最後回覆 回覆 引用 0
        • thomthomT 離線
          thomthom
          最後由 編輯

          @chris fullmer said:

          So you want a selection tool that only looks at what is visible?

          I think he's asking for a 3D selection box. One that lies in 3D space, not in 2D over the viewport.

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

          1 條回覆 最後回覆 回覆 引用 0
          • Chris FullmerC 離線
            Chris Fullmer
            最後由 編輯

            Hmm, that's an interesting idea. Seems like it would work.

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

            1 條回覆 最後回覆 回覆 引用 0
            • thomthomT 離線
              thomthom
              最後由 編輯

              How would you check if things are inside the selection box?

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

              1 條回覆 最後回覆 回覆 引用 0
              • H 離線
                harnstein
                最後由 編輯

                @thomthom said:

                How would you check if things are inside the selection box?

                apply a transparent material and orbit around it 😉

                still sketchin'

                1 條回覆 最後回覆 回覆 引用 0
                • Chris FullmerC 離線
                  Chris Fullmer
                  最後由 編輯

                  I think he meant in the ruby script. That's a good question. I suppose define it as a bounding box and iterate through the model to determine what entities bounds lie within the selection bounding box.

                  I suppose that could become time intensive always having to go through all the entities in the model like that. Should work though, right?

                  Chris

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

                  1 條回覆 最後回覆 回覆 引用 0
                  • Dave RD 離線
                    Dave R
                    最後由 編輯

                    As a work around I toggle the camera to Parallel Projection and choose an appropriate standard view. then the 2D selection box gets everything no matter how far from the camera it is.

                    Etaoin Shrdlu

                    %

                    (THERE'S NO PLACE LIKE)

                    G28 X0.0 Y0.0 Z0.0

                    M30

                    %

                    1 條回覆 最後回覆 回覆 引用 0
                    • H 離線
                      harnstein
                      最後由 編輯

                      @dave r said:

                      As a work around I toggle the camera to Parallel Projection and choose an appropriate standard view. then the 2D selection box gets everything no matter how far from the camera it is.

                      yep, i do that too, but how do you select different entities on different levels? i just wanted the opposite 😉 not to select the far objects, only the near.

                      still sketchin'

                      1 條回覆 最後回覆 回覆 引用 0
                      • Chris FullmerC 離線
                        Chris Fullmer
                        最後由 編輯

                        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.

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

                        1 條回覆 最後回覆 回覆 引用 0
                        • thomthomT 離線
                          thomthom
                          最後由 編輯

                          @chris fullmer said:

                          I think he meant in the ruby script. That's a good question. I suppose define it as a bounding box and iterate through the model to determine what entities bounds lie within the selection bounding box.

                          I suppose that could become time intensive always having to go through all the entities in the model like that. Should work though, right?

                          Chris

                          I think so. I'm wondering if we could save some processing time and not check the entities inside groups/components, instead just using the group/component's boundingbox? Only checking the active entities.

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

                          1 條回覆 最後回覆 回覆 引用 0
                          • Chris FullmerC 離線
                            Chris Fullmer
                            最後由 編輯

                            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 條回覆 最後回覆 回覆 引用 0
                            • Dave RD 離線
                              Dave R
                              最後由 編輯

                              @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 條回覆 最後回覆 回覆 引用 0
                              • TIGT 離線
                                TIG Moderator
                                最後由 編輯

                                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 條回覆 最後回覆 回覆 引用 0
                                • thomthomT 離線
                                  thomthom
                                  最後由 編輯

                                  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 條回覆 最後回覆 回覆 引用 0
                                  • Chris FullmerC 離線
                                    Chris Fullmer
                                    最後由 編輯

                                    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 條回覆 最後回覆 回覆 引用 0
                                    • H 離線
                                      harnstein
                                      最後由 編輯

                                      @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 條回覆 最後回覆 回覆 引用 0
                                      • Chris FullmerC 離線
                                        Chris Fullmer
                                        最後由 編輯

                                        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 條回覆 最後回覆 回覆 引用 0
                                        • H 離線
                                          harnstein
                                          最後由 編輯

                                          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 條回覆 最後回覆 回覆 引用 0
                                          • Chris FullmerC 離線
                                            Chris Fullmer
                                            最後由 編輯

                                            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 條回覆 最後回覆 回覆 引用 0
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • 第一個貼文
                                              最後的貼文
                                            Buy SketchPlus
                                            Buy SUbD
                                            Buy WrapR
                                            Buy eBook
                                            Buy Modelur
                                            Buy Vertex Tools
                                            Buy SketchCuisine
                                            Buy FormFonts

                                            Advertisement