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

    [Plugin] 2dBoolean ver1.3.1 beta UPDATE 20 dec 2013

    Scheduled Pinned Locked Moved Plugins
    88 Posts 8 Posters 48.8k Views 8 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.
    • jolranJ Offline
      jolran
      last edited by

      I'm having trouble with this part of the code. Maybe should add some parameters to it?

      faces.each{|gface|
      pt=gface.bounds.center.project_to_plane(face.plane)
      if face.classify_point(pt)==Sketchup;;Face;;PointOutside
      tedges << gface.edges
      gface.erase!
      end
      }
      

      If you look at the picture, you will see that it might not work in all cases with that code.
      Especially when having big faces.

      In the earlier posts I was trying to figure out a way to erase faces more selectively.
      By using IF the FACES center==HOLES center >> erase.faces! (Simplified code)

      However, when I did that, sometimes there where errors. Or faces that would not get deleted.


      Faced with a problem-2.jpg

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

        The .flatten! combines nested arrays
        The .uniq! removes duplicates
        Also [not applicable to THIS tool] .compact! would remove 'nil' array elements, or .sort! puts the list 'in order'...

        Now to the chase.........
        I also see this 'unexpected' possibility of faces we want to keep being false-flagged as 'holes'.
        So we need to trap for real 'hole' faces - the outer_loop edges will always have two faces...

        faces2go=[]### rather than erase as we go we'll collect them...
        faces.each{|gface|
          ### we skip the gface IF it's NOT a 'hole'
          ### just 1 one-faced edges is enough for != hole
          hole=true
          gface.outer_loop.edges.each{|e|
            if e.faces.length==1
              hole=false
              break
            end
          }
          next if not hole
          ###
          pt=gface.bounds.center.project_to_plane(face.plane)
          if face.classify_point(pt)==Sketchup;;Face;;PointOutside
            tedges << gface.edges
            faces2go << gface ### save them up
          end
        }
        
        

        THEN erase_entities on faces2go and then erase! any of the tedges that don't have a face...

        TIG

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

          @unknownuser said:

          The .flatten! combines nested arrays
          The .uniq! removes duplicates
          Also [not applicable to THIS tool] .compact! would remove 'nil' array elements, or .sort! puts the list 'in order'...

          πŸ‘ Great to know. Will be useful.

          Your code works! Almost

          Like with the method I used before(face.clone holes.centers), I'm experiencing some faces don't get erased. (Having a model that look like a swiss cheese)

          I wonder why this happends. Your code should be working...

          For ex. I run the plugin once. Maybe 3 faces are not deleted but the edges are trimmed to fit. I run the plugin again with the component selected, then it is OK!

          It is like it needs another rescue operation? πŸ˜• Or maybe run the last command twice? Seems excessive..

          I will check my code as well. Been moving snippets back and forth, it need some cleaning up.

          And another thing. Was it GO for NOT using faceclone? Intersect with SS or Glue face?
          I havent implemented that yet, still using face.clone. Shouldent matter in this regard...


          Almost.jpg

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

            Think it is ok...

            Breaks sometimes, but only if using a simple squarish component. One have to consider what this tool is going to be used for.

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

              Try intersecting the group.entities with the face.edges+[face] twice ?
              Will make it slightly slower... BUT it might fix the potential glitch ??

              TIG

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

                Yes TIG, I think you are on the right track there! Good thinking.

                I was about to report that intersection is not working properly. One cannot erase a face if it can't be selected πŸ˜„

                This can be due to my code being a bit shabby at the moment, moving stuff back and forth as mentioned.

                I will "clean it" and report back later.

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

                  2 intersection gave a big improvement! Not 100% accurate, but I think it's good enough. One can force it by selecting the component and running the plugin again. It almost always sort out the fuzz, then.

                  Still intersecting with face.clone. Had some problem with intersecting with Sketchup.active.model selection...Expecting entitiy something..

                  Speed is better, even with 2 intersections πŸ˜‰

                  Did a test with a "heavy" component, ver 1.1 VS current dev.code. VER 1.1: 41.483 seconds. current dev.code: 4.278 seconds 😲

                  Do we move forward, TIG? Or delve deeper in this problem, to make perfection?


                  2 intersections.jpg

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

                    Ok, I have put out the new version 1.2 for testing. So you have something to play with this weekend.
                    It should be an improvement..

                    KEEP THE OLDER VERSION AT HANDS! I won't be able to fix issues this weekend πŸ˜„

                    Thank you TIG for all the help.

                    I haven't optimized the iterator exactley as TIG suggested, so that can be improved...

                    There are more issues to deal with later on.. But let's not spoil all the fun.

                    1 Reply Last reply Reply Quote 0
                    • andybotA Offline
                      andybot
                      last edited by

                      Joel, thanks so much for this plugin!! I have 2d elevations that I needed to glue to a massing, and this works absolutely perfect for my needs. Good work!
                      Andy

                      http://charlottesvillearchitecturalrendering.com/

                      1 Reply Last reply Reply Quote 0
                      • A Offline
                        AcesHigh
                        last edited by

                        can anyone check if this pluging works with meshes?

                        when importing several pieces from GoogleMaps, the pieces usually end overlapping each other, causing texture errors.

                        You cant use 3D boolean because obviously, meshes, are not solids.

                        So I would usually "zorro" the different meshes, and cut the parts that overlap. Obviously, a HUGE work when you are dealing with dozens of different GoogleEarth imported meshes. If this plugin works with those, it will be great!

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

                          Hey, I missed some posts in here!

                          Andybot. I'm glad someone have use for this plugin! Appreciate it!(we all know TIG's part of this of course)

                          AcesHigh.

                          I've seen your request in other post regarding this subject. Like I said. I think it lies more in the 3d domain, since the surfaces are not flat.

                          IF the intersecting geometry would be flat at intersectionpoints, 2dBoolean should activate. But I see your case you would need a subtraction-algorythm.

                          At this point 2dboolean only subtracts geometry outside the face it's lying on(or selected face).

                          What you are asking for is really needed, and I will see what can be done about that in the future. I'm kinda busy at the moment.

                          Have to deal with Hatchfaces webdialog, which unfortunaly proves very difficult.
                          I thought I only had to learn Javascript, HTML, CSS and JQUERY πŸ˜‰ . But there is need for some JSON and maybe AJAX as well. Kinda much required to make a simple dialog if you ask me.

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

                            Nice update.

                            But! If you are gonna further developp this tool, and display it in this thread with my icons included. Please don't scramble the code, so other can benefit from your code like you did on mine and Tig's.

                            Besides your plugin will be lost in this thread posting it here.

                            Best regards.

                            1 Reply Last reply Reply Quote 0
                            • JuantxoJ Offline
                              Juantxo
                              last edited by

                              Sorry, but actually I prefer the code scrambled. The code is not very optimized because I did it to translate to C after.
                              I don't use any line of your code. I used a simplicans planar theory. (I taked your one icon, feel free of use my icons)

                              Best regards

                              1 Reply Last reply Reply Quote 0
                              • jeff hammondJ Offline
                                jeff hammond
                                last edited by

                                @juantxo said:

                                Sorry, but actually I prefer the code scrambled. The code is not very optimized because I did it to translate to C after.
                                I don't use any line of your code. I used a simplicans planar theory. (I taked your one icon, feel free of use my icons)

                                Best regards

                                watch out, the πŸ€“ 's around here will unscramble your code and make sure you're telling the truth πŸ’š

                                dotdotdot

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

                                  @unknownuser said:

                                  I don't use any line of your code

                                  Ok. If you say so.

                                  @unknownuser said:

                                  I taked your one icon, feel free of use my icons

                                  That's ok. I don't mind that. 2 min PS for me.

                                  @unknownuser said:

                                  Sorry, but actually I prefer the code scrambled

                                  Ok, about that. I find it somewhat strange to post stuff for free, scrambled. thats not very helpful for other programmers.. Personally I rather tell to much then nothing at all.

                                  1 Reply Last reply Reply Quote 0
                                  • JuantxoJ Offline
                                    Juantxo
                                    last edited by

                                    Actually I'm working in 2D boolean of polygons in Sketchup because I need for other stuff. I did this plugin using simplicians theory.
                                    May be could be usefull for someone.

                                    You need to select two groups with a general planar polygon.
                                    General planar polygon = A single polygon or a polygon consisting of a set of non-intersecting single polygons.

                                    DOWNLOAD 2d_simplex_bool.rbz

                                    http://skelion.net/bool/2dbool.jpg

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

                                      New version 1.3.1 added:

                                      http://sketchucation.com/forums/viewtopic.php?f=323%26amp;t=39661

                                      Whole lot is rewritten so there may be lot of things broken. I suggest a lot of testing and report back bugs and wishes πŸ˜„

                                      Intersections should now be a Little quicker. And some new stuff as well.

                                      Make sure to read the manual in second post.

                                      Will try and add to pluginstore later.

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

                                        Manual

                                        Since ver 1.3.1


                                        manual_2dBoolean.zip

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

                                          I added it to the SketchUcation PluginStore for you... πŸ€“
                                          http://sketchucation.com/resources/pluginstore?pln=2dBoolean
                                          You might want to edit the listing and add documentation, release notes etc...

                                          TIG

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

                                            Thank you TIG. Really appreciate it!

                                            I havent done any update for a long time and must get up to date with how the pluginstore works, more in detail.

                                            I suppose I should move the manual there to, perhaps ? Did not manage to downsize it to less then 1.8 mb. 😞

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

                                            Advertisement