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

    [Plugin] Superglue

    Scheduled Pinned Locked Moved Plugins
    81 Posts 18 Posters 42.0k Views 18 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.
    • thomthomT Offline
      thomthom
      last edited by

      Are you trying to clue the component onto a face directly, or is the face wrapped in a group/component?

      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

        When you place a component from the Component-Browser it is put onto your cursor at that component's origin, this is necessary because the origin [axes] must be put down snapped onto a face so that the instance will be assigned that face which it can then 'glue' and 'cut'.
        If you copy an already placed instance using Move+Ctrl you need to pick a point on the face that the instance is glued to [or a corner of the instance that is on that face]; then when you pick a new face the component will again find a face to glue/cut. BUT if you pick a point that's off the original's glued face then you won't be able to snap the copy onto another face because it'll always be placed non-planar to a face.
        Similarly, if your cutting component has geometry [like a frame/surround or a projecting-sill] that projects in front of the plane of the wall face [and therefore the cut hole] when you use Edit>Copy and then Edit>Paste the cursor that's locked on to the copy is placed NOT always at the copy's 'origin' BUT sometimes at its bounding-box minimum extents, which isn't then going to be the component's 'origin' [especially if the source instance is itself not glued to a face] - so when you snap it onto a face it will not find any face that is coincident with its origin, so there's no gluing and therefore no cut. I suspect that SuperGlue - like other '[re]gluing' tools - looks for a face below the instance's origin and if it can't then find one then there's no gluing and therefore no cutting. A component that's located with its origin a few mm away a face is just as 'unconnected' to that face as if it were placed meters away in empty space.
        Conversely, if you have a 'flush' cutting component with no projections in front of the wall face it will Copy/Paste quite satisfactorily, as in this case the cursor will be in the same plane as the component's origin [even if it's perhaps not on the origin itself] and so subsequent snapping of it onto a face will this time find that face coincident with the origin, and which it can then use to glue/cut...
        Hence you can get seemingly odd behavior across different types of gluing/cutting components when they are copied, IF you fail to appreciate what is happening with the object's geometry and the cursor...
        To see it in action try making a completely flush cutting component and also another version with very large projecting sill [500mm!], use the Component-Browser to place instances of both into a wall and then watch where the cursor is located during subsequent copy/paste operations and the success/failure to glue/cut for the copies, and copies of copies, or copies of non-glued instances etc πŸ€“

        TIG

        1 Reply Last reply Reply Quote 0
        • dereiD Offline
          derei
          last edited by

          My last thought is that in original model was some small deviation from "coplanar" ... because as i said before, I wrapped everything in a component, I saved as new file, then opened and it cut hole by copying and by placing from Component Browser.
          In original model it did not cut hole by copying, just by placing new component from Component Browser. When I copied I was on face with the cursor. I tested that by exploding the component and it merged with the face.

          DESIGNER AND ARTIST [DEREI.UK](http://derei.uk/l)

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

            If the component has non-coplanar parts you might get the cursor no longer being in the face when the copy is snapped.
            Can you save_as the component and post it so we can have a better idea of what's going on... πŸ˜•

            TIG

            1 Reply Last reply Reply Quote 0
            • brewskyB Offline
              brewsky
              last edited by

              Great little plugin! πŸ˜„
              Found it thanks to the new Extention Warehouse, should have seen this years ago!

              It would be great if you could add a "glue" option to the context menu(below the standard "unglue" option).

              Cheers!
              Jan

              Sketchup BIM-Tools - http://sketchucation.com/forums/viewtopic.php?p=299107

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

                @brewsky said:

                It would be great if you could add a "glue" option to the context menu(below the standard "unglue" option).

                Good idea!

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

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

                  Though... not quite sure how to work out what face to glue it to...

                  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

                    The re-glue tool in my HolePunch tool works out the instance.transformation and gets the .origin and .zaxis and looks for a face in the instance.parent.entities that shares the same normal as the .zaxis and also that has a good classify_point result for the .origin ... So it is possible...

                    TIG

                    1 Reply Last reply Reply Quote 0
                    • brewskyB Offline
                      brewsky
                      last edited by

                      @thomthom said:

                      Though... not quite sure how to work out what face to glue it to...

                      Checking every face in the active collection for a common plane with the component could probably get slow...
                      http://www.sketchup.com/intl/en/developer/docs/ourdoc/geom.php#intersect_plane_plane
                      If that's too slow, maybe only check if a cutting component AND a face are selected?

                      Sketchup BIM-Tools - http://sketchucation.com/forums/viewtopic.php?p=299107

                      1 Reply Last reply Reply Quote 0
                      • brewskyB Offline
                        brewsky
                        last edited by

                        @tig said:

                        a good classify_point result for the .origin ...

                        Didn't think of that, you are right, you need a classify_point otherwise it could glue to a face on the same plane a mile off! πŸ˜„

                        Sketchup BIM-Tools - http://sketchucation.com/forums/viewtopic.php?p=299107

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

                          Wonder what performance that has. ..but I guess it doesn't need to be fast...

                          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

                            You don't need to iterate every face in the array from:
                            faces=instance.parent.entities.grep(SketchUp::Face)
                            The loop can break when a face with a matching normal && classify_point match is found and you do the re-glue.
                            That means on average you only need to look at ~50% of the faces to get a re-glue.
                            On a bad day you need to look through all of the faces, only to find it's the last one == slowest possible re-glue; or there are no suitable faces at all == a "no-glue" !
                            On your lucky day you might look at the first face and find it's a match == instant re-glue...

                            TIG

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

                              True that. Will give it a bash. Thanks.

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

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

                              Advertisement