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

    How to create a face with a hole touching its edge?

    Scheduled Pinned Locked Moved Developers' Forum
    13 Posts 5 Posters 417 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.
    • icehuliI Offline
      icehuli
      last edited by icehuli

      Does anyone has know how to create a face with a hole in it, while vertices of the hole may touch the edge of the face. See the attached figure f2 touches f1 at point P. I tried to create f1 and f2, then call f2.erase!. But this does not work.


      update:
      I tried the plugin 2d-simplex-bool
      http://extensions.sketchup.com/en/content/2d-simplex-bool
      It seems not working neither.


      one working code from TIG's idea:
      e = Sketchup.active_model.entities f1 = e.add_face [1,1,0],[8,1,0],[4,5,0] f2 = e.add_face [2,2,0],[7,2,0],[4,4,0] ed = f1.edges[0] f1.erase! ed.find_faces; f2.erase!


      twofaces.PNG

      1 Reply Last reply Reply Quote 0
      • tt_suT Offline
        tt_su
        last edited by

        @icehuli said:

        But this does not work.

        How does it not work? Errors? Unexpected result?

        Got a snippet of what you got so far?

        1 Reply Last reply Reply Quote 0
        • icehuliI Offline
          icehuli
          last edited by

          @tt_su said:

          @icehuli said:

          But this does not work.

          How does it not work? Errors? Unexpected result?

          Got a snippet of what you got so far?

          I executed the following code:

          When f2 does NOT touch f1, I get the face with a hole as I expected, see the attached new figure
          e = Sketchup.active_model.entities f1 = e.add_face [1,1,0],[8,1,0],[4,5,0] f2 = e.add_face [2,2,0],[%(#0000FF)[**6**],2,0],[4,4,0] f2.erase!

          When f2 does touch f1, I can not get the face with a hole. A hole is not subtracted from f1.
          e = Sketchup.active_model.entities f1 = e.add_face [1,1,0],[8,1,0],[4,5,0] f2 = e.add_face [2,2,0],[%(#0000FF)[**7**],2,0],[4,4,0] f2.erase!


          twofaces_erased.PNG

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

            Always add the inner face, and then add the outer face.
            Then the inner face should erase as you hope. πŸ€“

            TIG

            1 Reply Last reply Reply Quote 0
            • tt_suT Offline
              tt_su
              last edited by

              @tig said:

              Always add the inner face, and then add the outer face.
              Then the inner face should erase as you hope. πŸ€“

              Tried that, didn't work for me.

              I also tried to intersect; group & explode; nuffin' worked. The dark force is string with this geometry.

              1 Reply Last reply Reply Quote 0
              • icehuliI Offline
                icehuli
                last edited by

                strong dark force !!! 😑

                Another case does not work!

                I can not get the correct offset of the left polygon. The hole is not empty in Sketchup.


                twofaces_erased.PNG

                1 Reply Last reply Reply Quote 0
                • S Offline
                  slbaumgartner
                  last edited by

                  @tt_su said:

                  @tig said:

                  Always add the inner face, and then add the outer face.
                  Then the inner face should erase as you hope. πŸ€“

                  Tried that, didn't work for me.

                  I also tried to intersect; group & explode; nuffin' worked. The dark force is string with this geometry.

                  Works when you draw on the GUI in the order TIG suggests, but I also can't get it to work via Ruby. Where are the Jedi when we need them?

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

                    Try making the inner face then using find_faces on the added outer edges, rather than making that face directly.
                    Then the inner face should then be retained for erase!, and the outer one remains as a loop.

                    The reason your API 'offset' leaves a hole and SketchUp doesn't is [I suspect] along these lines too...

                    TIG

                    1 Reply Last reply Reply Quote 0
                    • icehuliI Offline
                      icehuli
                      last edited by

                      @tig said:

                      Try making the inner face then using find_faces on the added outer edges, rather than making that face directly.
                      Then the inner face should then be retained for erase!, and the outer one remains as a loop.

                      The reason your API 'offset' leaves a hole and SketchUp doesn't is [I suspect] along these lines too...

                      Hi TIG,

                      I am not sure I understand you well. Could you post the code, that how exactly should I do it? Thanks in advance!

                      1 Reply Last reply Reply Quote 0
                      • jolranJ Offline
                        jolran
                        last edited by

                        That's a bug. Won't intersect either.

                        I wonder if it's related to this problem.. Some funny thing going on here,
                        although this is done by hand.

                        Face is recognized somehow although deleted..


                        materialVanish.jpg

                        1 Reply Last reply Reply Quote 0
                        • jolranJ Offline
                          jolran
                          last edited by

                          πŸ‘

                          Not too much code either.

                          1 Reply Last reply Reply Quote 0
                          • icehuliI Offline
                            icehuli
                            last edited by

                            @tig said:

                            Try making the inner face then using find_faces on the added outer edges, rather than making that face directly.
                            Then the inner face should then be retained for erase!, and the outer one remains as a loop.

                            The reason your API 'offset' leaves a hole and SketchUp doesn't is [I suspect] along these lines too...

                            GREAT!!!! You are the Jedi!!! 😍

                            so the code is:
                            e = Sketchup.active_model.entities f1 = e.add_face [1,1,0],[8,1,0],[4,5,0] f2 = e.add_face [2,2,0],[7,2,0],[4,4,0] ed = f1.edges[0] f1.erase! ed.find_faces; f2.erase!

                            1 Reply Last reply Reply Quote 0
                            • icehuliI Offline
                              icehuli
                              last edited by

                              Some observations.....
                              The sketchup offset tool is not consistent. It does not always provide the same result....sometime gives the left, sometime gives the right.
                              They are slightly different.
                              Both results have two faces, a bigger face and a small one(the hole).
                              The bigger face is selected in both results, while the small one is not selected.
                              On the left, the small one is separated from the bigger face, i.e. the bigger face contains a hole.
                              On the right, the small one is overlapped with the bigger face, i.e. the bigger face does not contain a hole.
                              .......


                              offset_diff.PNG

                              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