sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    One Face that Should Be Two...

    Scheduled Pinned Locked Moved Developers' Forum
    5 Posts 3 Posters 151 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.
    • K Offline
      kwalkerman
      last edited by

      Hi,

      I have code that takes loose geometry, groups it, intersects it and then does something with the pieces. Most of the time everything is groovy, but I'm having an issue I'm not sure how to resolve. In the image, you can see that the selected face is one face that "should" be two.The green faces should be two faces.

      I've tried intersecting entities, doing "edge.find_faces" on all the face's edges, but I haven't come up with a good solution yet (short of deleting the face and re-creating it, but that could cause other issues).

      Any ideas?

      Thanks!

      --
      karen

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

        It is known...
        This sometimes occurs when complex 2d shapes intersect.

        My fix is add a short [referenced] temp-edge inside a temp-group, set perpendicular to the face [face.normal] at each of the face.vertices.
        You can perhaps now make each edge have zero length [make its two vertices share the same point] BUT you can skip this step if you are sure there's no risk of geometry clashes in the face.parent context when the edge's temp-group is exploded.
        Then explode each edge's temp-group in turn.
        Now try to erase each temp-edge in turn [it might not now exist... so trap for failure with e.valid?]...
        This method should now split the face.edges at any cross-threaded 'bow-tie' vertices.
        Making the faces as two separate entities, each with its own loop...

        The nesting of these methods can be quite convoluted, BUT it will fix it...

        TIG

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

          My solution of yesterday was made from a similar 2d face issue.
          However, my brain must have carried on working while I slept!
          As this is a 3d problem it's easier: after you intersect everything it might split some intersecting faces [here vertical 'red'] but leave the top/bottom faces as 'bow-ties' [here green], but we can find any edges with 4 faces instead of 2 [which incidentally means its no longer a 'solid', every edge in a manifold solid must have exactly 2 faces] and then just update those with an explode ? Something like this [assuming 'ents' is the entities context containing the faces/edges]...

          tgp=ents.add_group() ents.each{|e|tgp.entities.add_line(e.vertices)if e.is_a?(Sketchup::Edge)&&e.faces[2]} tgp.explode if tgp.entities[0]

          It's 'untested', but you get the idea...

          TIG

          1 Reply Last reply Reply Quote 0
          • Dan RathbunD Offline
            Dan Rathbun
            last edited by

            Just wonderin' as we were discussing this in another topic...

            ... would Sketchup.send_action("fixNonPlanarFaces:") do anything in this case?

            I'm not here much anymore.

            1 Reply Last reply Reply Quote 0
            • K Offline
              kwalkerman
              last edited by

              @unknownuser said:

              ... would Sketchup.send_action("fixNonPlanarFaces:") do anything in this case?

              ... I should've saved the file with the messed up face to try it on!

              I ended up with something similar to TIG's suggestion,except that I found any vertices referenced more than two edges on the same face. Then I was able to re-create the faces using the original face's vertices.

              --
              Karen

              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